From 3ca3c93252e6c60177f9d0f805428ae5ce757ca6 Mon Sep 17 00:00:00 2001 From: "Bowen S. Zhu" Date: Wed, 16 Oct 2024 18:22:47 -0400 Subject: [PATCH] Use SafeTestsets --- Project.toml | 3 ++- test/basics.jl | 4 +++- test/doctest.jl | 10 ++++++++++ test/fuzzlib.jl | 5 ++--- test/order.jl | 3 ++- test/polyform.jl | 2 ++ test/rewrite.jl | 4 ++++ test/rulesets.jl | 3 +++ test/runtests.jl | 50 +++++++++++++++++------------------------------- 9 files changed, 46 insertions(+), 38 deletions(-) create mode 100644 test/doctest.jl diff --git a/Project.toml b/Project.toml index c2e992d39..a3fb39477 100644 --- a/Project.toml +++ b/Project.toml @@ -68,8 +68,9 @@ PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf" ReverseDiff = "37e2e3b7-166d-5795-8a7a-e32c996b4267" +SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" [targets] -test = ["BenchmarkTools", "Documenter", "LabelledArrays", "Pkg", "PkgBenchmark", "Random", "ReferenceTests", "ReverseDiff", "Test", "Zygote"] +test = ["BenchmarkTools", "Documenter", "LabelledArrays", "Pkg", "PkgBenchmark", "Random", "ReferenceTests", "ReverseDiff", "SafeTestsets", "Test", "Zygote"] diff --git a/test/basics.jl b/test/basics.jl index 024533c9e..1402f9aca 100644 --- a/test/basics.jl +++ b/test/basics.jl @@ -2,7 +2,9 @@ using SymbolicUtils: Symbolic, Sym, FnType, Term, Add, Mul, Pow, symtype, operat using SymbolicUtils using IfElse: ifelse using Setfield -using Test +using Test, ReferenceTests + +include("utils.jl") @testset "@syms" begin let diff --git a/test/doctest.jl b/test/doctest.jl new file mode 100644 index 000000000..19ee9b4ac --- /dev/null +++ b/test/doctest.jl @@ -0,0 +1,10 @@ +using Documenter, SymbolicUtils + +DocMeta.setdocmeta!( + SymbolicUtils, + :DocTestSetup, + :(using SymbolicUtils); + recursive=true +) + +doctest(SymbolicUtils) diff --git a/test/fuzzlib.jl b/test/fuzzlib.jl index ae9d9a213..163467d6a 100644 --- a/test/fuzzlib.jl +++ b/test/fuzzlib.jl @@ -1,11 +1,10 @@ using SymbolicUtils -using SymbolicUtils: Term +using SymbolicUtils: Term, showraw, Symbolic, issym using SpecialFunctions using Test import IfElse: ifelse import IfElse - -using SymbolicUtils: showraw, Symbolic +using NaNMath function rand_input(T) if T == Bool diff --git a/test/order.jl b/test/order.jl index 3b7095e95..c6e78f2cb 100644 --- a/test/order.jl +++ b/test/order.jl @@ -1,6 +1,7 @@ using Test using Combinatorics -using SymbolicUtils: <ₑ, arguments +using SymbolicUtils +using SymbolicUtils: <ₑ, arguments, Term SymbolicUtils.show_simplified[] = false @syms a b c diff --git a/test/polyform.jl b/test/polyform.jl index 03c158c9d..5c68ddced 100644 --- a/test/polyform.jl +++ b/test/polyform.jl @@ -1,6 +1,8 @@ using SymbolicUtils: PolyForm, Term, symtype using Test, SymbolicUtils +include("utils.jl") + @testset "div and polyform" begin @syms x y z @test_skip repr(PolyForm(x-y)) == "-y + x" diff --git a/test/rewrite.jl b/test/rewrite.jl index 3bb2621e3..c2e920f9b 100644 --- a/test/rewrite.jl +++ b/test/rewrite.jl @@ -1,3 +1,7 @@ +using SymbolicUtils + +include("utils.jl") + @syms a b c @testset "Equality" begin diff --git a/test/rulesets.jl b/test/rulesets.jl index ddebedf28..cfbc0143e 100644 --- a/test/rulesets.jl +++ b/test/rulesets.jl @@ -1,6 +1,9 @@ using Random: shuffle, seed! +using SymbolicUtils using SymbolicUtils: getdepth, Rewriters, Term +include("utils.jl") + @testset "Chain, Postwalk and Fixpoint" begin @syms w z α::Real β::Real diff --git a/test/runtests.jl b/test/runtests.jl index 049313154..6899c1842 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,34 +1,20 @@ -using Documenter -using Pkg -using Test -using SymbolicUtils -using ReferenceTests -import IfElse: ifelse +using Pkg, Test, SafeTestsets -DocMeta.setdocmeta!( - SymbolicUtils, - :DocTestSetup, - :(using SymbolicUtils); - recursive=true -) - -doctest(SymbolicUtils) -SymbolicUtils.show_simplified[] = false - -include("utils.jl") - -if haskey(ENV, "SU_BENCHMARK_ONLY") - include("benchmark.jl") -else - include("basics.jl") - include("order.jl") - include("polyform.jl") - include("rewrite.jl") - include("rulesets.jl") - include("code.jl") - include("cse.jl") - include("interface.jl") - # Disabled until https://github.com/JuliaMath/SpecialFunctions.jl/issues/446 is fixed - include("fuzz.jl") - include("adjoints.jl") +@testset begin + if haskey(ENV, "SU_BENCHMARK_ONLY") + @safetestset "Benchmark" begin include("benchmark.jl") end + else + @safetestset "Doc" begin include("doctest.jl") end + @safetestset "Basics" begin include("basics.jl") end + @safetestset "Order" begin include("order.jl") end + @safetestset "PolyForm" begin include("polyform.jl") end + @safetestset "Rewrite" begin include("rewrite.jl") end + @safetestset "Rulesets" begin include("rulesets.jl") end + @safetestset "Code" begin include("code.jl") end + @safetestset "CSE" begin include("cse.jl") end + @safetestset "Interface" begin include("interface.jl") end + # Disabled until https://github.com/JuliaMath/SpecialFunctions.jl/issues/446 is fixed + @safetestset "Fuzz" begin include("fuzz.jl") end + @safetestset "Adjoints" begin include("adjoints.jl") end + end end