Skip to content

Commit d992274

Browse files
committed
Minor changes.
1 parent e9a6827 commit d992274

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

test/cell_lists/spatial_hashing.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,18 @@
6969

7070
@testset "Cell Coordinates Hash Function" begin
7171
# 1D coordinates
72-
@test coordinates_hash((1)) == UInt128(reinterpret(UInt32, Int32(1)))
73-
@test coordinates_hash((-1)) == UInt128(reinterpret(UInt32, Int32(-1)))
74-
@test coordinates_hash((0)) == Int128(0)
72+
@test coordinates_hash([1]) == UInt128(reinterpret(UInt32, Int32(1)))
73+
@test coordinates_hash([-1]) == UInt128(reinterpret(UInt32, Int32(-1)))
74+
@test coordinates_hash([0]) == Int128(0)
7575

7676
# 2D coordinates
77-
coord2 = (-1, 1)
77+
coord2 = [-1, 1]
7878
hash2 = (UInt128(reinterpret(UInt32, Int32(coord2[2]))) << 32) |
7979
UInt128(reinterpret(UInt32, Int32(coord2[1])))
8080
@test coordinates_hash(coord2) == hash2
8181

8282
# 3D coordinates
83-
coord3 = (1, 0, -1)
83+
coord3 = [1, 0, -1]
8484
hash3 = (UInt128(reinterpret(UInt32, Int32(coord3[3]))) << 64) |
8585
(UInt128(reinterpret(UInt32, Int32(coord3[2]))) << 32) |
8686
UInt128(reinterpret(UInt32, Int32(coord3[1])))
@@ -93,7 +93,7 @@
9393
@test coordinates_hash((min_val)) == UInt128(reinterpret(UInt32, min_val))
9494

9595
# 3D extreme Int32 bounds
96-
coord_ex = (min_val, max_val, Int32(0))
96+
coord_ex = [min_val, max_val, Int32(0)]
9797
hash_ex = (UInt128(reinterpret(UInt32, coord_ex[3])) << (2*32)) |
9898
(UInt128(reinterpret(UInt32, coord_ex[2])) << 32) |
9999
UInt128(reinterpret(UInt32, coord_ex[1]))
@@ -106,6 +106,9 @@
106106
small_val = typemin(Int32) - 1
107107
@test_throws InexactError coordinates_hash([small_val])
108108

109+
@test_throws InexactError coordinates_hash([Inf])
110+
@test_throws InexactError coordinates_hash([NaN])
111+
109112
# Too many dimensions should throw assertion
110113
@test_throws AssertionError coordinates_hash([1, 2, 3, 4])
111114
end

0 commit comments

Comments
 (0)