function test_pairwise(F::Function, a, b, s::Integer)
    s1 = minhash(F, a, s)
    s2 = minhash(F, b, s)
    @test intersectionlength(s1, s2) == length(intersect(s1.hashes, s2.hashes))
end

function test_multi(F::Function, x, s)
    sketches = [minhash(F, i, s) for i in x]
    m = intersectionlength(sketches)
    allgood = true
    for i in 1:length(sketches) - 1
        for j in i+1:length(sketches)
            tp = intersectionlength(sketches[i], sketches[j])
            allgood &= tp == m[j, i]
        end
    end
    @test allgood
end

@testset "Pairwise" begin
    test_pairwise(hash, 1:100, 60:200, 40)
    test_pairwise(hash, 1:100, 'A':'z', 40)
    test_pairwise(hash, 1:100, 'A':'z', 1)
    test_pairwise(hash, 'A':'g', 'W':'s', 10)
end

@testset "Multi" begin
    xs = [collect(Set(rand(1:250, 100))) for i in 1:5]
    test_multi(hash, xs, 50)
end

@testset "Misc" begin
    s = minhash('A':'z', 38)
    @test length(s) == 38
    s = minhash(5:55, 250)
    @test length(s) == 51
    @test !isempty(s)
    @test isempty(minhash(hash, 1:0, 100))
end
