Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3eb360a
commit 2341b38
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- Unit tests | ||
-- | ||
-- Everything run together should output 1. When 0, a test failed. In that case | ||
-- run logically-independent groups of assertions to spot the bug. | ||
|
||
-- levenshtein | ||
select 0 = levenshtein(null, null) union | ||
select 0 = levenshtein(null, '') union | ||
select 0 = levenshtein('', null) union | ||
select 0 = levenshtein('', '') union | ||
|
||
|
||
-- levenshtein_k | ||
select 0 = levenshtein_k(null, null, 0) union | ||
select 0 = levenshtein_k(null, '', 0) union | ||
select 0 = levenshtein_k('', null, 0) union | ||
select 0 = levenshtein_k('', '', 0) union | ||
|
||
select 0 = levenshtein_k('p', 'p', 0) union | ||
select 1 = levenshtein_k('p', 'c', 0) union | ||
select 2 = levenshtein_k('aa', 'bb', 2) union | ||
select 2 = levenshtein_k('aa', 'bb', 999) union | ||
select 2 = levenshtein_k('aa', 'bb', 1) union | ||
select 2 = levenshtein_k('aa', 'bbbb', 1) union | ||
|
||
|
||
-- levenshtein_ratio | ||
select 0 = levenshtein_ratio(null, null) union | ||
select 0 = levenshtein_ratio(null, '') union | ||
select 0 = levenshtein_ratio('', null) union | ||
select 0 = levenshtein_ratio('', '') |