Fix for sanity test...

This commit is contained in:
2023-07-17 23:40:28 -04:00
parent 9a784fe92f
commit e501941c5c
5 changed files with 1641 additions and 155 deletions

View File

@ -1,9 +1,9 @@
#pragma once
#ifdef gen_time
#if gen_time
#define GEN_FEATURE_PARSING
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND
#define GEN_BENCHMARK
#include "gen.hpp"
using namespace gen;
@ -91,7 +91,7 @@ Code gen_SOA( CodeStruct struct_def, s32 num_entries = 0 )
}
));
String content = String::make( Memory::GlobalAllocator, "return\n{\n" );
String content = String::make( GlobalAllocator, "return\n{\n" );
for ( CodeVar member : vars )
{
@ -114,4 +114,31 @@ Code gen_SOA( CodeStruct struct_def, s32 num_entries = 0 )
return soa;
}
void check_SOA()
{
gen::init();
Builder soa_test; soa_test.open( "SOA.gen.hpp" );
soa_test.print( parse_using( code(
using u16 = unsigned short;
)));
soa_test.print( def_include( txt_StrC("gen.hpp")));
soa_test.print( def_using_namespace( name(gen) ) );
soa_test.print( gen_SOA(
parse_struct( code(
struct TestStruct
{
u8 A;
u16 B;
u32 C;
u64 D;
};
))
));
soa_test.write();
gen::deinit();
}
#endif

View File

@ -1,5 +1,11 @@
#define GEN_FEATURE_PARSING
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
#define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND
#define GEN_BENCHMARK
#include "gen.cpp"
#include "sanity.cpp"
#include "SOA.cpp"
#if gen_time
int gen_main()
@ -9,6 +15,8 @@ int gen_main()
check_sanity();
check_SOA();
return 0;
}
#endif