Skip to content

Commit 95a3884

Browse files
committed
Add tests for offset integers
1 parent e5d2b21 commit 95a3884

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

test/runtests.jl

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,5 +421,35 @@ end
421421
@test found && point Point(0.0, 4.0)
422422
@test intersects(a, f) === (false, Point(0.0, 0.0))
423423
end
424+
@testset "Offsetintegers" begin
425+
x = 1
426+
@test GeometryBasics.raw(x) isa Int64
427+
@test GeometryBasics.value(x) == x
428+
429+
x = ZeroIndex(1)
430+
@test eltype(x) == Int64
431+
432+
x = OffsetInteger{0}(1)
433+
@test typeof(x) == OffsetInteger{0,Int64}
434+
435+
x1 = OffsetInteger{0}(2)
436+
@test GeometryBasics.pure_max(x, x1) == x1
437+
@test promote_rule(typeof(x), typeof(x1)) == OffsetInteger{0,Int64}
438+
x2 = 1
439+
@test promote_rule(typeof(x2), typeof(x1)) == Int64
440+
@test Base.to_index(x1) == 2
441+
@test -(x1) == OffsetInteger{0,Int64}(-2)
442+
@test abs(x1) == OffsetInteger{0,Int64}(2)
443+
@test +(x, x1) == OffsetInteger{0,Int64}(3)
444+
@test *(x, x1) == OffsetInteger{0,Int64}(2)
445+
@test -(x, x1) == OffsetInteger{0,Int64}(-1)
446+
#test for /
447+
@test div(x, x1) == OffsetInteger{0,Int64}(0)
448+
@test ==(x, x1)
449+
@test >=(x, x1)
450+
@test <=(x, x1)
451+
@test !>(x, x1)
452+
@test !<(x, x1)
453+
end
424454

425455
end # testset "GeometryBasics"

0 commit comments

Comments
 (0)