File: 03-word-lists.t

package info (click to toggle)
libtext-levenshtein-perl 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid, stretch
  • size: 148 kB
  • ctags: 6
  • sloc: perl: 460; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 417 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!perl

use strict;
use warnings;
use Test::More 0.88;
use Text::Levenshtein qw/ distance /;

my @TESTS = (
    ['pink', ['pink', 'pine', 'pork', ''], [0, 1, 2, 4]],
    ['',     [' ', '', '42', 'marvin'],    [1, 0, 2, 6]],
);

plan tests => int(@TESTS);

foreach my $test (@TESTS) {
    my ($word, $listref, $resultref) = @$test;
    my @results = distance($word, @$listref);
    is_deeply(\@results, $resultref);
}