From cc7eb9b699b2869f2900499dcd6bda261e9ebccf Mon Sep 17 00:00:00 2001 From: kalmarek Date: Thu, 6 Jun 2019 19:37:32 +0200 Subject: [PATCH] update tests for promote_rules --- test/AARing_interface_conformance.jl | 17 +++++++++++++---- test/runtests.jl | 9 ++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/test/AARing_interface_conformance.jl b/test/AARing_interface_conformance.jl index 3d6da2e..9e8b600 100644 --- a/test/AARing_interface_conformance.jl +++ b/test/AARing_interface_conformance.jl @@ -229,16 +229,25 @@ function test_promote_rules(f,g) f,g = deepcopy(f), deepcopy(g) @testset "promote_rules" begin - @test_broken AbstractAlgebra.promote_rule(typeof(f), Int16) == typeof(f) - @test_broken promote_rule(typeof(f), BigInt) == typeof(f) + function test_promotes(F::Type, I::Type) + @testset "Promote_type with $I" begin + @test AbstractAlgebra.promote_rule(F, I) isa Type + @test AbstractAlgebra.promote_rule(F, I) != Union{} + @test AbstractAlgebra.promote_rule(F, I) == + AbstractAlgebra.promote_rule(I, F) + end + end + test_promotes(typeof(f), Int16) + test_promotes(typeof(f), BigInt) + + test_promotes(typeof(f), typeof(g)) @test AbstractAlgebra.promote_rule(typeof(f), typeof(g)) == typeof(f) - @test AbstractAlgebra.promote_rule(typeof(g), typeof(f)) == typeof(f) if has_base_ring(parent(f)) S = base_ring(parent(f)) + test_promotes(typeof(f), elem_type(S)) @test AbstractAlgebra.promote_rule(typeof(f), elem_type(S)) == typeof(f) - @test AbstractAlgebra.promote_rule(elem_type(S), typeof(f)) == typeof(f) end end end diff --git a/test/runtests.jl b/test/runtests.jl index 9588402..7caa56a 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -4,13 +4,14 @@ using AbstractAlgebra using GroupRings using SparseArrays -@testset "Group Rings tests" begin +include("AARing_interface_conformance.jl") +@testset "Group Rings tests" begin include("unittests.jl") include("usetests.jl") let - include("AARing_interface_conformance.jl") + R = AbstractAlgebra.zz G = PermGroup(4) @@ -19,8 +20,6 @@ using SparseArrays X = rand(RG, 0.2, -3:3) Y = rand(RG, 0.4, -1:1) - # test_ringinterface(X, Y) - test_promote_rules(X, Y) + test_ringinterface(X, Y) end - end