Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
aplavin committed May 25, 2024
1 parent 89727b9 commit d791143
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 14 deletions.
2 changes: 1 addition & 1 deletion test/perf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ let
@testset "IR" begin
info_lens, _ = @code_typed f_lens(args)
info_hand, _ = @code_typed f_hand(args)
test_ir_lens_vs_hand(info_lens, info_hand)
# test_ir_lens_vs_hand(info_lens, info_hand)
end

@testset "benchmark" begin
Expand Down
24 changes: 12 additions & 12 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module TestAccessors
import PerformanceTestTools
import Accessors
import Aqua
VERSION v"1.9-" && Aqua.test_all(Accessors)
PerformanceTestTools.@include("perf.jl")
# import Aqua
# VERSION ≥ v"1.9-" && Aqua.test_all(Accessors)
# PerformanceTestTools.@include("perf.jl")

include("test_examples.jl")
include("test_core.jl")
include("test_optics.jl")
include("test_insert_delete.jl")
# include("test_examples.jl")
# include("test_core.jl")
# include("test_optics.jl")
# include("test_insert_delete.jl")
include("test_extensions.jl")
include("test_quicktypes.jl")
include("test_setmacro.jl")
include("test_setindex.jl")
include("test_functionlenses.jl")
include("test_getsetall.jl")
# include("test_quicktypes.jl")
# include("test_setmacro.jl")
# include("test_setindex.jl")
# include("test_functionlenses.jl")
# include("test_getsetall.jl")

end # module
2 changes: 1 addition & 1 deletion test/test_core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ end

@testset "@accessor" begin
s = MyStruct((a=123,))
@test strip(string(@doc(my_x))) == "Documentation for my_x"
# @test strip(string(@doc(my_x))) == "Documentation for my_x"
@test (@set my_x(s) = 456) === MyStruct(456)
@test (@set +s = 456) === MyStruct((a=5-456,))
test_getset_laws(my_x, s, 456, "1")
Expand Down
31 changes: 31 additions & 0 deletions test/test_extensions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,37 @@ VERSION >= v"1.9-" && @testset "AxisKeys" begin
@test_throws ArgumentError @set named_axiskeys(A).x = 1:3
@test_throws Exception @set axiskeys(A) = ()
@test_throws ArgumentError @set named_axiskeys(A) = (;)


A = KeyedArray([1 2 3; 4 5 6], ([:a, :b], 11:13))

for B in (
@set(axiskeys(A)[2] = [:y, :z, :w]),
@set(A |> axiskeys(_, 2) = [:y, :z, :w]),
)
@test AxisKeys.keyless_unname(A) === AxisKeys.keyless_unname(B)
@test dimnames(B) == (:_, :_)
@test axiskeys(B) == ([:a, :b], [:y, :z, :w])
end

B = @set named_axiskeys(A) = (a=[1, 2], b=[3, 2, 1])
@test AxisKeys.keyless_unname(A) === AxisKeys.keyless_unname(B)
@test named_axiskeys(B) == (a=[1, 2], b=[3, 2, 1])

B = @set dimnames(A) = (:a, :b)
@test AxisKeys.keyless_unname(A) === AxisKeys.keyless_unname(B)
@test named_axiskeys(B) == (a=[:a, :b], b=11:13)

B = @set AxisKeys.keyless_unname(A) = [6 5 4; 3 2 1]
@test axiskeys(B) == axiskeys(A)
@test AxisKeys.keyless_unname(B) == [6 5 4; 3 2 1]

B = @set vec(A) = 1:6
@test AxisKeys.keyless_unname(B) == [1 3 5; 2 4 6]
@test axiskeys(B) == axiskeys(A)

@test_throws ArgumentError @set axiskeys(A)[1] = 1:3
@test_throws Exception @set axiskeys(A) = ()
end

VERSION >= v"1.9-" && @testset "IntervalSets" begin
Expand Down

0 comments on commit d791143

Please sign in to comment.