# distance functions
@test edit_distance("AAAATTTTCCCCGGGG", "AAAATTATCCCCGGGG") == 1
@test edit_distance("AAAATTTTCCCCGGGG", "AAAATTTCCCCGGGG") == 1
@test edit_distance("AAAATTTTCCCCGGGG", "AAAATATCCCCGGGG") == 2
@test hamming_distance("AAAATTTTCCCCGGGG", "AAAATTATCCCCGGGG") == 1
@test hamming_distance("AAAATTTTCCCCGGGG", "AAAATTTCCCCGGGG") == 2

function test_merge()
    r1 = dna("CCACCCAAAGCCGCGGGCGCTGATGATGGGTGAGGAGGGGGCGGCAAGATTTCGGGCGCCCCTGCCCTGAACGCCCTCAGCTGCTGCCGCCGGGGCCGCTCCGGAGGCGGGAGCCGGTAGCCGAGCCGGGCGACCTAGAGAACGAGCG")
    r2 = dna("CACTTCATTCAGCGGACCGACAGAGTGGCCGACGCTGAGCCTGACCCGCTCGTTCTCTAGGTCGCCCGGCTCGGCTACCGGCTCCCGCCTCCGGAGCGGCCCCGGCGGCAGCAGCTGAGGGCGTTCAGGGCAGGGGCGCCCGAAATC")
    merged_truth = dna("CCACCCAAAGCCGCGGGCGCTGATGATGGGTGAGGAGGGGGCGGCAAGATTTCGGGCGCCCCTGCCCTGAACGCCCTCAGCTGCTGCCGCCGGGGCCGCTCCGGAGGCGGGAGCCGGTAGCCGAGCCGGGCGACCTAGAGAACGAGCGGGTCAGGCTCAGCGTCGGCCACTCTGTCGGTCCGCTGAATGAAGTG")
    return try_merge(r1, r2) == merged_truth
end

function test_overlap()
    r1 = dna("CCACCCAAAGCCGCGGGCGCTGATGATGGGTGAGGAGGGGGCGGCAAGATTTCGGGCGCCCCTGCCCTGAACGCCCTCAGCTGCTGCCGCCGGGGCCGCTCCGGAGGCGGGAGCCGGTAGCCGAGCCGGGCGACCTAGAGAACGAGCGCCC")
    r2 = dna("CGCTCGTTCTCTAGGTCGCCCGGCTCGGCTACCGGCTCCCGCCTCCGGAGCGGCCCCGGCGGCAGCAGCTGAGGGCGTTCAGGGCAGGGGCGCCCGAAATCTTGCCGCCCCCTCCTCACCCATCATCAGCGCCCGCGGCTTTGGGTGGTTT")
    offset, overlap_len, distance = overlap(r1, r2)
    return offset == -3 && distance == 0
end

@test test_merge()
@test test_overlap()