mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-28 16:43:20 -08:00
add test user data field for smuggling script state
This commit is contained in:
1 parent
77bacd640a
commit
b8bbd520a1
2 files changed
+16
-6
No files matched your search
+13
-6
@@ -32,16 +32,23 @@ test_exemplar_path(Arena *arena, TestCtx *ctx, String8 name)
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal String8
|
||||||
|
test_layer_from_file_path(String8 file_path)
|
||||||
|
{
|
||||||
|
U64 src_min = str8_find_needle(file_path, 0, s("src/"), StringMatchFlag_SlashInsensitive);
|
||||||
|
if (src_min == file_path.size) { return str8_zero(); }
|
||||||
|
U64 src_max = src_min + str8_lit("src/").size;
|
||||||
|
U64 layer_slash_max = str8_find_needle(file_path, src_max, s("/"), StringMatchFlag_SlashInsensitive);
|
||||||
|
if (layer_slash_max == file_path.size) { return str8_zero(); }
|
||||||
|
return str8_substr(file_path, r1u64(src_max, layer_slash_max));
|
||||||
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
base_register_test(char *func_name_cstr, TestFunctionType *fn, char *file_path_cstr, int line, int skip)
|
base_register_test(char *func_name_cstr, TestFunctionType *fn, char *file_path_cstr, int line, int skip)
|
||||||
{
|
{
|
||||||
String8 file_path = str8_cstring(file_path_cstr);
|
String8 file_path = str8_cstring(file_path_cstr);
|
||||||
U64 src_min = str8_find_needle(file_path, 0, s("src/"), StringMatchFlag_SlashInsensitive);
|
|
||||||
U64 src_max = src_min + str8_lit("src/").size;
|
|
||||||
U64 layer_slash_max = str8_find_needle(file_path, src_max, s("/"), StringMatchFlag_SlashInsensitive);
|
|
||||||
|
|
||||||
TestInfo *t = &test_infos[test_infos_count++];
|
TestInfo *t = &test_infos[test_infos_count++];
|
||||||
t->layer = str8_substr(file_path, r1u64(src_max, layer_slash_max));
|
t->layer = test_layer_from_file_path(file_path);
|
||||||
t->label = str8_cstring(func_name_cstr);
|
t->label = str8_cstring(func_name_cstr);
|
||||||
t->decl_line = line;
|
t->decl_line = line;
|
||||||
t->skip = skip;
|
t->skip = skip;
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ struct TestCtx
|
|||||||
String8 exemplars_path;
|
String8 exemplars_path;
|
||||||
String8 artifacts_path;
|
String8 artifacts_path;
|
||||||
String8 input_data_path;
|
String8 input_data_path;
|
||||||
|
String8 user_data;
|
||||||
TestResult *result_out;
|
TestResult *result_out;
|
||||||
String8List *test_out;
|
String8List *test_out;
|
||||||
};
|
};
|
||||||
@@ -46,6 +47,7 @@ struct TestInfo
|
|||||||
S64 decl_line;
|
S64 decl_line;
|
||||||
B32 skip;
|
B32 skip;
|
||||||
TestFunctionType *test_fn;
|
TestFunctionType *test_fn;
|
||||||
|
String8 user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if BUILD_TESTS
|
#if BUILD_TESTS
|
||||||
@@ -58,6 +60,7 @@ internal String8 test_build_exe_path(Arena *arena, String8 name);
|
|||||||
internal String8 test_input_path(Arena *arena, TestCtx *ctx, String8 name);
|
internal String8 test_input_path(Arena *arena, TestCtx *ctx, String8 name);
|
||||||
internal String8 test_input_exe_path(Arena *arena, TestCtx *ctx, String8 name);
|
internal String8 test_input_exe_path(Arena *arena, TestCtx *ctx, String8 name);
|
||||||
internal String8 test_exemplar_path(Arena *arena, TestCtx *ctx, String8 name);
|
internal String8 test_exemplar_path(Arena *arena, TestCtx *ctx, String8 name);
|
||||||
|
internal String8 test_layer_from_file_path(String8 file_path);
|
||||||
internal void base_register_test(char *func_name, TestFunctionType *fn, char *file_path, int line, int skip);
|
internal void base_register_test(char *func_name, TestFunctionType *fn, char *file_path, int line, int skip);
|
||||||
|
|
||||||
#define AddTest(name, file_path, line, skip_, ...) \
|
#define AddTest(name, file_path, line, skip_, ...) \
|
||||||
|
|||||||
Reference in new issue
Block a user