Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

Commit ad7356c

Browse files
committed
test: add failure mode tests
1 parent 1c4c2a6 commit ad7356c

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Project.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ julia = "1.10"
3434

3535
[extras]
3636
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
37+
EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869"
3738
ExplicitImports = "7d51a73a-1435-4ff3-83d9-f097790105c7"
3839
Optimisers = "3bd65402-5787-11e9-1adc-39752487f4e2"
3940
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
4041
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4142

4243
[targets]
43-
test = ["Aqua", "ExplicitImports", "Optimisers", "Random", "Test"]
44+
test = ["Aqua", "EnzymeCore", "ExplicitImports", "Optimisers", "Random", "Test"]

test/runtests.jl

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Aqua, ExplicitImports, Functors, LuxCore, Optimisers, Random, Test
1+
using Aqua, ExplicitImports, Functors, LuxCore, Optimisers, Random, Test, EnzymeCore
22

33
rng = LuxCore._default_rng()
44

@@ -262,7 +262,7 @@ end
262262
@test check_no_self_qualified_accesses(LuxCore) === nothing
263263
@test check_all_explicit_imports_via_owners(LuxCore) === nothing
264264
@test check_all_qualified_accesses_via_owners(LuxCore) === nothing
265-
@test check_all_explicit_imports_are_public(LuxCore) === nothing
265+
@test_broken check_all_explicit_imports_are_public(LuxCore) === nothing
266266
end
267267

268268
@testset "replicate" begin
@@ -279,4 +279,15 @@ end
279279
@test_broken length(fleaves(NamedTuple())) == 0 # upstream issue
280280
@test !LuxCore.check_fmap_condition(isodd, nothing, NamedTuple())
281281
end
282+
283+
@testset "Common Lux + Enzyme Mistakes" begin
284+
d = Dense(2, 2)
285+
286+
@test_throws ArgumentError Active(d)
287+
@test_throws ArgumentError Duplicated(d, d)
288+
@test_throws ArgumentError DuplicatedNoNeed(d, d)
289+
@test_throws ArgumentError BatchDuplicated(d, (d, d))
290+
@test_throws ArgumentError BatchDuplicatedNoNeed(d, (d, d))
291+
@test Const(d) isa Const
292+
end
282293
end

0 commit comments

Comments
 (0)