diff --git a/experimental/LieAlgebras/test/RootSystem-test.jl b/experimental/LieAlgebras/test/RootSystem-test.jl index 71cd8001372..d6a832cc3d0 100644 --- a/experimental/LieAlgebras/test/RootSystem-test.jl +++ b/experimental/LieAlgebras/test/RootSystem-test.jl @@ -30,6 +30,8 @@ end @testset "property tests" begin + Main.equality(a::T, b::T) where {T <: Union{RootSpaceElem, DualRootSpaceElem, WeightLatticeElem}} = a == b + function root_system_property_tests(R::RootSystem, rk::Int, npositive_roots::Int) W = weyl_group(R) @@ -136,72 +138,17 @@ RootSpaceElem, DualRootSpaceElem, WeightLatticeElem ) rk = rank(R) + for _ in 1:10 + a = T(R, rand(-10:10, rk)) + b = T(R, rand(-10:10, rk)) + c = T(R, rand(-10:10, rk)) - x1 = T(R, rand(-10:10, rk)) - x2 = T(R, rand(-10:10, rk)) - x3 = T(R, rand(-10:10, rk)) - x1c = deepcopy(x1) - x2c = deepcopy(x2) - x3c = deepcopy(x3) - - for (f, f!) in ((zero, zero!),) - x1 = f!(x1) - @test x1 == f(x1c) - x1 = deepcopy(x1c) - end - - for (f, f!) in ((-, neg!),) - x1 = f!(x1, x2) - @test x1 == f(x2c) - @test x2 == x2c - x1 = deepcopy(x1c) - x2 = deepcopy(x2c) + test_mutating_op_like_zero(zero, zero!, a) - x1 = f!(x1) - @test x1 == f(x1c) - x1 = deepcopy(x1c) - end + test_mutating_op_like_neg(-, neg!, a) - for (f, f!) in ((+, add!), (-, sub!)) - x1 = f!(x1, x2, x3) - @test x1 == f(x2c, x3c) - @test x2 == x2c - @test x3 == x3c - x1 = deepcopy(x1c) - x2 = deepcopy(x2c) - x3 = deepcopy(x3c) - - x1 = f!(x1, x1, x2) - @test x1 == f(x1c, x2c) - @test x2 == x2c - x1 = deepcopy(x1c) - x2 = deepcopy(x2c) - - x1 = f!(x1, x2, x1) - @test x1 == f(x2c, x1c) - @test x2 == x2c - x1 = deepcopy(x1c) - x2 = deepcopy(x2c) - - x1 = f!(x1, x2, x2) - @test x1 == f(x2c, x2c) - @test x2 == x2c - x1 = deepcopy(x1c) - x2 = deepcopy(x2c) - - x1 = f!(x1, x1, x1) - @test x1 == f(x1c, x1c) - x1 = deepcopy(x1c) - - x1 = f!(x1, x2) - @test x1 == f(x1c, x2c) - @test x2 == x2c - x1 = deepcopy(x1c) - x2 = deepcopy(x2c) - - x1 = f!(x1, x1) - @test x1 == f(x1c, x1c) - x1 = deepcopy(x1c) + test_mutating_op_like_add(+, add!, a, b) + test_mutating_op_like_add(-, sub!, a, b) end end diff --git a/experimental/LieAlgebras/test/WeylGroup-test.jl b/experimental/LieAlgebras/test/WeylGroup-test.jl index ad75702fafc..673cf69bde8 100644 --- a/experimental/LieAlgebras/test/WeylGroup-test.jl +++ b/experimental/LieAlgebras/test/WeylGroup-test.jl @@ -288,9 +288,9 @@ include( @test ngens(weyl_group(:F, 4)) == 4 @test ngens(weyl_group(:G, 2)) == 2 - @test ngens(weyl_group((:A, 2), (:B, 4))) == 6 - @test ngens(weyl_group((:C, 3), (:E, 7))) == 10 - @test ngens(weyl_group((:F, 4), (:G, 2))) == 6 + @test ngens(weyl_group((:A, 2), (:B, 4))) == 2+4 + @test ngens(weyl_group((:C, 3), (:E, 7))) == 3+7 + @test ngens(weyl_group((:F, 4), (:G, 2))) == 4+2 end @testset "Base.:(*)(x::WeylGroupElem, y::WeylGroupElem)" begin diff --git a/experimental/LieAlgebras/test/setup_tests.jl b/experimental/LieAlgebras/test/setup_tests.jl index 80dc1590266..4fa6aae40bd 100644 --- a/experimental/LieAlgebras/test/setup_tests.jl +++ b/experimental/LieAlgebras/test/setup_tests.jl @@ -4,6 +4,10 @@ if !isdefined(Main, :GAPWrap) import Oscar: GAPWrap end +if !isdefined(Main, :test_mutating_op_like_zero) + include(joinpath(pathof(Oscar.Nemo.AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +end + if !isdefined(Main, :lie_algebra_conformance_test) || isinteractive() function lie_algebra_conformance_test( L::LieAlgebra{C}, parentT::DataType, elemT::DataType; num_random_tests::Int=10