I’ve finally turned the fuzz testing code used for https://github.com/JuliaLang/julia/pull/21339 into a package:
GitHub - martinholters/TypeFuzz.jl: Fuzz testing of the Julia type system
It’s still rather basic, I would say, but it does find bugs. To vet your appetite:
julia> using TypeFuzz, Base.Test
julia> srand(2);
julia> @time testset = :(@testset "some tests found by TypeFuzz" begin $(testcases(testtypeintersect(150))) end)
3.543186 seconds (1.67 M allocations: 150.785 MiB, 2.75% gc time)
:(@testset "some tests found by TypeFuzz" begin # REPL[12], line 1:
begin
@test_broken let a = Tuple{T1,T2,Int64} where T1 where T2, b = Tuple{Tuple{S1},S1,S3} where S1 where S3
typeintersect(a, b) == typeintersect(b, a)
end
@test_broken let b = Tuple{Tuple{S1},S1,S3} where S1 where S3
typeintersect(b, Tuple{T1,T2,Int64} where T1 where T2) <: b
end
@test_broken let a = Tuple{Val{T1},T1,T2} where T1 where T2, b = Tuple{S3,S4,3} where S3 where S4
typeintersect(a, b) == typeintersect(b, a)
end
@test_broken let a = Tuple{Val{T1},T1,T2} where T1 where T2
typeintersect(a, Tuple{S3,S4,3} where S3 where S4) <: a
end
@test_broken let b = Tuple{S2,Tuple{S2}} where S2
typeintersect(Tuple{Int64,T2} where T2, b) <: b
end
@test_broken let b = Tuple{S3,S4,Val{S4}} where S3 where S4
typeintersect(b, Tuple{Val{T1},T1,T2} where T1 where T2) <: b
end
@test_broken let a = Tuple{Tuple{T8,T8},T8} where T8, b = Tuple{S3,Int64} where S3
typeintersect(a, b) == typeintersect(b, a)
end
@test_broken let a = Tuple{Tuple{T8},T8} where T8
typeintersect(a, Tuple{S3,Int64} where S3) <: a
end
@test_broken let a = Tuple{Tuple{T8},T8} where T8
typeintersect(Tuple{S3,Int64} where S3, a) <: a
end
@test_broken typeintersect(Tuple{S2,1} where S2, Tuple{T2,T2} where T2)
end
end)
julia> eval(testset);
Test Summary: | Broken Total
some tests found by TypeFuzz | 10 10
Feedback and contributions welcome!