summaryrefslogtreecommitdiffstats
path: root/wrap-json.test.result
diff options
context:
space:
mode:
authorjobol <jose.bollo@iot.bzh>2018-06-11 14:28:01 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 14:12:02 +0100
commit0f7c627d2db92fd0a83fd19131dbb496fc4194c6 (patch)
tree71be9d4c10877f9acabffefea4c22315d620d4e3 /wrap-json.test.result
parent91866ef916e1371413038013d5780eac3c6254bf (diff)
wrap-json: new helper functions for comparison
The new functions are - wrap_json_clone_depth: clone with defined depth - wrap_json_sort: sort an array accordingly to wrap_json_cmp - wrap_json_keys: compute the array of sorted keys - wrap_json_cmp: compare 2 items - wrap_json_equal: test equallity - wrap_json_contains: test inclusion Change-Id: I9787bff6c262fa2702c27802d771e2d487ce6309 Signed-off-by: jose bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'wrap-json.test.result')
-rw-r--r--wrap-json.test.result90
1 files changed, 90 insertions, 0 deletions
diff --git a/wrap-json.test.result b/wrap-json.test.result
index 0edaf75..899059b 100644
--- a/wrap-json.test.result
+++ b/wrap-json.test.result
@@ -409,3 +409,93 @@ unpack("{\"foo\":\"\"}", "{s?y}", "foo", &xy[0], &xz[0])
unpack("{}", "{s?y}", "foo", &xy[0], &xz[0])
SUCCESS s:foo y/0:
+compare(null)(null)
+ -> 0 / 1
+
+compare(true)(true)
+ -> 0 / 1
+
+compare(false)(false)
+ -> 0 / 1
+
+compare(1)(1)
+ -> 0 / 1
+
+compare(1.0)(1.0)
+ -> 0 / 1
+
+compare("")("")
+ -> 0 / 1
+
+compare("hi")("hi")
+ -> 0 / 1
+
+compare({})({})
+ -> 0 / 1
+
+compare({"a":true,"b":false})({"b":false,"a":true})
+ -> 0 / 1
+
+compare([])([])
+ -> 0 / 1
+
+compare([1,true,null])([1,true,null])
+ -> 0 / 1
+
+compare(null)(true)
+ -> -1 / 0
+
+compare(null)(false)
+ -> -1 / 0
+
+compare(0)(1)
+ -> -1 / 0
+
+compare(1)(0)
+ -> 1 / 0
+
+compare(0)(true)
+ -> 2 / 0
+
+compare(0)(false)
+ -> 2 / 0
+
+compare(0)(null)
+ -> 3 / 0
+
+compare("hi")("hello")
+ -> 4 / 0
+
+compare("hello")("hi")
+ -> -4 / 0
+
+compare({})(null)
+ -> 4 / 0
+
+compare({})(true)
+ -> 3 / 0
+
+compare({})(1)
+ -> 1 / 0
+
+compare({})(1.0)
+ -> 2 / 0
+
+compare({})([])
+ -> -1 / 0
+
+compare({})("x")
+ -> -2 / 0
+
+compare([1,true,null])([1,true])
+ -> 1 / 1
+
+compare({"a":true,"b":false})({"a":true})
+ -> 1 / 1
+
+compare({"a":true,"b":false})({"a":true,"c":false})
+ -> -1 / 0
+
+compare({"a":true,"c":false})({"a":true,"b":false})
+ -> 1 / 0
+