From 08049282e9f9f20dcf4017b58fdbdc708062100f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 10 Jan 2025 09:59:42 +0100 Subject: [PATCH 1/4] Include AA's conformance tests in all files that use them --- test/AlgebraicGeometry/Schemes/FunctionFields.jl | 3 +++ test/Rings/AbelianClosure.jl | 3 +++ test/Rings/AlgClosureFp.jl | 3 +++ test/Rings/PBWAlgebraQuo.jl | 13 ++++++++----- test/Rings/mpoly-localizations.jl | 3 +++ 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/test/AlgebraicGeometry/Schemes/FunctionFields.jl b/test/AlgebraicGeometry/Schemes/FunctionFields.jl index 9a1781df7d93..1084d3c01c08 100644 --- a/test/AlgebraicGeometry/Schemes/FunctionFields.jl +++ b/test/AlgebraicGeometry/Schemes/FunctionFields.jl @@ -1,5 +1,8 @@ const rng = Oscar.get_seeded_rng() +import Oscar.AbstractAlgebra +include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) + function test_elem(K::VarietyFunctionField) F = representative_field(K) P = base_ring(F)::MPolyRing diff --git a/test/Rings/AbelianClosure.jl b/test/Rings/AbelianClosure.jl index 9fb875fada9f..3f2cac217192 100644 --- a/test/Rings/AbelianClosure.jl +++ b/test/Rings/AbelianClosure.jl @@ -1,3 +1,6 @@ +import Oscar.AbstractAlgebra +include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) + function test_elem(K::QQAbField) ns = rand(1:8, 3) zs = map(n -> sum(rand(-10:10) * gen(K)(n)^rand(1:n) for j in 1:10), ns) diff --git a/test/Rings/AlgClosureFp.jl b/test/Rings/AlgClosureFp.jl index 059637536418..6e3b686f98f1 100644 --- a/test/Rings/AlgClosureFp.jl +++ b/test/Rings/AlgClosureFp.jl @@ -1,3 +1,6 @@ +import Oscar.AbstractAlgebra +include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) + function test_elem(K::AlgClosure{T}) where T <: FinField d = rand(1:8) F = ext_of_degree(K, d) diff --git a/test/Rings/PBWAlgebraQuo.jl b/test/Rings/PBWAlgebraQuo.jl index e33b52b1ddb5..548cd1c25125 100644 --- a/test/Rings/PBWAlgebraQuo.jl +++ b/test/Rings/PBWAlgebraQuo.jl @@ -1,3 +1,11 @@ +import Oscar.AbstractAlgebra +include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) + +function test_elem(Q::PBWAlgQuo{QQFieldElem}) + R = base_ring(Q) + return Q(R(rand(base_ring(R), 1:4, 1:4, 1:4))) +end + @testset "PBWAlgebraQuo.constructor" begin r, (x, y, z) = QQ[:x, :y, :z] R, (x, y, z) = pbw_algebra(r, [0 x*y x*z; 0 0 y*z + 1; 0 0 0], deglex(r)) @@ -25,11 +33,6 @@ end @test string(one(R)) == "1" end -function test_elem(Q::PBWAlgQuo{QQFieldElem}) - R = base_ring(Q) - return Q(R(rand(base_ring(R), 1:4, 1:4, 1:4))) -end - @testset "PBWAlgebraQuo.conformance" begin r, (a, h, f, e) = QQ[:a, :h, :f, :e] rel = @pbw_relations(e*f == f*e-h, e*h == h*e+2*e, f*h == h*f-2*f) diff --git a/test/Rings/mpoly-localizations.jl b/test/Rings/mpoly-localizations.jl index 61f2b2a14881..dbc003258faa 100644 --- a/test/Rings/mpoly-localizations.jl +++ b/test/Rings/mpoly-localizations.jl @@ -1,5 +1,8 @@ const rng = Oscar.get_seeded_rng() +import Oscar.AbstractAlgebra +include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) + @testset "mpoly-localizations" begin R, variab = ZZ[:x, :y] x = variab[1] From baa4d671d7954af8ed1160178c41567d6353dd72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 10 Jan 2025 10:58:40 +0100 Subject: [PATCH 2/4] Add include guards --- test/AlgebraicGeometry/Schemes/FunctionFields.jl | 6 ++++-- test/Groups/conformance.jl | 9 +++++---- test/LieTheory/WeylGroup.jl | 16 +++++++++------- test/Rings/AbelianClosure.jl | 6 ++++-- test/Rings/AlgClosureFp.jl | 6 ++++-- test/Rings/PBWAlgebraQuo.jl | 6 ++++-- test/Rings/mpoly-localizations.jl | 6 ++++-- 7 files changed, 34 insertions(+), 21 deletions(-) diff --git a/test/AlgebraicGeometry/Schemes/FunctionFields.jl b/test/AlgebraicGeometry/Schemes/FunctionFields.jl index 1084d3c01c08..7b7e838faac0 100644 --- a/test/AlgebraicGeometry/Schemes/FunctionFields.jl +++ b/test/AlgebraicGeometry/Schemes/FunctionFields.jl @@ -1,7 +1,9 @@ const rng = Oscar.get_seeded_rng() -import Oscar.AbstractAlgebra -include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +if !isdefined(Main, :test_Field_interface) + import Oscar.AbstractAlgebra + include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +end function test_elem(K::VarietyFunctionField) F = representative_field(K) diff --git a/test/Groups/conformance.jl b/test/Groups/conformance.jl index a37f33d86955..154b6ff2f973 100644 --- a/test/Groups/conformance.jl +++ b/test/Groups/conformance.jl @@ -1,9 +1,10 @@ L = [ alternating_group(5), cyclic_group(18), SL(3,3), free_group(0), free_group(1), free_group(2) ] -import Oscar.AbstractAlgebra -import Oscar.AbstractAlgebra: Group - -include(joinpath(dirname(pathof(AbstractAlgebra)), "..", "test", "Groups-conformance-tests.jl")) +if !isdefined(Main, :test_Group_interface) + import Oscar.AbstractAlgebra + import Oscar.AbstractAlgebra: Group + include(joinpath(dirname(pathof(AbstractAlgebra)), "..", "test", "Groups-conformance-tests.jl")) +end @testset "GAPGroups_interface_conformance $G of type $(typeof(G))" for G in L diff --git a/test/LieTheory/WeylGroup.jl b/test/LieTheory/WeylGroup.jl index fbf9120bd38a..71d8b9b76b54 100644 --- a/test/LieTheory/WeylGroup.jl +++ b/test/LieTheory/WeylGroup.jl @@ -1,8 +1,10 @@ -import Oscar.AbstractAlgebra -import Oscar.AbstractAlgebra: Group -include( - joinpath(dirname(pathof(AbstractAlgebra)), "..", "test", "Groups-conformance-tests.jl") -) +if !isdefined(Main, :test_Group_interface) + import Oscar.AbstractAlgebra + import Oscar.AbstractAlgebra: Group + include( + joinpath(dirname(pathof(AbstractAlgebra)), "..", "test", "Groups-conformance-tests.jl") + ) +end @testset "LieTheory.WeylGroup" begin function is_in_normal_form(x::WeylGroupElem) @@ -348,7 +350,7 @@ include( @test parent(x) === x.parent @test parent(x) isa WeylGroup end - + @testset "reflection" begin for i in 2:4 R = root_system(:A, i) @@ -411,7 +413,7 @@ include( end end end - + @testset "ReducedExpressionIterator" begin W = weyl_group(:A, 3) s = gens(W) diff --git a/test/Rings/AbelianClosure.jl b/test/Rings/AbelianClosure.jl index 3f2cac217192..1bd4fc651a08 100644 --- a/test/Rings/AbelianClosure.jl +++ b/test/Rings/AbelianClosure.jl @@ -1,5 +1,7 @@ -import Oscar.AbstractAlgebra -include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +if !isdefined(Main, :test_Field_interface) + import Oscar.AbstractAlgebra + include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +end function test_elem(K::QQAbField) ns = rand(1:8, 3) diff --git a/test/Rings/AlgClosureFp.jl b/test/Rings/AlgClosureFp.jl index 6e3b686f98f1..8e025b9d4cf9 100644 --- a/test/Rings/AlgClosureFp.jl +++ b/test/Rings/AlgClosureFp.jl @@ -1,5 +1,7 @@ -import Oscar.AbstractAlgebra -include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +if !isdefined(Main, :test_Field_interface) + import Oscar.AbstractAlgebra + include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +end function test_elem(K::AlgClosure{T}) where T <: FinField d = rand(1:8) diff --git a/test/Rings/PBWAlgebraQuo.jl b/test/Rings/PBWAlgebraQuo.jl index 548cd1c25125..8fc6e8feca8d 100644 --- a/test/Rings/PBWAlgebraQuo.jl +++ b/test/Rings/PBWAlgebraQuo.jl @@ -1,5 +1,7 @@ -import Oscar.AbstractAlgebra -include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +if !isdefined(Main, :test_NCRing_interface) + import Oscar.AbstractAlgebra + include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +end function test_elem(Q::PBWAlgQuo{QQFieldElem}) R = base_ring(Q) diff --git a/test/Rings/mpoly-localizations.jl b/test/Rings/mpoly-localizations.jl index dbc003258faa..e4632a1626d3 100644 --- a/test/Rings/mpoly-localizations.jl +++ b/test/Rings/mpoly-localizations.jl @@ -1,7 +1,9 @@ const rng = Oscar.get_seeded_rng() -import Oscar.AbstractAlgebra -include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +if !isdefined(Main, :test_Ring_interface_recursive) + import Oscar.AbstractAlgebra + include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +end @testset "mpoly-localizations" begin R, variab = ZZ[:x, :y] From 4d0603c7dadb833aaeba0f4f81c0ca25bac8e5fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 10 Jan 2025 13:01:55 +0100 Subject: [PATCH 3/4] Remove `@everywhere include(...)` --- test/runtests.jl | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index a3293ac8b99d..d7f1a0d96483 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -50,9 +50,6 @@ if VERSION >= v"1.8.0" @everywhere GC.enable_logging(true) end -@everywhere import Oscar.Nemo.AbstractAlgebra -@everywhere include(joinpath(pathof(Oscar.Nemo.AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) - # hotfix, otherwise StraightLinePrograms returns something which then leads to an error module SLPTest end From 764938480cb8193c42822da4b5bf8c8ad8da61c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Fri, 10 Jan 2025 13:06:39 +0100 Subject: [PATCH 4/4] Move some inclusions to `setup_tests.jl` --- test/LieTheory/WeylGroup.jl | 8 -------- test/LieTheory/setup_tests.jl | 13 ++++++++++--- test/Rings/AbelianClosure.jl | 5 ----- test/Rings/AlgClosureFp.jl | 5 ----- test/Rings/PBWAlgebraQuo.jl | 5 ----- test/Rings/mpoly-localizations.jl | 5 ----- test/Rings/setup_tests.jl | 4 ++++ 7 files changed, 14 insertions(+), 31 deletions(-) create mode 100644 test/Rings/setup_tests.jl diff --git a/test/LieTheory/WeylGroup.jl b/test/LieTheory/WeylGroup.jl index 71d8b9b76b54..379cc699be38 100644 --- a/test/LieTheory/WeylGroup.jl +++ b/test/LieTheory/WeylGroup.jl @@ -1,11 +1,3 @@ -if !isdefined(Main, :test_Group_interface) - import Oscar.AbstractAlgebra - import Oscar.AbstractAlgebra: Group - include( - joinpath(dirname(pathof(AbstractAlgebra)), "..", "test", "Groups-conformance-tests.jl") - ) -end - @testset "LieTheory.WeylGroup" begin function is_in_normal_form(x::WeylGroupElem) return word(parent(x)(word(x))) == word(x) diff --git a/test/LieTheory/setup_tests.jl b/test/LieTheory/setup_tests.jl index e3c3c4f541d4..0519485de4bb 100644 --- a/test/LieTheory/setup_tests.jl +++ b/test/LieTheory/setup_tests.jl @@ -1,8 +1,15 @@ if !isdefined(Main, :test_mutating_op_like_zero) + import Oscar.AbstractAlgebra include( - joinpath( - pathof(Oscar.Nemo.AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl" - ), + joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl") + ) +end + +if !isdefined(Main, :test_Group_interface) + import Oscar.AbstractAlgebra + import Oscar.AbstractAlgebra: Group + include( + joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Groups-conformance-tests.jl") ) end diff --git a/test/Rings/AbelianClosure.jl b/test/Rings/AbelianClosure.jl index 1bd4fc651a08..9fb875fada9f 100644 --- a/test/Rings/AbelianClosure.jl +++ b/test/Rings/AbelianClosure.jl @@ -1,8 +1,3 @@ -if !isdefined(Main, :test_Field_interface) - import Oscar.AbstractAlgebra - include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) -end - function test_elem(K::QQAbField) ns = rand(1:8, 3) zs = map(n -> sum(rand(-10:10) * gen(K)(n)^rand(1:n) for j in 1:10), ns) diff --git a/test/Rings/AlgClosureFp.jl b/test/Rings/AlgClosureFp.jl index 8e025b9d4cf9..059637536418 100644 --- a/test/Rings/AlgClosureFp.jl +++ b/test/Rings/AlgClosureFp.jl @@ -1,8 +1,3 @@ -if !isdefined(Main, :test_Field_interface) - import Oscar.AbstractAlgebra - include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) -end - function test_elem(K::AlgClosure{T}) where T <: FinField d = rand(1:8) F = ext_of_degree(K, d) diff --git a/test/Rings/PBWAlgebraQuo.jl b/test/Rings/PBWAlgebraQuo.jl index 8fc6e8feca8d..c333a03c8f07 100644 --- a/test/Rings/PBWAlgebraQuo.jl +++ b/test/Rings/PBWAlgebraQuo.jl @@ -1,8 +1,3 @@ -if !isdefined(Main, :test_NCRing_interface) - import Oscar.AbstractAlgebra - include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) -end - function test_elem(Q::PBWAlgQuo{QQFieldElem}) R = base_ring(Q) return Q(R(rand(base_ring(R), 1:4, 1:4, 1:4))) diff --git a/test/Rings/mpoly-localizations.jl b/test/Rings/mpoly-localizations.jl index e4632a1626d3..61f2b2a14881 100644 --- a/test/Rings/mpoly-localizations.jl +++ b/test/Rings/mpoly-localizations.jl @@ -1,10 +1,5 @@ const rng = Oscar.get_seeded_rng() -if !isdefined(Main, :test_Ring_interface_recursive) - import Oscar.AbstractAlgebra - include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) -end - @testset "mpoly-localizations" begin R, variab = ZZ[:x, :y] x = variab[1] diff --git a/test/Rings/setup_tests.jl b/test/Rings/setup_tests.jl new file mode 100644 index 000000000000..78177924a4e2 --- /dev/null +++ b/test/Rings/setup_tests.jl @@ -0,0 +1,4 @@ +if !isdefined(Main, :test_Field_interface) || !isdefined(Main, :test_NCRing_interface) + import Oscar.AbstractAlgebra + include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl")) +end