summaryrefslogtreecommitdiffstats
path: root/wrap-json.test.result
diff options
context:
space:
mode:
authorjobol <jose.bollo@iot.bzh>2018-06-11 14:28:01 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2018-06-13 08:00:00 +0200
commit9a1f7ea8029ff518d81ed7f13000a7c0bddcca5c (patch)
tree71be9d4c10877f9acabffefea4c22315d620d4e3 /wrap-json.test.result
parentc7cd527a8350f736b8013f65db6f5a52b8cb05dd (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
+