We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5f12518 commit 3b557b7Copy full SHA for 3b557b7
1 file changed
test/runtests.jl
@@ -632,3 +632,20 @@ Base.eltype(::Type{DieT{T}}) where {T} = T
632
T(typemin(T) + rand(typemin(T):typemax(T)))
633
@test rand(d) isa Bool
634
end
635
+
636
+module TestAtRand
637
+# only using RandomExtensions, not Random, to check we don't depend on
638
+# some imported names like e.g. SamplerTrivial
639
+using RandomExtensions, Test
640
641
+struct Die n end
642
643
+@testset "@rand in module" begin
644
+ @rand rand(d::Die) = d.n # SamplerTrivial
645
+ @test rand(Die(123)) == 123
646
+ @test rand(RandomDevice(), Die(123)) == 123
647
+ @rand rand(d::Die) = rand(1:d.n) # SamplerSimple
648
+ @test rand(Die(1)) == 1
649
+ @test rand(RandomDevice(), Die(1)) == 1
650
+end
651
+end # module
0 commit comments