From 17011abe221225e1f497b37d1c8b47a6d5dfd0e8 Mon Sep 17 00:00:00 2001 From: thofma Date: Tue, 26 Jan 2021 13:52:06 +0100 Subject: [PATCH] Cover some corner cases error throwing --- src/Hecke.jl | 2 +- test/QuadForm.jl | 1 + test/QuadForm/Herm.jl | 3 +++ test/QuadForm/Herm/Spaces.jl | 18 ++++++++++++++++++ test/QuadForm/Quad/Spaces.jl | 7 +++++++ 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 test/QuadForm/Herm.jl create mode 100644 test/QuadForm/Herm/Spaces.jl diff --git a/src/Hecke.jl b/src/Hecke.jl index 9b339b221d..584504dd76 100644 --- a/src/Hecke.jl +++ b/src/Hecke.jl @@ -534,7 +534,7 @@ end function test_module(x, new::Bool = true) julia_exe = Base.julia_cmd() # On Windows, we also allow bla/blub" - x = _adjust_path + x = _adjust_path(x) if x == "all" test_file = joinpath(pkgdir, "test", "runtests.jl") else diff --git a/test/QuadForm.jl b/test/QuadForm.jl index 8af88ca575..a575ccccb7 100644 --- a/test/QuadForm.jl +++ b/test/QuadForm.jl @@ -8,4 +8,5 @@ @time include("QuadForm/MassHerm.jl") @time include("QuadForm/Quad.jl") @time include("QuadForm/QuadBin.jl") + @time include("QuadForm/Herm.jl") end diff --git a/test/QuadForm/Herm.jl b/test/QuadForm/Herm.jl new file mode 100644 index 0000000000..52fc0c0c72 --- /dev/null +++ b/test/QuadForm/Herm.jl @@ -0,0 +1,3 @@ +@testset "Herm" begin + include("Herm/Spaces.jl") +end diff --git a/test/QuadForm/Herm/Spaces.jl b/test/QuadForm/Herm/Spaces.jl new file mode 100644 index 0000000000..c48087aa4d --- /dev/null +++ b/test/QuadForm/Herm/Spaces.jl @@ -0,0 +1,18 @@ +@testset "Spaces" begin + Qx, x = PolynomialRing(FlintQQ, "x") + K, a = NumberField(x^2 - 2, "a1") + Kt, t = K["t"] + + E, b = NumberField(t^2 + 3) + + F = GF(3) + + Hecke.change_base_ring(::Hecke.NfRel, ::Hecke.gfp_mat) = error("asd") + @test_throws ErrorException hermitian_space(E, F[1 2; 2 1]) + + Hecke.change_base_ring(::Hecke.NfRel, x::Hecke.gfp_mat) = x + @test_throws ErrorException hermitian_space(E, F[1 2; 2 1]) + + V = @inferred hermitian_space(E, FlintQQ[1 2; 2 1]) + @test V isa Hecke.HermSpace +end diff --git a/test/QuadForm/Quad/Spaces.jl b/test/QuadForm/Quad/Spaces.jl index 9e73458bcc..598e358797 100644 --- a/test/QuadForm/Quad/Spaces.jl +++ b/test/QuadForm/Quad/Spaces.jl @@ -6,6 +6,13 @@ K2, a2 = NumberField(x^3 - 2, "a2") K1t, t = PolynomialRing(K1, "t") + F = GF(3) + + Hecke.change_base_ring(::FlintRationalField, ::Hecke.gfp_mat) = error("asd") + @test_throws ErrorException quadratic_space(FlintQQ, F[1 2; 2 1]) + + Hecke.change_base_ring(::FlintRationalField, x::Hecke.gfp_mat) = x + @test_throws ErrorException quadratic_space(FlintQQ, F[1 2; 2 1]) L, b = NumberField(t^2 + a1)