|
| 1 | +@testset "Issues" begin |
| 2 | + @testset "#81" begin |
| 3 | + # basic issue |
| 4 | + B = GBVector([1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7]) |
| 5 | + A = GBMatrix([1,1,2,2,3,4,4,5,6,7,7,7], [2,4,5,7,6,1,3,6,3,3,4,5], [1:12...]) |
| 6 | + @test A[:, 2] isa GBVector |
| 7 | + @test A[2, :] isa GBVector |
| 8 | + @test emul(A[:, 2], B) == GBVector([1], [1]) |
| 9 | + |
| 10 | + # test that GBMatrix <ewise> GBVector is allowed |
| 11 | + # with correct sizes: |
| 12 | + @test GBMatrix(B) .+ B == GBMatrix(B .* 2) |
| 13 | + end |
| 14 | + |
| 15 | + @testset "#79" begin |
| 16 | + # Indexing GBMatrix with a list of indices |
| 17 | + # mutates that parameter |
| 18 | + i = [1,2] |
| 19 | + A = GBMatrix([1,1,2,2,3,4,4,5,6,7,7,7], [2,4,5,7,6,1,3,6,3,3,4,5], [1:12...]) |
| 20 | + A[i, :] |
| 21 | + @test i == [1,2] |
| 22 | + end |
| 23 | + |
| 24 | + @testset "#78" begin |
| 25 | + @test GBVector{Int}([1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7]) == |
| 26 | + GBVector([1, 2, 3, 4, 5, 6, 7], [1, 2, 3, 4, 5, 6, 7]) |
| 27 | + |
| 28 | + @test GBMatrix{Int64}([1,3,5], [1,3,5], [1,3,5]) == |
| 29 | + GBMatrix([1,3,5], [1,3,5], [1,3,5]) |
| 30 | + |
| 31 | + @test GBVector{Int128}([1,2,3], [1,2,3])[1] == Int128(1) |
| 32 | + end |
| 33 | + |
| 34 | + @testset "#74" begin |
| 35 | + # this interface needs its own tests. |
| 36 | + # an extra is here for that particular issue. |
| 37 | + A = GBMatrix([[1,2] [3,4]]) |
| 38 | + @test *(Monoid((a, b)->a + b, zero), *)(A, A) == A * A |
| 39 | + end |
| 40 | + |
| 41 | + @testset "#71" begin |
| 42 | + # segfault with weird ctor |
| 43 | + @test_throws ArgumentError GBMatrix{Int, Int}(10, 10) |
| 44 | + @test_throws ArgumentError GBVector{Int, Int}(10) |
| 45 | + end |
0 commit comments