1
0
mirror of https://github.com/kalmarek/GroupRings.jl.git synced 2024-12-28 18:50:29 +01:00

update tests for promote_rules

This commit is contained in:
kalmarek 2019-06-06 19:37:32 +02:00
parent 9e5a307ee3
commit cc7eb9b699
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15
2 changed files with 17 additions and 9 deletions

View File

@ -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

View File

@ -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