mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-10-02 05:58:41 +00:00
pull out test input/exemplar path formation helpers to base; fix torture crash
This commit is contained in:
+22
-1
@@ -3,6 +3,27 @@
|
||||
|
||||
#if BUILD_TESTS
|
||||
|
||||
internal String8
|
||||
test_input_path(Arena *arena, TestCtx *ctx, String8 name)
|
||||
{
|
||||
String8 path = str8f(arena, "%S/%S", ctx->input_data_path, name);
|
||||
return path;
|
||||
}
|
||||
|
||||
internal String8
|
||||
test_input_exe_path(Arena *arena, TestCtx *ctx, String8 name)
|
||||
{
|
||||
String8 path = str8f(arena, "%S/%S%S", ctx->input_data_path, name, program_ext_postfix_from_os(OperatingSystem_CURRENT, 1));
|
||||
return path;
|
||||
}
|
||||
|
||||
internal String8
|
||||
test_exemplar_path(Arena *arena, TestCtx *ctx, String8 name)
|
||||
{
|
||||
String8 path = str8f(arena, "%S/%S", ctx->exemplars_path, name);
|
||||
return path;
|
||||
}
|
||||
|
||||
internal void
|
||||
base_register_test(char *func_name_cstr, TestFunctionType *fn, char *file_path_cstr, int line, int skip)
|
||||
{
|
||||
@@ -10,7 +31,7 @@ base_register_test(char *func_name_cstr, TestFunctionType *fn, char *file_path_c
|
||||
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++];
|
||||
t->layer = str8_substr(file_path, r1u64(src_max, layer_slash_max));
|
||||
t->label = str8_cstring(func_name_cstr);
|
||||
|
||||
Reference in New Issue
Block a user