[Spice-devel] [PATCH v4 31/41] dissector: Test decorated array

Frediano Ziglio fziglio at redhat.com
Thu Jul 23 08:54:48 PDT 2015


Try to test possible combinations of different attributes
with arrays to make sure output is what is expected.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 codegen/out_array_primitive.txt | 109 +++++++++++++++++++++++++++++----
 codegen/out_array_raw.txt       |  12 +++-
 codegen/out_array_struct.txt    | 129 ++++++++++++++++++++++++++++++++++++++--
 codegen/test.proto              |  15 ++++-
 4 files changed, 245 insertions(+), 20 deletions(-)

diff --git a/codegen/out_array_primitive.txt b/codegen/out_array_primitive.txt
index 3a77f37..c621bda 100644
--- a/codegen/out_array_primitive.txt
+++ b/codegen/out_array_primitive.txt
@@ -1,25 +1,110 @@
 --- tree
     --- item
-    Text: 0 (0)
-    Name: array
-    Abbrev: spice2.auto.ArrayPrimitive_array_array
+    Text: test text
+    Name: test desc
+    Abbrev: spice2.name5
+        --- tree
+            --- item
+            Text: 0 (0)
+            Name: array1
+            Abbrev: spice2.auto.ArrayPrimitive_array_array1
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: 1 (0x1)
+            Name: array1
+            Abbrev: spice2.auto.ArrayPrimitive_array_array1
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: 2 (0x2)
+            Name: array1
+            Abbrev: spice2.auto.ArrayPrimitive_array_array1
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: 3 (0x3)
+            Name: array1
+            Abbrev: spice2.auto.ArrayPrimitive_array_array1
+            Type: FT_UINT16
+            Base: BASE_DEC
+    --- item
+    Text: 
+    Name: test desc
+    Abbrev: spice2.name6
+        --- tree
+            --- item
+            Text: 4 (0x4)
+            Name: array2
+            Abbrev: spice2.auto.ArrayPrimitive_array_array2
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: 5 (0x5)
+            Name: array2
+            Abbrev: spice2.auto.ArrayPrimitive_array_array2
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: 6 (0x6)
+            Name: array2
+            Abbrev: spice2.auto.ArrayPrimitive_array_array2
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: 7 (0x7)
+            Name: array2
+            Abbrev: spice2.auto.ArrayPrimitive_array_array2
+            Type: FT_UINT16
+            Base: BASE_DEC
+    --- item
+    Text: test text
+        --- tree
+            --- item
+            Text: 8 (0x8)
+            Name: array3
+            Abbrev: spice2.auto.ArrayPrimitive_array_array3
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: 9 (0x9)
+            Name: array3
+            Abbrev: spice2.auto.ArrayPrimitive_array_array3
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: 10 (0xa)
+            Name: array3
+            Abbrev: spice2.auto.ArrayPrimitive_array_array3
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: 11 (0xb)
+            Name: array3
+            Abbrev: spice2.auto.ArrayPrimitive_array_array3
+            Type: FT_UINT16
+            Base: BASE_DEC
+    --- item
+    Text: 12 (0xc)
+    Name: array4
+    Abbrev: spice2.auto.ArrayPrimitive_array_array4
     Type: FT_UINT16
     Base: BASE_DEC
     --- item
-    Text: 1 (0x1)
-    Name: array
-    Abbrev: spice2.auto.ArrayPrimitive_array_array
+    Text: 13 (0xd)
+    Name: array4
+    Abbrev: spice2.auto.ArrayPrimitive_array_array4
     Type: FT_UINT16
     Base: BASE_DEC
     --- item
-    Text: 2 (0x2)
-    Name: array
-    Abbrev: spice2.auto.ArrayPrimitive_array_array
+    Text: 14 (0xe)
+    Name: array4
+    Abbrev: spice2.auto.ArrayPrimitive_array_array4
     Type: FT_UINT16
     Base: BASE_DEC
     --- item
-    Text: 3 (0x3)
-    Name: array
-    Abbrev: spice2.auto.ArrayPrimitive_array_array
+    Text: 15 (0xf)
+    Name: array4
+    Abbrev: spice2.auto.ArrayPrimitive_array_array4
     Type: FT_UINT16
     Base: BASE_DEC
diff --git a/codegen/out_array_raw.txt b/codegen/out_array_raw.txt
index 31b510c..68a16cd 100644
--- a/codegen/out_array_raw.txt
+++ b/codegen/out_array_raw.txt
@@ -1,3 +1,13 @@
 --- tree
     --- item
-    Text: array
+    Text: test text
+    Name: test desc
+    Abbrev: spice2.name1
+    --- item
+    Text: 
+    Name: test desc
+    Abbrev: spice2.name2
+    --- item
+    Text: test text
+    --- item
+    Text: array4
diff --git a/codegen/out_array_struct.txt b/codegen/out_array_struct.txt
index 53d28ef..7da1cc7 100644
--- a/codegen/out_array_struct.txt
+++ b/codegen/out_array_struct.txt
@@ -1,9 +1,130 @@
 --- tree
     --- item
+    Text: test text
+    Name: test desc
+    Abbrev: spice2.name5
+        --- tree
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 0 (0)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 1 (0x1)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 2 (0x2)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 3 (0x3)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+    --- item
+    Text: 
+    Name: test desc
+    Abbrev: spice2.name6
+        --- tree
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 4 (0x4)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 5 (0x5)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 6 (0x6)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 7 (0x7)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+    --- item
+    Text: test text
+        --- tree
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 8 (0x8)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 9 (0x9)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 10 (0xa)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+            --- item
+            Text: Dummy
+                --- tree
+                    --- item
+                    Text: 11 (0xb)
+                    Name: dummy
+                    Abbrev: spice2.auto.Dummy_dummy
+                    Type: FT_UINT16
+                    Base: BASE_DEC
+    --- item
     Text: Dummy
         --- tree
             --- item
-            Text: 0 (0)
+            Text: 12 (0xc)
             Name: dummy
             Abbrev: spice2.auto.Dummy_dummy
             Type: FT_UINT16
@@ -12,7 +133,7 @@
     Text: Dummy
         --- tree
             --- item
-            Text: 1 (0x1)
+            Text: 13 (0xd)
             Name: dummy
             Abbrev: spice2.auto.Dummy_dummy
             Type: FT_UINT16
@@ -21,7 +142,7 @@
     Text: Dummy
         --- tree
             --- item
-            Text: 2 (0x2)
+            Text: 14 (0xe)
             Name: dummy
             Abbrev: spice2.auto.Dummy_dummy
             Type: FT_UINT16
@@ -30,7 +151,7 @@
     Text: Dummy
         --- tree
             --- item
-            Text: 3 (0x3)
+            Text: 15 (0xf)
             Name: dummy
             Abbrev: spice2.auto.Dummy_dummy
             Type: FT_UINT16
diff --git a/codegen/test.proto b/codegen/test.proto
index 6d97317..4eaa858 100644
--- a/codegen/test.proto
+++ b/codegen/test.proto
@@ -39,15 +39,24 @@ struct Dummy {
 };
 
 message ArrayRaw {
-    uint8 array[4];
+    uint8 array1[4] @ws("test desc", name1) @ws_txt("test text");
+    uint8 array2[4] @ws("test desc", name2);
+    uint8 array3[4] @ws_txt("test text");
+    uint8 array4[4];
 };
 
 message ArrayPrimitive {
-    uint16 array[4];
+    uint16 array1[4] @ws("test desc", name5) @ws_txt("test text");
+    uint16 array2[4] @ws("test desc", name6);
+    uint16 array3[4] @ws_txt("test text");
+    uint16 array4[4];
 };
 
 message ArrayStruct {
-    Dummy array[4];
+    Dummy array1[4] @ws("test desc", name5) @ws_txt("test text");
+    Dummy array2[4] @ws("test desc", name6);
+    Dummy array3[4] @ws_txt("test text");
+    Dummy array4[4];
 };
 
 channel BaseChannel {
-- 
2.1.0



More information about the Spice-devel mailing list