|
421 | 421 | @test found && point ≈ Point(0.0, 4.0)
|
422 | 422 | @test intersects(a, f) === (false, Point(0.0, 0.0))
|
423 | 423 | 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 |
424 | 454 |
|
425 | 455 | end # testset "GeometryBasics"
|
0 commit comments