# HG changeset patch # User Alain Mazy # Date 1558021877 -7200 # Node ID 342f3e04bfa94d120cd5b4f7cd028b30bd2ad3c7 # Parent 0d42bda615a850cfc5e88c0ab31e4a24f2038b04 CodeGen: test cleanup + all working again + using same yaml and stimuli files diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/README.md --- 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. diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/stonegentool_test.py --- 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"]) 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; - lulu: Map; - - constructor() - { - this.tata = new Array(); - this.tutu = new Array(); - this.titi = new Map(); - this.lulu = new Map(); - } - - 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; - tutu:Array; - titi:Map; - lulu:Map; - movieType:MovieType; + memberString:string; + memberStringWithDefault:string; + memberVectorOfMessage1:Array; + memberVectorOfString:Array; + memberMapStringString:Map; + memberMapStringStruct:Map; + memberMapEnumFloat:Map; + memberEnumMovieType:MovieType; + memberJson:Object; constructor() { - this.toto = new string(); - this.tata = new Array(); - this.tutu = new Array(); - this.titi = new Map(); - this.lulu = new Map(); - this.movieType = new MovieType(); + this.memberString = new string(); + this.memberStringWithDefault = new string(); + this.memberVectorOfMessage1 = new Array(); + this.memberVectorOfString = new Array(); + this.memberMapStringString = new Map(); + this.memberMapStringStruct = new Map(); + this.memberMapEnumFloat = new Map(); + 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') diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/template.in.h.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::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; } diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/testCppHandler/CMakeLists.txt --- 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} ) diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/testCppHandler/main.cpp --- 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 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) diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/testCppHandler/test_data/test_Message2.json --- 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 diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/testWasmIntegrated/CMakeLists.txt --- 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 diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/testWasmIntegrated/build-web.sh --- 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 diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/testWasmIntegrated/testWasmIntegrated.html --- 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 @@
- +
diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/testWasmIntegrated/testWasmIntegrated.ts --- 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 - someInts: vector - -struct C: - someBs: vector - ddd: vector - definition: vector - -struct A: - someStrings: vector - someInts2: vector - movies: vector - -struct Message1: - a: int32 - b: string - c: EnumMonth0 - d: bool - -struct Message2: - toto: string - tata: vector - tutu: vector - titi: map - lulu: map - 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(); -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"; diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/testWasmIntegrated/testWasmIntegratedCpp_api.yaml --- 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 - someInts: vector - -struct C: - someBs: vector - ddd: vector - definition: vector - -struct A: - someStrings: vector - someInts2: vector - movies: vector - -struct Message1: - a: int32 - b: string - c: EnumMonth0 - d: bool - -struct Message2: - toto: string - tata: vector - tutu: vector - titi: map - lulu: map - 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 - - - diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/test_data/test1.jsonc --- 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" - }, - { - "name":"someInts", - "type":"vector" - } - ] - }, - { - "name":"C", - "kind":"struct", - "fields": [ - { - "name":"someBs", - "type":"vector" - }, - { - "name":"ddd", - "type":"vector" - } - ] - }, - { - "name":"A", - "kind":"struct", - "fields": [ - { - "name":"someStrings", - "type":"vector" - }, - { - "name":"someInts2", - "type":"vector" - } - ] - }, - { - "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" - } - ] - } - ] -} diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/test_data/test1.yaml --- 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 - someInts: vector - -struct C: - __handler: cpp - - someBs: vector - ddd: vector - -struct A: - __handler: cpp - - someStrings: vector - someInts2: vector - movies: vector - -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 - tutu: vector - titi: map - lulu: map - movieType: MovieType - -enum MovieType: - - RomCom - - Horror - - ScienceFiction - - Vegetables - -enum CrispType: - - SaltAndPepper - - CreamAndChives - - Paprika - - Barbecue - -enum EnumMonth0: - - January - - February - - March diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/test_data/test1_bogus_json.jsonc --- 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" - }}, - { - "name":"someInts", - "type":"vector" - } - ] - }, - { - "name":"A", - "kind":"struct", - "fields": [ - { - "name":"someStrings", - "type":"vector" - }, - { - "name":"someInts2", - "type":"vector" - } - ] - }, - { - "name":"MovieType", - "kind":"enum", - "fields": [ - { - "name":"Romcom", - }, - { - "name":"Horror", - }, - { - "name":"ScienceFiction", - }, - { - "name":"Vegetables", - } - } - ] -} - -/* - 1 2 3 4 5 6 7 -12345678901234567890123456789012345678901234567890123456789012345678901234567890 -*/ diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/test_data/test1_bogus_schema.jsonc --- 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" - }, - { - "name":"someInts", - "type":"vector" - } - ] - }, - { - "name":"A", - "kiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiind":"struct", - "fields": [ - { - "name":"someStrings", - "type":"vector" - }, - { - "name":"someInts2", - "type":"vector" - } - ] - }, - { - "name":"MovieType", - "kind":"enum", - "fields": [ - { - "naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame":"Romcom" - }, - { - "name":"Horror" - }, - { - "name":"ScienceFiction" - }, - { - "name":"Vegetables" - } - ] - } - ] -} - -/* - 1 2 3 4 5 6 7 -12345678901234567890123456789012345678901234567890123456789012345678901234567890 -*/ diff -r 0d42bda615a8 -r 342f3e04bfa9 Resources/CodeGeneration/test_data/testTestStoneCodeGen.yaml --- /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 + someInts: vector + +struct C: + __handler: cpp + + someBs: vector + ddd: vector + +struct A: + __handler: cpp + + someStrings: vector + someInts2: vector + movies: vector + +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 + memberVectorOfString: vector + memberMapStringString: map + memberMapStringStruct: map + memberMapEnumFloat: map + memberEnumMovieType: MovieType + memberJson: json + +enum MovieType: + - RomCom + - Horror + - ScienceFiction + - Vegetables + +enum CrispType: + - SaltAndPepper + - CreamAndChives + - Paprika + - Barbecue + +enum EnumMonth0: + - January + - February + - March