diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2010-05-31 16:22:32 +0200 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2010-06-03 17:08:12 +0200 |
commit | ee9e87c6c2b47db85ac27bac2f5939850d7e4849 (patch) | |
tree | 0ba11898d52bdf32a6ee1ebe050ea68b322c9b20 | |
parent | a3fb4753f7d5f4180402332cc9b076a8dd44e676 (diff) | |
download | json-dbus-bridge-ee9e87c6c2b47db85ac27bac2f5939850d7e4849.tar.gz json-dbus-bridge-ee9e87c6c2b47db85ac27bac2f5939850d7e4849.tar.xz |
[tests] more complex tests
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rwxr-xr-x | tests/complex_array_test.sh | 8 | ||||
-rwxr-xr-x | tests/complex_dict_test.sh | 3 | ||||
-rwxr-xr-x | tests/complex_variant_test.sh | 1 | ||||
-rwxr-xr-x | tests/dbus-test-service.py | 6 | ||||
-rw-r--r-- | tests/libtest.sh | 6 |
5 files changed, 21 insertions, 3 deletions
diff --git a/tests/complex_array_test.sh b/tests/complex_array_test.sh index 240674f..b3190cf 100755 --- a/tests/complex_array_test.sh +++ b/tests/complex_array_test.sh @@ -6,5 +6,11 @@ jdb_test_echo EchoArray ai "[ 1, 2, 3, 42, 99, -42 ]" && jdb_test_echo EchoArray ai "[ 1, 2, 3, 42, 99, \"foo\" ]" null "integer value expected." && jdb_test_echo CountArray ai "[ 1, 2, 3, 42, 99, -42 ]" 6 && -jdb_test_echo CountArray ai "[]" 0 +jdb_test_echo CountArray ai "[]" 0 && + +args="42" && +for i in `seq 1 10`; do + args="$args, $i, 1$i, 10$i, 100$i, 1000$i, 2$i, 20$i, 200$i, 2000$i, 3$i, 30$i, 300$i, 3000$i, 4$i, 40$i, 400$i, 4000$i, 5$i, 50$i, 500$i, 5000$i, $args" +done && +jdb_test_echo EchoArray ai "[ $args ]" diff --git a/tests/complex_dict_test.sh b/tests/complex_dict_test.sh index f5af108..c6f4d61 100755 --- a/tests/complex_dict_test.sh +++ b/tests/complex_dict_test.sh @@ -3,5 +3,6 @@ . `dirname $0`/test_setup.sh "com.pengutronix.jdb.Test.Complex" || return jdb_test_echo EchoDict 'a{si}' '{ "a": 1, "b": 2, "ff": 3, "y": 42, "x": 99, "foo": -42 }' && -jdb_test_echo EchoDict 'a{si}' '{ "a": 1, "b": "2" }' null "integer value expected." +jdb_test_echo EchoDict 'a{si}' '{ "a": 1, "b": "2" }' null "integer value expected." && +jdb_test_echo DictKeys 'a{si}' '{ "a": 1, "b": 2, "c": 55 }' '[ "a", "b", "c" ]' diff --git a/tests/complex_variant_test.sh b/tests/complex_variant_test.sh index 8e0c81b..ecb9166 100755 --- a/tests/complex_variant_test.sh +++ b/tests/complex_variant_test.sh @@ -11,4 +11,5 @@ jdb_test_echo EchoVariant v '[ "si", "foo", 33 ]' null "invalid variant signatur jdb_test_echo EchoVariant v '[ "as", [ "42", "foobar"] ]' '[ "42", "foobar" ]' && jdb_test_echo EchoVariantArray av '[ [ "i", 42 ], ["s", "foobar"] ]' '[ 42, "foobar" ]' +jdb_test_echo EchoVariantArray av '[["i", 42], ["v", ["s", "foobar"]]]' '[ 42, "foobar" ]' diff --git a/tests/dbus-test-service.py b/tests/dbus-test-service.py index 650a1c4..54a3e47 100755 --- a/tests/dbus-test-service.py +++ b/tests/dbus-test-service.py @@ -109,6 +109,12 @@ class Service(dbus.service.Object): def EchoDict(self, val): return val; + @dbus.service.method("com.pengutronix.jdb.Test.Complex", + in_signature='a{si}', out_signature='as') + def DictKeys(self, val): + keys = val.keys() + keys.sort() + return keys if __name__ == '__main__': dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) diff --git a/tests/libtest.sh b/tests/libtest.sh index 4b659f4..11fc34e 100644 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -78,7 +78,11 @@ jdb_test() { local expect="{ \"id\": $id, \"error\": $error, \"result\": $response }" if [ "$JDB_TEST_VERBOSE" = "yes" ]; then - echo -n "$method($params)" + if [ ${#params} -gt 50 ]; then + echo -n "$method(..[${#params}]..)" + else + echo -n "$method($params)" + fi fi local result result=`jdb_call "$data"` |