Skip to content

Commit

Permalink
tests: simplify testsuite output to make diffs more readable..
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-n committed Nov 13, 2019
1 parent 8967e1e commit f085ad2
Show file tree
Hide file tree
Showing 2 changed files with 174 additions and 89 deletions.
11 changes: 5 additions & 6 deletions test/test.ml
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,16 @@ let run () =
let diag = Simple.to_diagnostic cbor in
match test.result with
| Diagnostic s when s = diag ->
report true @@ Printf.sprintf "expected and got %s" s
report true @@ s
| Diagnostic s ->
report false @@ Printf.sprintf "expected %s, got %s" s diag
report false @@ diag
| Decoded json ->
let json' = json_of_cbor cbor in
if json = json' then
report true @@ Printf.sprintf "expected and got %s"
(Yojson.Basic.to_string json)
report true @@ Yojson.Basic.to_string json
else
report false @@ Printf.sprintf "expected %s, got %s, aka %s"
(Yojson.Basic.to_string json) (Yojson.Basic.to_string json') diag
report false @@ Printf.sprintf "%s, aka %s"
(Yojson.Basic.to_string json') diag
in
try test () with exn -> report false @@ Printexc.to_string exn
) (0, 0, 0)
Expand Down
252 changes: 169 additions & 83 deletions test/tests.expected
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
I: running int tests from appendix_a.json, extra.json
I: total int tests = 83
<<<<<<< HEAD
I: int test 0: expected and got 0
I: int test 1: expected and got 1
I: int test 2: expected and got 10
Expand Down Expand Up @@ -83,90 +84,175 @@ I: int test 79: expected and got {"a":1,"b":[2,3]}
I: int test 80: expected and got ["a",{"b":"c"}]
I: int test 81: expected and got {"Fun":true,"Amt":-2}
W: int test 82: CBOR.Error("out-of-range: 9223372036854775807")
=======
I: int test 0: 0
I: int test 1: 1
I: int test 2: 10
I: int test 3: 23
I: int test 4: 24
I: int test 5: 25
I: int test 6: 100
I: int test 7: 1000
I: int test 8: 1000000
I: int test 9: 1000000000000
I: int test 10: "18446744073709551615"
I: int test 11: "18446744073709551616"
I: int test 12: "-18446744073709551616"
I: int test 13: "-18446744073709551617"
I: int test 14: -1
I: int test 15: -10
I: int test 16: -100
I: int test 17: -1000
I: int test 18: 0.0
I: int test 19: -0.0
I: int test 20: 1.0
I: int test 21: 1.1
I: int test 22: 1.5
I: int test 23: 65504.0
I: int test 24: 100000.0
I: int test 25: 3.4028234663852886e+38
I: int test 26: 1e+300
I: int test 27: 5.9604644775390625e-08
I: int test 28: 6.103515625e-05
I: int test 29: -4.0
I: int test 30: -4.1
I: int test 31: Infinity
I: int test 32: NaN
I: int test 33: -Infinity
I: int test 34: Infinity
I: int test 35: NaN
I: int test 36: -Infinity
I: int test 37: Infinity
I: int test 38: NaN
I: int test 39: -Infinity
I: int test 40: false
I: int test 41: true
I: int test 42: null
I: int test 43: undefined
I: int test 44: simple(16)
I: int test 45: simple(24)
I: int test 46: simple(255)
I: int test 47: 0("2013-03-21T20:04:00Z")
I: int test 48: 1(1363896240)
I: int test 49: 1(1363896240.5)
I: int test 50: 23(h'01020304')
I: int test 51: 24(h'6449455446')
I: int test 52: 32("http://www.example.com")
I: int test 53: h''
I: int test 54: h'01020304'
I: int test 55: ""
I: int test 56: "a"
I: int test 57: "IETF"
I: int test 58: "\"\\"
I: int test 59: "ü"
I: int test 60: "水"
I: int test 61: "𐅑"
I: int test 62: []
I: int test 63: [1,2,3]
I: int test 64: [1,[2,3],[4,5]]
I: int test 65: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
I: int test 66: {}
I: int test 67: {1: 2, 3: 4}
I: int test 68: {"a":1,"b":[2,3]}
I: int test 69: ["a",{"b":"c"}]
I: int test 70: {"a":"A","b":"B","c":"C","d":"D","e":"E"}
I: int test 71: (_ h'0102', h'030405')
I: int test 72: "streaming"
I: int test 73: []
I: int test 74: [1,[2,3],[4,5]]
I: int test 75: [1,[2,3],[4,5]]
I: int test 76: [1,[2,3],[4,5]]
I: int test 77: [1,[2,3],[4,5]]
I: int test 78: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
I: int test 79: {"a":1,"b":[2,3]}
I: int test 80: ["a",{"b":"c"}]
I: int test 81: {"Fun":true,"Amt":-2}
I: int test 82: CBOR.Error("out-of-range: 9223372036854775807")
>>>>>>> facf6b8... tests: simplify testsuite output to make diffs more readable..
I: int tests finished. tests ok = 71 failed = 0 ignored = 12
I: running int64 tests from appendix_a.json, extra.json
I: total int64 tests = 83
I: int64 test 0: expected and got 0
I: int64 test 1: expected and got 1
I: int64 test 2: expected and got 10
I: int64 test 3: expected and got 23
I: int64 test 4: expected and got 24
I: int64 test 5: expected and got 25
I: int64 test 6: expected and got 100
I: int64 test 7: expected and got 1000
I: int64 test 8: expected and got 1000000
I: int64 test 9: expected and got 1000000000000
W: int64 test 10: expected "18446744073709551615", got -1, aka -1
W: int64 test 11: expected "18446744073709551616", got "\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000", aka h'010000000000000000'
W: int64 test 12: expected "-18446744073709551616", got 0, aka 0
W: int64 test 13: expected "-18446744073709551617", got "\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000", aka h'010000000000000000'
I: int64 test 14: expected and got -1
I: int64 test 15: expected and got -10
I: int64 test 16: expected and got -100
I: int64 test 17: expected and got -1000
I: int64 test 18: expected and got 0.0
I: int64 test 19: expected and got -0.0
I: int64 test 20: expected and got 1.0
I: int64 test 21: expected and got 1.1
I: int64 test 22: expected and got 1.5
I: int64 test 23: expected and got 65504.0
I: int64 test 24: expected and got 100000.0
I: int64 test 25: expected and got 3.4028234663852886e+38
I: int64 test 26: expected and got 1e+300
I: int64 test 27: expected and got 5.9604644775390625e-08
I: int64 test 28: expected and got 6.103515625e-05
I: int64 test 29: expected and got -4.0
I: int64 test 30: expected and got -4.1
I: int64 test 31: expected and got Infinity
I: int64 test 32: expected and got NaN
I: int64 test 33: expected and got -Infinity
I: int64 test 34: expected and got Infinity
I: int64 test 35: expected and got NaN
I: int64 test 36: expected and got -Infinity
I: int64 test 37: expected and got Infinity
I: int64 test 38: expected and got NaN
I: int64 test 39: expected and got -Infinity
I: int64 test 40: expected and got false
I: int64 test 41: expected and got true
I: int64 test 42: expected and got null
I: int64 test 43: expected and got undefined
I: int64 test 44: expected and got simple(16)
I: int64 test 45: expected and got simple(24)
I: int64 test 46: expected and got simple(255)
W: int64 test 47: expected 0("2013-03-21T20:04:00Z"), got "2013-03-21T20:04:00Z"
W: int64 test 48: expected 1(1363896240), got 1363896240
W: int64 test 49: expected 1(1363896240.5), got 1.3639e+09
W: int64 test 50: expected 23(h'01020304'), got h'01020304'
W: int64 test 51: expected 24(h'6449455446'), got h'6449455446'
W: int64 test 52: expected 32("http://www.example.com"), got "http://www.example.com"
I: int64 test 53: expected and got h''
I: int64 test 54: expected and got h'01020304'
I: int64 test 55: expected and got ""
I: int64 test 56: expected and got "a"
I: int64 test 57: expected and got "IETF"
I: int64 test 58: expected and got "\"\\"
I: int64 test 59: expected and got "ü"
I: int64 test 60: expected and got "水"
I: int64 test 61: expected and got "𐅑"
I: int64 test 62: expected and got []
I: int64 test 63: expected and got [1,2,3]
I: int64 test 64: expected and got [1,[2,3],[4,5]]
I: int64 test 65: expected and got [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
I: int64 test 66: expected and got {}
I: int64 test 67: expected and got {1: 2, 3: 4}
I: int64 test 68: expected and got {"a":1,"b":[2,3]}
I: int64 test 69: expected and got ["a",{"b":"c"}]
I: int64 test 70: expected and got {"a":"A","b":"B","c":"C","d":"D","e":"E"}
W: int64 test 71: expected (_ h'0102', h'030405'), got h'0102030405'
I: int64 test 72: expected and got "streaming"
I: int64 test 73: expected and got []
I: int64 test 74: expected and got [1,[2,3],[4,5]]
I: int64 test 75: expected and got [1,[2,3],[4,5]]
I: int64 test 76: expected and got [1,[2,3],[4,5]]
I: int64 test 77: expected and got [1,[2,3],[4,5]]
I: int64 test 78: expected and got [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
I: int64 test 79: expected and got {"a":1,"b":[2,3]}
I: int64 test 80: expected and got ["a",{"b":"c"}]
I: int64 test 81: expected and got {"Fun":true,"Amt":-2}
I: int64 test 82: expected and got "9223372036854775807"
I: int64 test 0: 0
I: int64 test 1: 1
I: int64 test 2: 10
I: int64 test 3: 23
I: int64 test 4: 24
I: int64 test 5: 25
I: int64 test 6: 100
I: int64 test 7: 1000
I: int64 test 8: 1000000
I: int64 test 9: 1000000000000
I: int64 test 10: "18446744073709551615"
I: int64 test 11: "18446744073709551616"
I: int64 test 12: "-18446744073709551616"
I: int64 test 13: "-18446744073709551617"
I: int64 test 14: -1
I: int64 test 15: -10
I: int64 test 16: -100
I: int64 test 17: -1000
I: int64 test 18: 0.0
I: int64 test 19: -0.0
I: int64 test 20: 1.0
I: int64 test 21: 1.1
I: int64 test 22: 1.5
I: int64 test 23: 65504.0
I: int64 test 24: 100000.0
I: int64 test 25: 3.4028234663852886e+38
I: int64 test 26: 1e+300
I: int64 test 27: 5.9604644775390625e-08
I: int64 test 28: 6.103515625e-05
I: int64 test 29: -4.0
I: int64 test 30: -4.1
I: int64 test 31: Infinity
I: int64 test 32: NaN
I: int64 test 33: -Infinity
I: int64 test 34: Infinity
I: int64 test 35: NaN
I: int64 test 36: -Infinity
I: int64 test 37: Infinity
I: int64 test 38: NaN
I: int64 test 39: -Infinity
I: int64 test 40: false
I: int64 test 41: true
I: int64 test 42: null
I: int64 test 43: undefined
I: int64 test 44: simple(16)
I: int64 test 45: simple(24)
I: int64 test 46: simple(255)
I: int64 test 47: 0("2013-03-21T20:04:00Z")
I: int64 test 48: 1(1363896240)
I: int64 test 49: 1(1363896240.5)
I: int64 test 50: 23(h'01020304')
I: int64 test 51: 24(h'6449455446')
I: int64 test 52: 32("http://www.example.com")
I: int64 test 53: h''
I: int64 test 54: h'01020304'
I: int64 test 55: ""
I: int64 test 56: "a"
I: int64 test 57: "IETF"
I: int64 test 58: "\"\\"
I: int64 test 59: "ü"
I: int64 test 60: "水"
I: int64 test 61: "𐅑"
I: int64 test 62: []
I: int64 test 63: [1,2,3]
I: int64 test 64: [1,[2,3],[4,5]]
I: int64 test 65: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
I: int64 test 66: {}
I: int64 test 67: {1: 2, 3: 4}
I: int64 test 68: {"a":1,"b":[2,3]}
I: int64 test 69: ["a",{"b":"c"}]
I: int64 test 70: {"a":"A","b":"B","c":"C","d":"D","e":"E"}
I: int64 test 71: (_ h'0102', h'030405')
I: int64 test 72: "streaming"
I: int64 test 73: []
I: int64 test 74: [1,[2,3],[4,5]]
I: int64 test 75: [1,[2,3],[4,5]]
I: int64 test 76: [1,[2,3],[4,5]]
I: int64 test 77: [1,[2,3],[4,5]]
I: int64 test 78: [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]
I: int64 test 79: {"a":1,"b":[2,3]}
I: int64 test 80: ["a",{"b":"c"}]
I: int64 test 81: {"Fun":true,"Amt":-2}
I: int64 test 82: "9223372036854775807"
I: int64 tests finished. tests ok = 72 failed = 0 ignored = 11

0 comments on commit f085ad2

Please sign in to comment.