aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/old/vlib/strings/similarity_test.v
blob: 965da450cd89f48e0b0494bd2e9c7eeca0023eac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import strings

fn test_levenshtein_distance() {
	assert strings.levenshtein_distance('', '') == 0
	assert strings.levenshtein_distance('one', 'one') == 0
	assert strings.levenshtein_distance('', 'two') == 3
	assert strings.levenshtein_distance('three', '') == 5
	assert strings.levenshtein_distance('bananna', '') == 7
	assert strings.levenshtein_distance('cats', 'hats') == 1
	assert strings.levenshtein_distance('hugs', 'shrugs') == 2
	assert strings.levenshtein_distance('broom', 'shroom') == 2
	assert strings.levenshtein_distance('flomax', 'volmax') == 3
}