@@ -67,6 +67,14 @@ void assert_log_file(const char* filepath, const char* msg) {
|
||||
free(content);
|
||||
}
|
||||
|
||||
void assert_int(int expected, int actual, const char* msg) {
|
||||
if (expected != actual) {
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "%s (expected %d, got %d)", msg, expected, actual);
|
||||
fail(buf);
|
||||
}
|
||||
}
|
||||
|
||||
static void log_append(const char* msg) {
|
||||
size_t oldLen = s_logOutput ? strlen(s_logOutput) : 0;
|
||||
size_t newLen = oldLen + strlen(msg) + 1;
|
||||
@@ -111,6 +119,7 @@ static TestCase s_tests[] = {
|
||||
{"tokenstream_unknown_token", test_tokenstream_unknown_token},
|
||||
{"tokenstream_info", test_tokenstream_info},
|
||||
{"parser_module_name", test_parser_module_name},
|
||||
{"parser_imports", test_parser_imports},
|
||||
{"log_error", test_log_error},
|
||||
{"log_on_line", test_log_on_line},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user