Skip to content

Commit 7d84bc0

Browse files
committed
fix tests
1 parent a9e7ec8 commit 7d84bc0

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

test/test_queries.jl

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,16 @@
11
using Accessors, ConstructionBase, BenchmarkTools
22

3-
optic = Accessors.Query(x -> x isa Int)
4-
obj = (7, (a=17.0, b=2.0f0), ("3", 4, 5))
3+
optic = Accessors.Query(; select=x -> x isa Float64, ignore=x -> x isa Tuple)
4+
obj = (7, (a=17.0, b=2.0f0), ("3", 4, 5.0), (x=6.0,), )
55
vals = (1.0, 2.0, 3.0, 4.0)
66

77
@btime $optic($obj)
8-
@btime set($obj, $optic, $vals)
8+
@btime Accessors.set($obj, $optic, $vals)
99
# Compiles away
10-
@btime modify(x -> 2x, $vals, $optic)
10+
@btime Accessors.modify(x -> 2x, $vals, $optic)
1111

1212

13-
unstable_optic = Accessors.Query(x -> x isa Number && x > 2)
14-
1513
# This is slow
16-
@btime set($x, $unstable_optic, $y)
17-
18-
# This still compiles away
19-
@btime modify(x -> 2x, $vals, $unstable_optic)
20-
14+
unstable_optic = Accessors.Query(x -> x isa Number && x > 4)
15+
@btime Accessors.set($obj, $unstable_optic, $vals)
16+
@btime Accessors.modify(x -> 2x, $obj, $unstable_optic)

0 commit comments

Comments
 (0)