changeset 686:0d42bda615a8 am-dev

fix codegen tests
author Alain Mazy <alain@mazy.be>
date Thu, 16 May 2019 16:45:10 +0200
parents e8b83fe55a33
children 342f3e04bfa9
files Resources/CodeGeneration/stonegentool_test.py Resources/CodeGeneration/testCppHandler/README.md Resources/CodeGeneration/testCppHandler/test_data/test_Message2.json Resources/CodeGeneration/test_data/test1.yaml
diffstat 4 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/Resources/CodeGeneration/stonegentool_test.py	Thu May 16 15:04:41 2019 +0200
+++ b/Resources/CodeGeneration/stonegentool_test.py	Thu May 16 16:45:10 2019 +0200
@@ -208,6 +208,9 @@
     b: string;
     c: EnumMonth0;
     d: boolean;
+    e: number;
+    f: number;
+
     public StoneSerialize(): string {
       let container: object = {};
       container['type'] = 'VsolStuff.Message1';
@@ -335,12 +338,16 @@
     b:string;
     c:EnumMonth0;
     d:boolean;
+    e:number;
+    f: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();
     }
 
     public StoneSerialize(): string {
--- a/Resources/CodeGeneration/testCppHandler/README.md	Thu May 16 15:04:41 2019 +0200
+++ b/Resources/CodeGeneration/testCppHandler/README.md	Thu May 16 16:45:10 2019 +0200
@@ -25,8 +25,10 @@
 - `cmake -G "Visual Studio 15 2017 Win64" ..`  (modify for your current Visual Studio version)
 - `cmake --build . --config Debug` or - `cmake --build . --config Release`
 
+How to execute the test
+=======================
+- `cd test_data && testCppHandler --pattern=*.json`
 
 
 
 
-
--- a/Resources/CodeGeneration/testCppHandler/test_data/test_Message2.json	Thu May 16 15:04:41 2019 +0200
+++ b/Resources/CodeGeneration/testCppHandler/test_data/test_Message2.json	Thu May 16 16:45:10 2019 +0200
@@ -5,13 +5,15 @@
       {
         "a": 42,
         "b": "Benjamin",
-        "c": 0,
-        "d": false
+        "c": "January",
+        "d": false,
+        "e": 0.1,
+        "f": -0.2
       },
       {
         "a": 43,
         "b": "Sandrine",
-        "c": 2
+        "c": "March"
       }
     ],
     "tutu": [
@@ -26,12 +28,12 @@
       "54": {
         "a": 43,
         "b": "Sandrine",
-        "c": 2
+        "c": "March"
       },
       "55": {
         "a": 42,
         "b": "Benjamin",
-        "c": 0,
+        "c": "January",
         "d": false
       }
     },
--- a/Resources/CodeGeneration/test_data/test1.yaml	Thu May 16 15:04:41 2019 +0200
+++ b/Resources/CodeGeneration/test_data/test1.yaml	Thu May 16 16:45:10 2019 +0200
@@ -5,25 +5,37 @@
 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>