tests: add nested array not equal tests

pull/5439/head
yuyi 2020-06-20 08:34:49 +08:00 committed by GitHub
parent 4dc703af2d
commit e484fe15d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -48,20 +48,29 @@ fn test_array_equality() {
fn test_nested_array_equality() {
a1 := [[1]]
assert a1 == [[1]]
assert a1 != [[2]]
a2 := [[[[1]]]]
assert a2 == [[[[1]]]]
assert a2 != [[[[2]]]]
a3 := [[[1,2,3]]]
assert a3 == [[[1,2,3]]]
assert a3 != [[[1,0,3]]]
a4 := [[1.1], [2.2]]
assert a4 == [[1.1], [2.2]]
assert a4 != [[2.1], [3.2]]
a5 := [[[[1,2], [2,3], [3,4]]]]
assert a5 == [[[[1,2], [2,3], [3,4]]]]
assert a5 != [[[[2,2], [2,4], [3,4]]]]
a6 := [[['aa', 'bb'], ['cc', 'dd']]]
assert a6 == [[['aa', 'bb'], ['cc', 'dd']]]
assert a6 != [[['a', 'b'], ['cc', 'dd']]]
a7 := [[[true], [false]]]
assert a7 == [[[true], [false]]]
assert a7 != [[[false], [true]]]
a8 := [[[[`a`, `b`], [`c`, `d`]]]]
assert a8 == [[[[`a`, `b`], [`c`, `d`]]]]
assert a8 != [[[[`c`, `a`], [`e`, `d`]]]]
a9 := [[[u16(22), 11]]]
assert a9 == [[[u16(22), 11]]]
assert a9 != [[[u16(20), 10]]]
}