Started sanity test suite (Non-parsed api)

Made some fixes based on errors found while iterating on first generation
This commit is contained in:
2023-06-28 14:43:21 -04:00
parent e74b498686
commit 0192cd49ef
10 changed files with 192 additions and 108 deletions

View File

@@ -307,12 +307,12 @@ struct GenArrayRequest
};
Array(GenArrayRequest) GenArrayRequests;
void gen__array_request( StrC type, StrC dep, sw size )
void gen__array_request( StrC type, sw size, StrC dep = {} )
{
GenArrayRequest request = { type, dep, size };
array_append( GenArrayRequests, request );
}
#define Gen_Array( type ) gen__array_request( txt_n_len( type ), sizeof(type) )
#define Gen_Array( type ) gen__array_request( { txt_n_len(type) }, sizeof(type) )
u32 gen_array_file()
{

47
test/NonParsed/Sanity.hpp Normal file
View File

@@ -0,0 +1,47 @@
#ifdef gen_time
#include "gen.hpp"
using namespace gen;
u32 gen_sanity()
{
Builder
gen_sanity_file;
gen_sanity_file.open("./sanity.gen.hpp");
// Comment
{
Code comment_test = def_comment( StrC::from("Sanity check: def_omment test") );
gen_sanity_file.print(comment_test);
gen_sanity_file.print_fmt("\n");
}
// Class
{
Code fwd = def_class( StrC::from("Test_EmptyClass") );
Code empty_body;
{
Code cmt = def_comment( StrC::from("Empty class") );
Code body = def_class_body( 1, cmt );
empty_body = def_class( StrC::from("Test_EmptyClass"), body );
}
gen_sanity_file.print(fwd);
gen_sanity_file.print(empty_body);
}
gen_sanity_file.print_fmt("\n");
//
{
}
gen_sanity_file.write();
return 0;
}
#endif

12
test/gen/sanity.gen.hpp Normal file
View File

@@ -0,0 +1,12 @@
// Sanity check: def_omment test
class Test_EmptyClass;
class Test_EmptyClass
{
// Empty class
};
UFUNCTION( BlueprintCallable, Category = "Test" )
void Test_UFunction(void);

View File

@@ -1,4 +1,6 @@
#include "Bloat.cpp"
#include "NonParsed\Array.NonParsed.hpp"
#include "NonParsed\Sanity.hpp"
#ifdef gen_time
@@ -9,13 +11,14 @@ using namespace gen;
int gen_main()
{
Memory::setup();
gen::init();
gen_sanity();
// gen_array_file();
gen::deinit();
Memory::cleanup();
return 0;