summaryrefslogtreecommitdiffstats
path: root/test/data
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2003-04-08 15:52:51 +0000
committerAlexander Larsson <alexl@redhat.com>2003-04-08 15:52:51 +0000
commitc5020ac870c5990a36c3576453cc23431213e8bf (patch)
tree8b5c4c5b884e9481d1ce17b9a24d9c1bbe094428 /test/data
parenta162febe6746269f51b3a16db5f6fb240001f828 (diff)
2003-04-08 Alexander Larsson <alexl@redhat.com>
Implemented recursive types, named types and new-style iters * bus/driver.c: * glib/test-thread-client.c: (thread_func): * glib/test-thread-server.c: (handle_test_message): * test/test-service.c: (handle_echo): Update to new api * dbus/Makefile.am: * dbus/dbus-dict.c: * dbus/dbus-dict.h: * dbus/dbus.h Remove DBusDict * dbus/dbus-internals.c: (_dbus_type_to_string): Update for new types. * dbus/dbus-marshal.[ch]: Implement recursive types and the new marshalling format. Remove hardcoded dict marshalling. Marshal named types. * dbus/dbus-message-builder.c: Add BYTE_ARRAY. Remove references to old types * dbus/dbus-message.[ch]: New non-refcounted iter API that supports recursive iters. Use iters for appending, including support for recursive iters. Add byte and named type support. Update everything to new marshalling formats. Add tests for new API. * dbus/dbus-protocol.h: Remove old array types. Add types: BYTE, ARRAY, DICT, NAMED * dbus/dbus-string.c: * dbus/dbus-sysdeps.c: Make parse_double locale safe. * dbus/dbus-test-main.c: Call setlocale. * dbus/dbus-test.c: Kill dict test * doc/dbus-specification.sgml: Update spec * test/data/incomplete-messages/missing-body.message: * test/data/invalid-messages/bad-boolean.message: * test/data/invalid-messages/bad-boolean-array.message: * test/data/invalid-messages/boolean-array-length-too-long.message-raw: * test/data/invalid-messages/boolean-has-no-value.message-raw: * test/data/invalid-messages/too-short-dict.message: * test/data/valid-messages/dict-simple.message: * test/data/valid-messages/dict.message: * test/data/valid-messages/emptiness.message: * test/data/valid-messages/lots-of-arguments.message: * test/data/valid-messages/no-padding.message: * test/data/valid-messages/recursive-types.message: Add missing NAME fields Fix up dicts & arrays * test/data/invalid-messages/dict-with-nil-value.message: Removed, this is not invalid anymore. * test/data/valid-messages/recursive-types.message: Add new test for deeply recursive types.
Diffstat (limited to 'test/data')
-rw-r--r--test/data/incomplete-messages/missing-body.message4
-rw-r--r--test/data/invalid-messages/bad-boolean-array.message6
-rw-r--r--test/data/invalid-messages/bad-boolean.message3
-rw-r--r--test/data/invalid-messages/boolean-array-length-too-long.message-rawbin27 -> 27 bytes
-rw-r--r--test/data/invalid-messages/boolean-has-no-value.message-rawbin102 -> 102 bytes
-rw-r--r--test/data/invalid-messages/dict-with-nil-value.message12
-rw-r--r--test/data/invalid-messages/too-short-dict.message6
-rw-r--r--test/data/valid-messages/dict-simple.message5
-rw-r--r--test/data/valid-messages/dict.message29
-rw-r--r--test/data/valid-messages/emptiness.message47
-rw-r--r--test/data/valid-messages/lots-of-arguments.message48
-rw-r--r--test/data/valid-messages/no-padding.message3
-rw-r--r--test/data/valid-messages/recursive-types.message65
13 files changed, 188 insertions, 40 deletions
diff --git a/test/data/incomplete-messages/missing-body.message b/test/data/incomplete-messages/missing-body.message
index c97ef7a3..71ac5abc 100644
--- a/test/data/incomplete-messages/missing-body.message
+++ b/test/data/incomplete-messages/missing-body.message
@@ -1,7 +1,11 @@
## message that's missing an expected body
VALID_HEADER
+FIELD_NAME name
+TYPE STRING
+STRING 'org.freedesktop.Foo'
END_LENGTH Header
+ALIGN 8
## create the body, then chop it off
START_LENGTH Body
diff --git a/test/data/invalid-messages/bad-boolean-array.message b/test/data/invalid-messages/bad-boolean-array.message
index 54b31d6c..c045b978 100644
--- a/test/data/invalid-messages/bad-boolean-array.message
+++ b/test/data/invalid-messages/bad-boolean-array.message
@@ -2,10 +2,14 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER
+FIELD_NAME name
+TYPE STRING
+STRING 'org.freedesktop.Foo'
ALIGN 8
END_LENGTH Header
START_LENGTH Body
-TYPE BOOLEAN_ARRAY
+TYPE ARRAY
+TYPE BOOLEAN
ALIGN 4
INT32 3
BYTE 0
diff --git a/test/data/invalid-messages/bad-boolean.message b/test/data/invalid-messages/bad-boolean.message
index 0755ab5e..00a29626 100644
--- a/test/data/invalid-messages/bad-boolean.message
+++ b/test/data/invalid-messages/bad-boolean.message
@@ -2,6 +2,9 @@
## VALID_HEADER includes a LENGTH Header and LENGTH Body
VALID_HEADER
+FIELD_NAME name
+TYPE STRING
+STRING 'org.freedesktop.Foo'
ALIGN 8
END_LENGTH Header
START_LENGTH Body
diff --git a/test/data/invalid-messages/boolean-array-length-too-long.message-raw b/test/data/invalid-messages/boolean-array-length-too-long.message-raw
index 2326ec9d..07d4b341 100644
--- a/test/data/invalid-messages/boolean-array-length-too-long.message-raw
+++ b/test/data/invalid-messages/boolean-array-length-too-long.message-raw
Binary files differ
diff --git a/test/data/invalid-messages/boolean-has-no-value.message-raw b/test/data/invalid-messages/boolean-has-no-value.message-raw
index cba9e839..11b15c86 100644
--- a/test/data/invalid-messages/boolean-has-no-value.message-raw
+++ b/test/data/invalid-messages/boolean-has-no-value.message-raw
Binary files differ
diff --git a/test/data/invalid-messages/dict-with-nil-value.message b/test/data/invalid-messages/dict-with-nil-value.message
deleted file mode 100644
index 8f899605..00000000
--- a/test/data/invalid-messages/dict-with-nil-value.message
+++ /dev/null
@@ -1,12 +0,0 @@
-# Message with lots of different argument types
-
-VALID_HEADER
-END_LENGTH Header
-ALIGN 8
-START_LENGTH Body
-TYPE DICT
-STRING_ARRAY { 'nil', 'uint32' }
-TYPE NIL
-TYPE UINT32
-UINT32 0x8765432
-END_LENGTH Body
diff --git a/test/data/invalid-messages/too-short-dict.message b/test/data/invalid-messages/too-short-dict.message
index 6df40b33..14722023 100644
--- a/test/data/invalid-messages/too-short-dict.message
+++ b/test/data/invalid-messages/too-short-dict.message
@@ -1,11 +1,15 @@
# Message with lots of different argument types
VALID_HEADER
+FIELD_NAME name
+TYPE STRING
+STRING 'org.freedesktop.Foo'
END_LENGTH Header
ALIGN 8
START_LENGTH Body
TYPE DICT
-STRING_ARRAY { 'int32', 'uint32' }
+STRING 'uint32'
TYPE UINT32
UINT32 0x8765432
+STRING 'uint32'
END_LENGTH Body
diff --git a/test/data/valid-messages/dict-simple.message b/test/data/valid-messages/dict-simple.message
index 0de1a782..34fb47d9 100644
--- a/test/data/valid-messages/dict-simple.message
+++ b/test/data/valid-messages/dict-simple.message
@@ -8,7 +8,10 @@ END_LENGTH Header
ALIGN 8
START_LENGTH Body
TYPE DICT
-STRING_ARRAY { 'int32' }
+LENGTH Dict
+START_LENGTH Dict
+STRING 'int32'
TYPE INT32
INT32 0x12345678
+END_LENGTH Dict
END_LENGTH Body
diff --git a/test/data/valid-messages/dict.message b/test/data/valid-messages/dict.message
index ce99a282..6b9d004e 100644
--- a/test/data/valid-messages/dict.message
+++ b/test/data/valid-messages/dict.message
@@ -8,25 +8,42 @@ ALIGN 8
END_LENGTH Header
START_LENGTH Body
TYPE DICT
-STRING_ARRAY { 'boolean', 'int32', 'uint32', 'double', 'string', 'boolean_array', 'int32_array', 'uint32_array', 'double_array', 'string_array' }
+LENGTH Dict
+START_LENGTH Dict
+STRING 'boolean'
TYPE BOOLEAN
BYTE 1
+STRING 'int32'
TYPE INT32
INT32 0x12345678
+STRING 'uint32'
TYPE UINT32
UINT32 0x8765432
+STRING 'double'
TYPE DOUBLE
DOUBLE 3.141592653589
+STRING 'string'
TYPE STRING
STRING 'This is a string'
-TYPE BOOLEAN_ARRAY
+STRING 'boolean_array'
+TYPE ARRAY
+TYPE BOOLEAN
BOOLEAN_ARRAY { true, false, false, true, false }
-TYPE INT32_ARRAY
+STRING 'int32_array'
+TYPE ARRAY
+TYPE INT32
INT32_ARRAY { 1, -2, 3, -4, 5, -6, 7, -8, 9, -10 }
-TYPE UINT32_ARRAY
+STRING 'uint32_array'
+TYPE ARRAY
+TYPE UINT32
UINT32_ARRAY { 11, 12, 314, 1911, 57692, 1237, 2834 }
-TYPE DOUBLE_ARRAY
+STRING 'double_array'
+TYPE ARRAY
+TYPE DOUBLE
DOUBLE_ARRAY { 0.1, 0.2, 3.1415926, 2.7183, 10.0, 9.99 }
-TYPE STRING_ARRAY
+STRING 'string_array'
+TYPE ARRAY
+TYPE STRING
STRING_ARRAY { 'Hello', 'This', 'Is', 'A', 'String', 'Array!' }
+END_LENGTH Dict
END_LENGTH Body
diff --git a/test/data/valid-messages/emptiness.message b/test/data/valid-messages/emptiness.message
index 36f3fc3d..87196b16 100644
--- a/test/data/valid-messages/emptiness.message
+++ b/test/data/valid-messages/emptiness.message
@@ -10,35 +10,56 @@ START_LENGTH Body
TYPE STRING
INT32 0
BYTE 0 # Strings need to be NULL-terminated
-TYPE BOOLEAN_ARRAY
+TYPE ARRAY
+TYPE BOOLEAN
INT32 0
-TYPE INT32_ARRAY
+TYPE ARRAY
+TYPE INT32
INT32 0
-TYPE UINT32_ARRAY
+TYPE ARRAY
+TYPE UINT32
INT32 0
-TYPE DOUBLE_ARRAY
+TYPE ARRAY
+TYPE DOUBLE
INT32 0
-TYPE BYTE_ARRAY
+TYPE ARRAY
+TYPE BYTE
INT32 0
-TYPE STRING_ARRAY
+TYPE ARRAY
+TYPE STRING
INT32 0
TYPE DICT
INT32 0
# A dict with empty arrays
TYPE DICT
-STRING_ARRAY {'boolean_array', 'int32_array' , 'uint32_array', 'double_array', 'byte_array', 'string_array' }
-TYPE BOOLEAN_ARRAY
+LENGTH Dict
+START_LENGTH Dict
+STRING 'boolean_array'
+TYPE ARRAY
+TYPE BOOLEAN
INT32 0
-TYPE INT32_ARRAY
+STRING 'int32_array'
+TYPE ARRAY
+TYPE INT32
INT32 0
-TYPE UINT32_ARRAY
+STRING 'uint32_array'
+TYPE ARRAY
+TYPE UINT32
INT32 0
-TYPE DOUBLE_ARRAY
+STRING 'double_array'
+TYPE ARRAY
+TYPE DOUBLE
INT32 0
-TYPE BYTE_ARRAY
+STRING 'byte_array'
+TYPE ARRAY
+TYPE BYTE
INT32 0
-TYPE STRING_ARRAY
+STRING 'string_array' }
+TYPE ARRAY
+TYPE STRING
INT32 0
+END_LENGTH Dict
+
END_LENGTH Body
diff --git a/test/data/valid-messages/lots-of-arguments.message b/test/data/valid-messages/lots-of-arguments.message
index cc9c5a75..6549646e 100644
--- a/test/data/valid-messages/lots-of-arguments.message
+++ b/test/data/valid-messages/lots-of-arguments.message
@@ -8,6 +8,8 @@ END_LENGTH Header
ALIGN 8
START_LENGTH Body
TYPE NIL
+TYPE BYTE
+BYTE 42
TYPE INT32
INT32 0x12345678
TYPE UINT32
@@ -16,14 +18,50 @@ TYPE DOUBLE
DOUBLE 3.141592653589
TYPE STRING
STRING 'This is a string'
-TYPE BOOLEAN_ARRAY
+TYPE ARRAY
+TYPE BOOLEAN
BOOLEAN_ARRAY { true, false, false, true, false }
-TYPE INT32_ARRAY
+TYPE ARRAY
+TYPE INT32
INT32_ARRAY { 1, -2, 3, -4, 5, -6, 7, -8, 9, -10 }
-TYPE UINT32_ARRAY
+TYPE ARRAY
+TYPE UINT32
UINT32_ARRAY { 11, 12, 314, 1911, 57692, 1237, 2834 }
-TYPE DOUBLE_ARRAY
+TYPE ARRAY
+TYPE DOUBLE
DOUBLE_ARRAY { 0.1, 0.2, 3.1415926, 2.7183, 10.0, 9.99 }
-TYPE STRING_ARRAY
+TYPE ARRAY
+TYPE STRING
STRING_ARRAY { 'Hello', 'This', 'Is', 'A', 'String', 'Array!' }
+TYPE NAMED
+STRING 'named type'
+BYTE_ARRAY { 'b', 'i', 'n', 'a', 'r', 'y', 'd', 'a', 't', 'a' }
+
+TYPE ARRAY
+TYPE DICT
+LENGTH Array
+START_LENGTH Array
+
+LENGTH Dict1
+START_LENGTH Dict1
+STRING 'key1'
+TYPE INT32
+INT32 0x12345678
+STRING 'key2'
+TYPE UINT32
+UINT32 0x8765432
+END_LENGTH Dict1
+
+LENGTH Dict2
+START_LENGTH Dict2
+STRING 'key1'
+TYPE INT32
+INT32 0x12345678
+STRING 'key2'
+TYPE UINT32
+UINT32 0x8765432
+END_LENGTH Dict2
+
+END_LENGTH Array
+
END_LENGTH Body
diff --git a/test/data/valid-messages/no-padding.message b/test/data/valid-messages/no-padding.message
index ab5b5a80..b47dca78 100644
--- a/test/data/valid-messages/no-padding.message
+++ b/test/data/valid-messages/no-padding.message
@@ -10,7 +10,8 @@ STRING 'org.freedesktop.Foo'
## this byte array is filled with zeros to the natural length
## of the header
FIELD_NAME unkn
-TYPE BYTE_ARRAY
+TYPE ARRAY
+TYPE BYTE
ALIGN 4
LENGTH ThisByteArray
START_LENGTH ThisByteArray
diff --git a/test/data/valid-messages/recursive-types.message b/test/data/valid-messages/recursive-types.message
new file mode 100644
index 00000000..b7608041
--- /dev/null
+++ b/test/data/valid-messages/recursive-types.message
@@ -0,0 +1,65 @@
+## Message with recursive types
+
+## VALID_HEADER includes a LENGTH Header and LENGTH Body
+VALID_HEADER
+
+FIELD_NAME name
+TYPE STRING
+STRING 'org.freedesktop.Foo'
+
+END_LENGTH Header
+START_LENGTH Body
+
+TYPE ARRAY
+TYPE ARRAY
+LENGTH Array1
+START_LENGTH Array1
+
+
+TYPE UINT32
+UINT32_ARRAY { 1, 2, 3, 4, 5}
+
+
+TYPE STRING
+STRING_ARRAY { 'a', 'string', 'array'}
+
+
+TYPE DICT
+LENGTH Array2
+START_LENGTH Array2
+
+LENGTH Dict1
+START_LENGTH Dict1
+STRING 'uint32'
+TYPE UINT32
+UINT32 1234
+STRING uint32'
+TYPE INT32
+INT32 1234
+END_LENGTH Dict1
+
+LENGTH Dict2
+START_LENGTH Dict2
+
+STRING 'dict'
+TYPE DICT
+LENGTH Dict3
+START_LENGTH Dict3
+STRING 'double-array'
+TYPE ARRAY
+TYPE DOUBLE
+DOUBLE_ARRAY {1.0, 2.0, 3.0}
+STRING 'boolean'
+TYPE BOOLEAN
+BOOLEAN false
+END_LENGTH Dict3
+
+END_LENGTH Dict2
+
+END_LENGTH Array2
+
+
+END_LENGTH Array1
+
+
+END_LENGTH Body