From 7d84bc02bf0cb853d6e17fcb0c504fcf22aa089a Mon Sep 17 00:00:00 2001 From: Rafael Schouten Date: Sun, 6 Jun 2021 18:01:59 +1000 Subject: [PATCH] fix tests --- test/test_queries.jl | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/test/test_queries.jl b/test/test_queries.jl index 36456bd6..50b5fa3f 100644 --- a/test/test_queries.jl +++ b/test/test_queries.jl @@ -1,20 +1,16 @@ using Accessors, ConstructionBase, BenchmarkTools -optic = Accessors.Query(x -> x isa Int) -obj = (7, (a=17.0, b=2.0f0), ("3", 4, 5)) +optic = Accessors.Query(; select=x -> x isa Float64, ignore=x -> x isa Tuple) +obj = (7, (a=17.0, b=2.0f0), ("3", 4, 5.0), (x=6.0,), ) vals = (1.0, 2.0, 3.0, 4.0) @btime $optic($obj) -@btime set($obj, $optic, $vals) +@btime Accessors.set($obj, $optic, $vals) # Compiles away -@btime modify(x -> 2x, $vals, $optic) +@btime Accessors.modify(x -> 2x, $vals, $optic) -unstable_optic = Accessors.Query(x -> x isa Number && x > 2) - # This is slow -@btime set($x, $unstable_optic, $y) - -# This still compiles away -@btime modify(x -> 2x, $vals, $unstable_optic) - +unstable_optic = Accessors.Query(x -> x isa Number && x > 4) +@btime Accessors.set($obj, $unstable_optic, $vals) +@btime Accessors.modify(x -> 2x, $obj, $unstable_optic)