Mercurial > hg > orthanc-stone
changeset 687:342f3e04bfa9 am-dev
CodeGen: test cleanup + all working again + using same yaml and stimuli files
line wrap: on
line diff
--- a/Resources/CodeGeneration/README.md Thu May 16 16:45:10 2019 +0200 +++ b/Resources/CodeGeneration/README.md Thu May 16 17:51:17 2019 +0200 @@ -10,7 +10,7 @@ `testCppHandler` contains a C++ project that produces an executable slurping a set of text files representing messages defined against -the `test_data/test1.yaml' schema and dumping them to `cout`. +the `test_data/testTestStoneCodeGen.yaml' schema and dumping them to `cout`. 'testWasmIntegrated` contains a small Web app demonstrating the interaction between TypeScript and C++ in WASM.
--- a/Resources/CodeGeneration/stonegentool_test.py Thu May 16 16:45:10 2019 +0200 +++ b/Resources/CodeGeneration/stonegentool_test.py Thu May 16 17:51:17 2019 +0200 @@ -87,13 +87,13 @@ self.assertEqual(b4,["int","vector<string>"]) def test_ParseSchema(self): - fn = os.path.join(os.path.dirname(__file__), 'test_data', 'test1.yaml') + fn = os.path.join(os.path.dirname(__file__), 'test_data', 'testTestStoneCodeGen.yaml') obj = LoadSchema(fn) # we're happy if it does not crash :) CheckSchemaSchema(obj) def test_ComputeRequiredDeclarationOrder(self): - fn = os.path.join(os.path.dirname(__file__), 'test_data', 'test1.yaml') + fn = os.path.join(os.path.dirname(__file__), 'test_data', 'testTestStoneCodeGen.yaml') obj = LoadSchema(fn) genOrder: str = ComputeRequiredDeclarationOrder(obj) self.assertEqual(5,len(genOrder)) @@ -110,7 +110,7 @@ def test_genEnums(self): self.maxDiff = None - fn = os.path.join(os.path.dirname(__file__), 'test_data', 'test1.yaml') + fn = os.path.join(os.path.dirname(__file__), 'test_data', 'testTestStoneCodeGen.yaml') obj = LoadSchema(fn) genOrder: str = ComputeRequiredDeclarationOrder(obj) processedSchema = ProcessSchema(obj, genOrder) @@ -127,13 +127,15 @@ self.assertTrue('someBs' in structs['C']['fields']) self.assertTrue('CrispType' in enums) self.assertTrue('Message1' in structs) - self.assertEqual('int32', structs['Message1']['fields']['a'].type) - self.assertEqual('string', structs['Message1']['fields']['b'].type) - self.assertEqual('EnumMonth0', structs['Message1']['fields']['c'].type) - self.assertEqual('bool', structs['Message1']['fields']['d'].type) + self.assertEqual('int32', structs['Message1']['fields']['memberInt32'].type) + self.assertEqual('string', structs['Message1']['fields']['memberString'].type) + self.assertEqual('EnumMonth0', structs['Message1']['fields']['memberEnumMonth'].type) + self.assertEqual('bool', structs['Message1']['fields']['memberBool'].type) + self.assertEqual('float32', structs['Message1']['fields']['memberFloat32'].type) + self.assertEqual('float64', structs['Message1']['fields']['memberFloat64'].type) def test_GenerateTypeScriptEnums(self): - fn = os.path.join(os.path.dirname(__file__), 'test_data', 'test1.yaml') + fn = os.path.join(os.path.dirname(__file__), 'test_data', 'testTestStoneCodeGen.yaml') tdico = GetTemplatingDictFromSchemaFilename(fn) template = Template(""" // end of generic methods {% for enum in enums%} export enum {{enum['name']}} { @@ -167,7 +169,7 @@ self.assertEqual(renderedCodeRef,renderedCode) def test_GenerateCplusplusEnums(self): - fn = os.path.join(os.path.dirname(__file__), 'test_data', 'test1.yaml') + fn = os.path.join(os.path.dirname(__file__), 'test_data', 'testTestStoneCodeGen.yaml') tdico = GetTemplatingDictFromSchemaFilename(fn) template = Template(""" // end of generic methods {% for enum in enums%} enum {{enum['name']}} { @@ -201,48 +203,9 @@ self.assertEqual(renderedCodeRef,renderedCode) def test_generateTsStructType(self): - fn = os.path.join(os.path.dirname(__file__), 'test_data', 'test1.yaml') + fn = os.path.join(os.path.dirname(__file__), 'test_data', 'testTestStoneCodeGen.yaml') tdico = GetTemplatingDictFromSchemaFilename(fn) - ref = """ export class Message1 { - a: number; - b: string; - c: EnumMonth0; - d: boolean; - e: number; - f: number; - - public StoneSerialize(): string { - let container: object = {}; - container['type'] = 'VsolStuff.Message1'; - container['value'] = this; - return JSON.stringify(container); - } - }; - export class Message2 { - toto: string; - tata: Message1[]; - tutu: string[]; - titi: Map<string, string>; - lulu: Map<string, Message1>; - - constructor() - { - this.tata = new Array<Message1>(); - this.tutu = new Array<string>(); - this.titi = new Map<string, string>(); - this.lulu = new Map<string, Message1>(); - } - - public StoneSerialize(): string { - let container: object = {}; - container['type'] = 'VsolStuff.Message2'; - container['value'] = this; - return JSON.stringify(container); - } - }; - -""" # template = MakeTemplate(""" // end of generic methods # {% for struct in struct%} export class {{struct['name']}} { # {% for key in struct['fields']%} {{key}}:{{struct['fields'][key]}}, @@ -293,7 +256,7 @@ public StoneSerialize(): string { let container: object = {}; - container['type'] = 'VsolMessages.A'; + container['type'] = 'TestStoneCodeGen.A'; container['value'] = this; return JSON.stringify(container); } @@ -310,7 +273,7 @@ public StoneSerialize(): string { let container: object = {}; - container['type'] = 'VsolMessages.B'; + container['type'] = 'TestStoneCodeGen.B'; container['value'] = this; return JSON.stringify(container); } @@ -327,57 +290,63 @@ public StoneSerialize(): string { let container: object = {}; - container['type'] = 'VsolMessages.C'; + container['type'] = 'TestStoneCodeGen.C'; container['value'] = this; return JSON.stringify(container); } }; export class Message1 { - a:number; - b:string; - c:EnumMonth0; - d:boolean; - e:number; - f:number; + memberInt32:number; + memberString:string; + memberEnumMonth:EnumMonth0; + memberBool:boolean; + memberFloat32:number; + memberFloat64:number; constructor() { - this.a = new number(); - this.b = new string(); - this.c = new EnumMonth0(); - this.d = new boolean(); - this.e = new number(); - this.f = new number(); + this.memberInt32 = new number(); + this.memberString = new string(); + this.memberEnumMonth = new EnumMonth0(); + this.memberBool = new boolean(); + this.memberFloat32 = new number(); + this.memberFloat64 = new number(); } public StoneSerialize(): string { let container: object = {}; - container['type'] = 'VsolMessages.Message1'; + container['type'] = 'TestStoneCodeGen.Message1'; container['value'] = this; return JSON.stringify(container); } }; export class Message2 { - toto:string; - tata:Array<Message1>; - tutu:Array<string>; - titi:Map<string, string>; - lulu:Map<string, Message1>; - movieType:MovieType; + memberString:string; + memberStringWithDefault:string; + memberVectorOfMessage1:Array<Message1>; + memberVectorOfString:Array<string>; + memberMapStringString:Map<string, string>; + memberMapStringStruct:Map<string, Message1>; + memberMapEnumFloat:Map<CrispType, number>; + memberEnumMovieType:MovieType; + memberJson:Object; constructor() { - this.toto = new string(); - this.tata = new Array<Message1>(); - this.tutu = new Array<string>(); - this.titi = new Map<string, string>(); - this.lulu = new Map<string, Message1>(); - this.movieType = new MovieType(); + this.memberString = new string(); + this.memberStringWithDefault = new string(); + this.memberVectorOfMessage1 = new Array<Message1>(); + this.memberVectorOfString = new Array<string>(); + this.memberMapStringString = new Map<string, string>(); + this.memberMapStringStruct = new Map<string, Message1>(); + this.memberMapEnumFloat = new Map<CrispType, number>(); + this.memberEnumMovieType = new MovieType(); + this.memberJson = new Object(); } public StoneSerialize(): string { let container: object = {}; - container['type'] = 'VsolMessages.Message2'; + container['type'] = 'TestStoneCodeGen.Message2'; container['value'] = this; return JSON.stringify(container); } @@ -390,7 +359,7 @@ def test_generateWholeTsFile(self): schemaFile = \ - os.path.join(os.path.dirname(__file__), 'test_data', 'test1.yaml') + os.path.join(os.path.dirname(__file__), 'test_data', 'testTestStoneCodeGen.yaml') tdico = GetTemplatingDictFromSchemaFilename(schemaFile) tsTemplateFile = \ os.path.join(os.path.dirname(__file__), 'template.in.ts.j2')
--- a/Resources/CodeGeneration/template.in.h.j2 Thu May 16 16:45:10 2019 +0200 +++ b/Resources/CodeGeneration/template.in.h.j2 Thu May 16 17:51:17 2019 +0200 @@ -228,6 +228,7 @@ { out << MakeIndent(indent+2) << "\"" << it->first << "\" : "; StoneDumpValue(out, it->second, indent+2); + out << ", \n"; } out << MakeIndent(indent) << "}\n"; return out; @@ -269,6 +270,7 @@ for (size_t i = 0; i < value.size(); ++i) { StoneDumpValue(out, value[i], indent+2); + out << ", \n"; } out << MakeIndent(indent) << "]\n"; return out; @@ -309,6 +311,7 @@ for (typename std::set<T>::const_iterator it = value.begin(); it != value.end(); ++it) { StoneDumpValue(out, *it, indent+2); + out << ", \n"; } out << MakeIndent(indent) << "]\n"; return out; @@ -395,7 +398,7 @@ { {% for key in enum['fields']%} if( value == {{enum['name']}}_{{key}}) { - out << MakeIndent(indent) << "{{key}}" << std::endl; + out << MakeIndent(indent) << "{{key}}"; } {%endfor%} return out; } @@ -435,11 +438,11 @@ inline std::ostream& StoneDumpValue(std::ostream& out, const {{struct['name']}}& value, size_t indent = 0) { out << MakeIndent(indent) << "{\n"; -{% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} out << MakeIndent(indent) << "{{key}}:\n"; +{% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%} out << MakeIndent(indent+2) << "{{key}}: "; StoneDumpValue(out, value.{{key}},indent+2); - out << "\n"; + out << ", \n"; {% endfor %}{% endif %}{% endif %} - out << MakeIndent(indent) << "}\n"; + out << MakeIndent(indent) << "}"; return out; }
--- a/Resources/CodeGeneration/testCppHandler/CMakeLists.txt Thu May 16 16:45:10 2019 +0200 +++ b/Resources/CodeGeneration/testCppHandler/CMakeLists.txt Thu May 16 17:51:17 2019 +0200 @@ -3,13 +3,13 @@ project(testCppHandler) set(testCppHandler_Codegen_Deps - ${CMAKE_CURRENT_LIST_DIR}/../test_data/test1.yaml + ${CMAKE_CURRENT_LIST_DIR}/../test_data/testTestStoneCodeGen.yaml ${CMAKE_CURRENT_LIST_DIR}/../template.in.h.j2 ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/VsolMessages_generated.hpp - COMMAND python ${CMAKE_CURRENT_LIST_DIR}/../stonegentool.py -o ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/../test_data/test1.yaml + COMMAND python ${CMAKE_CURRENT_LIST_DIR}/../stonegentool.py -o ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/../test_data/testTestStoneCodeGen.yaml DEPENDS ${testCppHandler_Codegen_Deps} )
--- a/Resources/CodeGeneration/testCppHandler/main.cpp Thu May 16 16:45:10 2019 +0200 +++ b/Resources/CodeGeneration/testCppHandler/main.cpp Thu May 16 17:51:17 2019 +0200 @@ -8,7 +8,7 @@ #include <boost/program_options.hpp> using namespace boost::program_options; -#include "VsolMessages_generated.hpp" +#include "TestStoneCodeGen_generated.hpp" /** Transforms `str` by replacing occurrences of `oldStr` with `newStr`, using @@ -39,32 +39,32 @@ return string(bytes.data(), fileSize); } -class MyHandler : public VsolMessages::IHandler +class MyHandler : public TestStoneCodeGen::IHandler { public: - virtual bool Handle(const VsolMessages::A& value) override + virtual bool Handle(const TestStoneCodeGen::A& value) override { - VsolMessages::StoneDumpValue(cout, value); + TestStoneCodeGen::StoneDumpValue(cout, value); return true; } - virtual bool Handle(const VsolMessages::B& value) override + virtual bool Handle(const TestStoneCodeGen::B& value) override { - VsolMessages::StoneDumpValue(cout, value); + TestStoneCodeGen::StoneDumpValue(cout, value); return true; } - virtual bool Handle(const VsolMessages::C& value) override + virtual bool Handle(const TestStoneCodeGen::C& value) override { - VsolMessages::StoneDumpValue(cout, value); + TestStoneCodeGen::StoneDumpValue(cout, value); return true; } - virtual bool Handle(const VsolMessages::Message1& value) override + virtual bool Handle(const TestStoneCodeGen::Message1& value) override { - VsolMessages::StoneDumpValue(cout, value); + TestStoneCodeGen::StoneDumpValue(cout, value); return true; } - virtual bool Handle(const VsolMessages::Message2& value) override + virtual bool Handle(const TestStoneCodeGen::Message2& value) override { - VsolMessages::StoneDumpValue(cout, value); + TestStoneCodeGen::StoneDumpValue(cout, value); return true; } }; @@ -77,7 +77,7 @@ cout << "+--------------------------------------------+\n"; MyHandler handler; auto contents = SlurpFile(filePath.path().string()); - VsolMessages::StoneDispatchToHandler(contents, &handler); + TestStoneCodeGen::StoneDispatchToHandler(contents, &handler); } int main(int argc, char** argv)
--- a/Resources/CodeGeneration/testCppHandler/test_data/test_Message2.json Thu May 16 16:45:10 2019 +0200 +++ b/Resources/CodeGeneration/testCppHandler/test_data/test_Message2.json Thu May 16 17:51:17 2019 +0200 @@ -1,42 +1,47 @@ { - "type": "VsolMessages.Message2", + "type": "TestStoneCodeGen.Message2", "value": { - "tata": [ + "memberVectorOfMessage1": [ { - "a": 42, - "b": "Benjamin", - "c": "January", - "d": false, - "e": 0.1, - "f": -0.2 + "memberInt32": 42, + "memberString": "Benjamin", + "memberEnumMonth": "January", + "memberBool": false, + "memberFloat32": 0.1, + "memberFloat64": -0.2 }, { - "a": 43, - "b": "Sandrine", - "c": "March" + "memberInt32": 43, + "memberString": "Sandrine", + "memberEnumMonth": "March" } ], - "tutu": [ + "memberVectorOfString": [ "Mercadet", "Poisson" ], - "titi": { + "memberMapStringString": { "44": "key 44", "45": "key 45" }, - "lulu": { + "memberMapStringStruct": { "54": { - "a": 43, - "b": "Sandrine", - "c": "March" + "memberInt32": 43, + "memberString": "Sandrine", + "memberEnumMonth": "March" }, "55": { - "a": 42, - "b": "Benjamin", - "c": "January", - "d": false + "memberInt32": 42, + "memberString": "Benjamin", + "memberEnumMonth": "January", + "memberBool": false } }, - "toto": "Prout zizi" + "memberString": "Prout zizi", + "memberMapEnumFloat" : { + "SaltAndPepper" : 0.1, + "CreamAndChives" : -0.2 + }, + "memberJson" : {"custom-key": "custom-value"} } } \ No newline at end of file
--- a/Resources/CodeGeneration/testWasmIntegrated/CMakeLists.txt Thu May 16 16:45:10 2019 +0200 +++ b/Resources/CodeGeneration/testWasmIntegrated/CMakeLists.txt Thu May 16 17:51:17 2019 +0200 @@ -22,8 +22,8 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/testWasmIntegratedCpp_generated.hpp ${CMAKE_CURRENT_BINARY_DIR}/testWasmIntegratedCpp_generated.ts - COMMAND python3 ${CMAKE_CURRENT_LIST_DIR}/../stonegentool.py -o ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/testWasmIntegratedCpp_api.yaml - DEPENDS ${testCppHandler_Codegen_Deps} ${CMAKE_CURRENT_LIST_DIR}/testWasmIntegratedCpp_api.yaml + COMMAND python3 ${CMAKE_CURRENT_LIST_DIR}/../stonegentool.py -o ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/../test_data/testTestStoneCodeGen.yaml + DEPENDS ${testCppHandler_Codegen_Deps} ${CMAKE_CURRENT_LIST_DIR}/../test_data/testTestStoneCodeGen.yaml ) add_executable(testWasmIntegratedCpp
--- a/Resources/CodeGeneration/testWasmIntegrated/build-web.sh Thu May 16 16:45:10 2019 +0200 +++ b/Resources/CodeGeneration/testWasmIntegrated/build-web.sh Thu May 16 17:51:17 2019 +0200 @@ -22,8 +22,10 @@ # copy WASM binary to output dir cp build-wasm/testWasmIntegratedCpp.wasm build-final/ -echo "...Serving files at http://127.0.0.1:8080/" -echo "Please open build_final/testWasmIntegrated.html" +cp ../test_data/testTestStoneCodeGen.yaml build-final/ +cp ../testCppHandler/test_data/test_Message2.json build-final/cppHandler_test_Message2.json + +echo "...Serving files at http://127.0.0.1:8080/build-final/testWasmIntegrated.html" sudo python3 serve.py
--- a/Resources/CodeGeneration/testWasmIntegrated/testWasmIntegrated.html Thu May 16 16:45:10 2019 +0200 +++ b/Resources/CodeGeneration/testWasmIntegrated/testWasmIntegrated.html Thu May 16 17:51:17 2019 +0200 @@ -31,7 +31,7 @@ </div> <div class="TestWasm-Test1"> - <button class="TestWasm-button" tool-selector="Test 1">Test 1</button> + <button class="TestWasm-button" tool-selector="Test CppHandler message2">Test CppHandler message2</button> </div> <div class="TestWasm-Test2"> <button class="TestWasm-button" tool-selector="Test 2">Test 2</button>
--- a/Resources/CodeGeneration/testWasmIntegrated/testWasmIntegrated.ts Thu May 16 16:45:10 2019 +0200 +++ b/Resources/CodeGeneration/testWasmIntegrated/testWasmIntegrated.ts Thu May 16 17:51:17 2019 +0200 @@ -48,121 +48,23 @@ | define stock messages | +--------------------------------------------------+ */ -let schemaText: string = `rootName: testWasmIntegratedCpp - -struct B: - someAs: vector<A> - someInts: vector<int32> - -struct C: - someBs: vector<B> - ddd: vector<string> - definition: vector<json> - -struct A: - someStrings: vector<string> - someInts2: vector<int32> - movies: vector<MovieType> - -struct Message1: - a: int32 - b: string - c: EnumMonth0 - d: bool - -struct Message2: - toto: string - tata: vector<Message1> - tutu: vector<string> - titi: map<string, string> - lulu: map<string, Message1> - movieType: MovieType - definition: json - -enum MovieType: - - RomCom - - Horror - - ScienceFiction - - Vegetables - -enum CrispType: - - SaltAndPepper - - CreamAndChives - - Paprika - - Barbecue - -enum EnumMonth0: - - January - - February - - March -`; +let schemaText: string = null; +fetch("testTestStoneCodeGen.yaml").then(function(res) {return res.text();}).then(function(text) {schemaText = text;}); let stockSerializedMessages = new Map<string,string>(); -stockSerializedMessages["Test 1"] = `{ - "type" : "testWasmIntegratedCpp.Message2", - "value" : - { - "lulu" : - { - "54" : - { - "a" : 43, - "b" : "Sandrine", - "c" : "March", - "d" : true - }, - "55" : - { - "a" : 42, - "b" : "Benjamin", - "c" : "January", - "d" : false - } - }, - "tata" : - [ - { - "a" : 42, - "b" : "Benjamin", - "c" : "March", - "d" : false - }, - { - "a" : 43, - "b" : "Sandrine", - "c" : "January", - "d" : false - } - ], - "titi" : - { - "44" : "key 44", - "45" : "key 45" - }, - "toto" : "Prout zizi", - "tutu" : - [ - "Mercadet", - "Poisson" - ], - "definition": - { - "val" : [ "berk", 42 ], - "zozo" : - { - "23": "zloutch", - "lalala": 42 - } - } - } -}`; +stockSerializedMessages["Test CppHandler message2"] = null; +fetch("cppHandler_test_Message2.json").then(function(res) {return res.text();}).then(function(text) {stockSerializedMessages["Test CppHandler message2"] = text;}); + stockSerializedMessages["Test 2"] = ` { - "type" : "testWasmIntegratedCpp.Message1", + "type" : "TestStoneCodeGen.Message1", "value" : { - "a" : -987, - "b" : "Salomé", - "c" : 2, - "d" : true + "memberInt32" : -987, + "memberString" : "Salomé", + "memberEnumMonth" : "March", + "memberBool" : true, + "memberFloat32" : 0.1, + "memberFloat64" : -0.2, + "extraMember" : "don't care" } }`; stockSerializedMessages["Test 3"] = "Test 3 stock message sdfsfsdfsdf";
--- a/Resources/CodeGeneration/testWasmIntegrated/testWasmIntegratedCpp_api.yaml Thu May 16 16:45:10 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -# -# 1 2 3 4 5 6 7 8 -# 345678901234567890123456789012345678901234567890123456789012345678901234567890 -# -rootName: testWasmIntegratedCpp - -struct B: - someAs: vector<A> - someInts: vector<int32> - -struct C: - someBs: vector<B> - ddd: vector<string> - definition: vector<json> - -struct A: - someStrings: vector<string> - someInts2: vector<int32> - movies: vector<MovieType> - -struct Message1: - a: int32 - b: string - c: EnumMonth0 - d: bool - -struct Message2: - toto: string - tata: vector<Message1> - tutu: vector<string> - titi: map<string, string> - lulu: map<string, Message1> - movieType: MovieType - definition: json - -enum MovieType: - - RomCom - - Horror - - ScienceFiction - - Vegetables - -enum CrispType: - - SaltAndPepper - - CreamAndChives - - Barbecue - - Paprika - -enum EnumMonth0: - - January - - February - - March - -enum Tata: - - Lolo - - Rrrrrrrrrrrr - - -
--- a/Resources/CodeGeneration/test_data/test1.jsonc Thu May 16 16:45:10 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* - 1 2 3 4 5 6 7 -12345678901234567890123456789012345678901234567890123456789012345678901234567890 -*/ -{ - "root_name":"test1", - "types": [ - { - "name":"B", - "kind":"struct", - "fields": [ - { - "name":"someAs", - "type":"vector<A>" - }, - { - "name":"someInts", - "type":"vector<int32>" - } - ] - }, - { - "name":"C", - "kind":"struct", - "fields": [ - { - "name":"someBs", - "type":"vector<B>" - }, - { - "name":"ddd", - "type":"vector<D>" - } - ] - }, - { - "name":"A", - "kind":"struct", - "fields": [ - { - "name":"someStrings", - "type":"vector<string>" - }, - { - "name":"someInts2", - "type":"vector<int32>" - } - ] - }, - { - "name":"MovieType", - "kind":"enum", - "fields": [ - { - "name":"Romcom" - }, - { - "name":"Horror" - }, - { - "name":"ScienceFiction" - }, - { - "name":"Vegetables" - } - ] - }, - { - "name":"CrispType", - "kind":"enum", - "fields": [ - { - "name":"SaltAndPepper" - }, - { - "name":"CreamAndChives" - }, - { - "name":"Paprika" - }, - { - "name":"Barbecue" - } - ] - } - ] -}
--- a/Resources/CodeGeneration/test_data/test1.yaml Thu May 16 16:45:10 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -# -# 1 2 3 4 5 6 7 8 -# 345678901234567890123456789012345678901234567890123456789012345678901234567890 -# -rootName: VsolMessages - -struct B: - __handler: cpp - - someAs: vector<A> - someInts: vector<int32> - -struct C: - __handler: cpp - - someBs: vector<B> - ddd: vector<string> - -struct A: - __handler: cpp - - someStrings: vector<string> - someInts2: vector<int32> - movies: vector<MovieType> - -struct Message1: - __handler: cpp - - a: int32 - b: string - c: EnumMonth0 - d: bool - e: float32 - f: float64 - -struct Message2: - __handler: cpp - - toto: string = "my-default-value" - tata: vector<Message1> - tutu: vector<string> - titi: map<string, string> - lulu: map<string, Message1> - movieType: MovieType - -enum MovieType: - - RomCom - - Horror - - ScienceFiction - - Vegetables - -enum CrispType: - - SaltAndPepper - - CreamAndChives - - Paprika - - Barbecue - -enum EnumMonth0: - - January - - February - - March
--- a/Resources/CodeGeneration/test_data/test1_bogus_json.jsonc Thu May 16 16:45:10 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -{ - "root_name":"test1", - "types": [ - { - "name":"B", - "kind":"struct", - "fields": [ - { - "name":"someAs", - "type":"vector<A>" - }}, - { - "name":"someInts", - "type":"vector<int32>" - } - ] - }, - { - "name":"A", - "kind":"struct", - "fields": [ - { - "name":"someStrings", - "type":"vector<string>" - }, - { - "name":"someInts2", - "type":"vector<int32>" - } - ] - }, - { - "name":"MovieType", - "kind":"enum", - "fields": [ - { - "name":"Romcom", - }, - { - "name":"Horror", - }, - { - "name":"ScienceFiction", - }, - { - "name":"Vegetables", - } - } - ] -} - -/* - 1 2 3 4 5 6 7 -12345678901234567890123456789012345678901234567890123456789012345678901234567890 -*/
--- a/Resources/CodeGeneration/test_data/test1_bogus_schema.jsonc Thu May 16 16:45:10 2019 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -{ - "root_name":"test1", - "types": [ - { - "name":"B", - "kind":"struct", - "fields": [ - { - "name":"someAs", - "type":"vector<A>" - }, - { - "name":"someInts", - "type":"vector<int32>" - } - ] - }, - { - "name":"A", - "kiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiind":"struct", - "fields": [ - { - "name":"someStrings", - "type":"vector<string>" - }, - { - "name":"someInts2", - "type":"vector<int32>" - } - ] - }, - { - "name":"MovieType", - "kind":"enum", - "fields": [ - { - "naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame":"Romcom" - }, - { - "name":"Horror" - }, - { - "name":"ScienceFiction" - }, - { - "name":"Vegetables" - } - ] - } - ] -} - -/* - 1 2 3 4 5 6 7 -12345678901234567890123456789012345678901234567890123456789012345678901234567890 -*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CodeGeneration/test_data/testTestStoneCodeGen.yaml Thu May 16 17:51:17 2019 +0200 @@ -0,0 +1,64 @@ +# +# 1 2 3 4 5 6 7 8 +# 345678901234567890123456789012345678901234567890123456789012345678901234567890 +# +rootName: TestStoneCodeGen + +struct B: + __handler: cpp + + someAs: vector<A> + someInts: vector<int32> + +struct C: + __handler: cpp + + someBs: vector<B> + ddd: vector<string> + +struct A: + __handler: cpp + + someStrings: vector<string> + someInts2: vector<int32> + movies: vector<MovieType> + +struct Message1: + __handler: cpp + + memberInt32: int32 + memberString: string + memberEnumMonth: EnumMonth0 + memberBool: bool + memberFloat32: float32 + memberFloat64: float64 + +struct Message2: + __handler: cpp + + memberString: string + memberStringWithDefault: string = "my-default-value" + memberVectorOfMessage1: vector<Message1> + memberVectorOfString: vector<string> + memberMapStringString: map<string, string> + memberMapStringStruct: map<string, Message1> + memberMapEnumFloat: map<CrispType, float32> + memberEnumMovieType: MovieType + memberJson: json + +enum MovieType: + - RomCom + - Horror + - ScienceFiction + - Vegetables + +enum CrispType: + - SaltAndPepper + - CreamAndChives + - Paprika + - Barbecue + +enum EnumMonth0: + - January + - February + - March