From 1448ac74534070c38966c5aecc4a73d99721afa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Wed, 20 Nov 2024 22:19:40 +0100 Subject: [PATCH] Add test --- src/subs.jl | 2 +- test/runtests.jl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/subs.jl b/src/subs.jl index 7bdac8e..03501d5 100644 --- a/src/subs.jl +++ b/src/subs.jl @@ -138,7 +138,7 @@ end function _mono_eval(z::Vector{Int}, vals::AbstractVector) if length(z) != length(vals) - error("") + error("Cannot evaluate a polynomial of `$(length(z))` variables with only `$(length(vals))` values.") end if isempty(z) return one(eltype(vals))^1 diff --git a/test/runtests.jl b/test/runtests.jl index c9f1a49..ac0c6e0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -18,6 +18,8 @@ end alloc_test_lt(() -> p(x => v), 300) alloc_test_lt(() -> substitute(Eval(), p, v), 0) alloc_test_lt(() -> p(v), 0) + err = ErrorException("Cannot evaluate a polynomial of `3` variables with only `2` values.") + @test_throws err p([1, 2]) end @testset "Issue #70" begin