mirror of
https://github.com/Ed94/metadesk.git
synced 2026-08-06 15:48:47 +00:00
omitting tests offloaded to metadesk_libgen
This commit is contained in:
+1
-91
@@ -116,7 +116,7 @@ verify-path $path_build
|
|||||||
|
|
||||||
if ($compile_sanity)
|
if ($compile_sanity)
|
||||||
{
|
{
|
||||||
write-host "Building code/metadesk.c (sanity compile) with $vendor"
|
write-host "Building source/metadesk.c (sanity compile) with $vendor"
|
||||||
|
|
||||||
$compiler_args = @()
|
$compiler_args = @()
|
||||||
$compiler_args += $flag_all_c
|
$compiler_args += $flag_all_c
|
||||||
@@ -166,94 +166,6 @@ if ($code_sanity)
|
|||||||
Pop-Location
|
Pop-Location
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($gen_c11)
|
|
||||||
{
|
|
||||||
write-host "Building gen_c11/gen_c11.c"
|
|
||||||
|
|
||||||
$compiler_args = @()
|
|
||||||
$compiler_args += $flag_all_c
|
|
||||||
$compiler_args += $flag_updated_cpp_macro
|
|
||||||
$compiler_args += $flag_c11
|
|
||||||
|
|
||||||
$linker_args = @()
|
|
||||||
$linker_args += $flag_link_win_subsystem_console
|
|
||||||
|
|
||||||
$includes = @( $path_gen_c11, $path_root )
|
|
||||||
$unit = join-path $path_gen_c11 'gen_c11.c'
|
|
||||||
$executable = join-path $path_build 'gen_c11.exe'
|
|
||||||
|
|
||||||
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
|
||||||
|
|
||||||
$path_gen = join-path $path_gen_c11 'gen'
|
|
||||||
verify-path $path_gen
|
|
||||||
|
|
||||||
Push-Location $path_root
|
|
||||||
if ( Test-Path( $executable ) ) {
|
|
||||||
write-host "`nRunning gen_c11/gen_c11.exe"
|
|
||||||
$time_taken = Measure-Command { & $executable
|
|
||||||
| ForEach-Object {
|
|
||||||
write-host `t $_ -ForegroundColor Green
|
|
||||||
}
|
|
||||||
}
|
|
||||||
write-host "`ntest/code_sanity completed in $($time_taken.TotalMilliseconds) ms"
|
|
||||||
}
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($c11_sanity)
|
|
||||||
{
|
|
||||||
write-host " Building tests/c11_sanity.c"
|
|
||||||
|
|
||||||
$compiler_args = @()
|
|
||||||
$compiler_args += $flag_all_c
|
|
||||||
$compiler_args += $flag_updated_cpp_macro
|
|
||||||
$compiler_args += $flag_c11
|
|
||||||
|
|
||||||
$linker_args = @()
|
|
||||||
$linker_args += $flag_link_win_subsystem_console
|
|
||||||
|
|
||||||
$path_gen = join-path $path_gen_c11 'gen'
|
|
||||||
|
|
||||||
$includes = @( $path_gen, $path_root )
|
|
||||||
$unit = join-path $path_tests 'c11_sanity.c'
|
|
||||||
$executable = join-path $path_build 'c11_sanity.exe'
|
|
||||||
|
|
||||||
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
|
||||||
|
|
||||||
Push-Location $path_root
|
|
||||||
if ( Test-Path( $executable ) ) {
|
|
||||||
write-host "`nRunning tests/c11_sanity_segregated.exe (segregated)"
|
|
||||||
$time_taken = Measure-Command { & $executable
|
|
||||||
| ForEach-Object {
|
|
||||||
write-host `t $_ -ForegroundColor Green
|
|
||||||
}
|
|
||||||
}
|
|
||||||
write-host "`ntest/code_sanity completed in $($time_taken.TotalMilliseconds) ms"
|
|
||||||
}
|
|
||||||
Pop-Location
|
|
||||||
|
|
||||||
$compiler_args += ($flag_define + "TEST_SINGLEHEADER")
|
|
||||||
|
|
||||||
$result = build-simple $path_build $includes $compiler_args $linker_args $unit $executable
|
|
||||||
|
|
||||||
Push-Location $path_root
|
|
||||||
if ( Test-Path( $executable ) ) {
|
|
||||||
write-host "`nRunning tests/c11_sanity.exe (single header)"
|
|
||||||
$time_taken = Measure-Command { & $executable
|
|
||||||
| ForEach-Object {
|
|
||||||
write-host `t $_ -ForegroundColor Green
|
|
||||||
}
|
|
||||||
}
|
|
||||||
write-host "`ntest/code_sanity completed in $($time_taken.TotalMilliseconds) ms"
|
|
||||||
}
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($cpp17_sanity)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($sanity_tests)
|
if ($sanity_tests)
|
||||||
{
|
{
|
||||||
write-host " Building tests/sanity_tests.c"
|
write-host " Building tests/sanity_tests.c"
|
||||||
@@ -297,6 +209,4 @@ if ($expression_tests)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Pop-Location # $path_root
|
Pop-Location # $path_root
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
// This is tests both the segregated and single-header libraris
|
|
||||||
|
|
||||||
#if TEST_SINGLEHEADER
|
|
||||||
#define MD_IMPLEMENTATION
|
|
||||||
#include "metadesk_singleheader.h"
|
|
||||||
#else
|
|
||||||
#include "metadesk_deps.c"
|
|
||||||
#include "metadesk.c"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// This program expects to be run from the build directory (where it would be after being built)
|
|
||||||
#define path_root
|
|
||||||
#define path_examples path_root "examples/"
|
|
||||||
#define path_intro path_examples "intro/"
|
|
||||||
#define path_hello_world_mdesk path_intro "hello_world.mdesk"
|
|
||||||
|
|
||||||
#define lit md_str8_lit
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
MD_Context ctx = {0};
|
|
||||||
ctx.os_ctx.enable_large_pages = true;
|
|
||||||
md_init(& ctx);
|
|
||||||
|
|
||||||
printf("metadesk: got past init!\n");
|
|
||||||
|
|
||||||
MD_Arena* arena = md_arena_alloc();
|
|
||||||
MD_String8 hello_world_mdesk = md_os_data_from_file_path(arena, lit(path_hello_world_mdesk));
|
|
||||||
|
|
||||||
MD_TokenizeResult lexed = md_tokenize_from_text (arena, hello_world_mdesk);
|
|
||||||
MD_ParseResult parsed = md_parse_from_text_tokens(arena, lit(path_hello_world_mdesk), hello_world_mdesk, lexed.tokens);
|
|
||||||
|
|
||||||
#define md_str8_list_iter(list, elem) list.first; elem; elem = elem->next
|
|
||||||
MD_String8List debug_list = md_debug_string_list_from_tree(arena, parsed.root);
|
|
||||||
|
|
||||||
printf("Parsed listing:\n");
|
|
||||||
for (MD_String8Node* elem = md_str8_list_iter(debug_list, elem))
|
|
||||||
{
|
|
||||||
MD_String8 entry = elem->string;
|
|
||||||
if (md_str8_find_needle(entry, 0, lit("\n"), 0) < entry.size) {
|
|
||||||
printf("%*s", (int)entry.size, entry.str);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("%*s\n", (int)entry.size, entry.str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
md_deinit(& ctx);
|
|
||||||
}
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
// This is test strictly for the granular (non-generated) version of the library to make sure it operates correctly
|
|
||||||
|
|
||||||
// #define MD_LINKED_LIST_PURE_MACRO 1
|
|
||||||
// #define MD_DONT_MAP_ANREA_TO_ALLOCATOR_IMPL 1
|
|
||||||
#include "metadesk.c"
|
|
||||||
|
|
||||||
// This program expects to be run from the build directory (where it would be after being built)
|
|
||||||
#define path_examples "../examples"
|
|
||||||
#define path_intro path_examples "/intro"
|
|
||||||
#define path_hello_world_mdesk path_intro "/hello_world.mdesk"
|
|
||||||
|
|
||||||
#define text str8_lit
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
Context ctx = {0};
|
|
||||||
ctx.os_ctx.enable_large_pages = true;
|
|
||||||
init(& ctx);
|
|
||||||
|
|
||||||
printf("metadesk: got past init!\n");
|
|
||||||
|
|
||||||
Arena* arena = arena_alloc();
|
|
||||||
String8 hello_world_mdesk = os_data_from_file_path(arena, text(path_hello_world_mdesk));
|
|
||||||
|
|
||||||
TokenizeResult lexed = tokenize_from_text (arena, hello_world_mdesk);
|
|
||||||
ParseResult parsed = parse_from_text_tokens(arena, text(path_hello_world_mdesk), hello_world_mdesk, lexed.tokens);
|
|
||||||
|
|
||||||
#define str8_list_iter(list, elem) list.first; elem; elem = elem->next
|
|
||||||
String8List debug_list = debug_string_list_from_tree(arena, parsed.root);
|
|
||||||
|
|
||||||
printf("Parsed listing:\n");
|
|
||||||
for (String8Node* elem = str8_list_iter(debug_list, elem))
|
|
||||||
{
|
|
||||||
String8 entry = elem->string;
|
|
||||||
if (str8_find_needle(entry, 0, str8_lit("\n"), 0) < entry.size) {
|
|
||||||
printf("%*s", (int)entry.size, entry.str);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf("%*s\n", (int)entry.size, entry.str);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SSIZE what = 54;
|
|
||||||
String8 test = str8_from(arena, what);
|
|
||||||
|
|
||||||
deinit(& ctx);
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#include "md.h"
|
|
||||||
#include "md.c"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
static MD_Arena *arena = 0;
|
|
||||||
|
|
||||||
int main(void)
|
|
||||||
{
|
|
||||||
arena = MD_ArenaAlloc();
|
|
||||||
|
|
||||||
printf("%d\n", MD_CPP_VERSION);
|
|
||||||
|
|
||||||
#if MD_CPP_VERSION != 0 && MD_CPP_VERSION != 98 // anything C++11 and up
|
|
||||||
MD_String8 foo = "foo"_md;
|
|
||||||
MD_String8 bar = "bar"_md;
|
|
||||||
MD_String8 str = MD_S8Fmt(arena, "%S%S", foo, bar);
|
|
||||||
printf("%.*s", MD_S8VArg(str));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user