Echo Writes Code

assert.cpp

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "crucible/core/assert.inl"

namespace crucible::core
{
  auto fail_assertion(String_View const file, int const line, String_View const function) -> void
  {
    auto const truncated_file { file.strip_prefix(CRUCIBLE_SOURCE_ROOT) };

    print_error_line();
    print_error_line("ASSERTION FAILED");
    print_error_line("────────────────");
    print_error_line("Location: ", truncated_file, ":", line, " [", function, "]");
    print_error_line("Expected: Code path to be unreachable");

    std::terminate();
  }
}