### ----------------------------------------------------
### -- Math::DistanceFunctions::Edit
### -- Licenses: Artistic-2.0
### -- Authors: Anton Antonov
### -- File: t/01-edit-distance.rakutest
### ----------------------------------------------------
use v6.d;

use lib <. lib>;
use Math::DistanceFunctions::Edit;

# Plan for 20 tests
use Test;
plan *;

# Define the pairs of words and their expected edit distances
my @test-cases = (
    ['kitten', 'sitting', 3],
    ['flaw', 'lawn', 2],
    ['intention', 'execution', 5],
    ['gumbo', 'gambol', 2],
    ['book', 'back', 2],
    ['saturday', 'sunday', 3],
    ['rosettacode', 'raisethysword', 8],
    ['abc', 'yabd', 2],
    ['abcdef', 'azced', 3],
    ['algorithm', 'altruistic', 6],
    ['distance', 'difference', 5],
    ['test', 'tent', 1],
    ['abcd', 'abdc', 1], # Single transposition
    ['abcdef', 'ghijkl', 6], # Completely different
    ['same', 'same', 0], # No difference
    ['similar', 'familiar', 3],
    ['example', 'samples', 3],
    ['levenshtein', 'frankenstein', 6],
    ['hamming', 'hammond', 2],
    ['raku', 'perl', 4]
);

# Run the tests
for @test-cases -> [$word1, $word2, $expected-distance] {
    is edit-distance($word1, $word2), $expected-distance, "edit-distance between '$word1' and '$word2' is $expected-distance";
}

done-testing;


