@@ -4,6 +4,10 @@ var mod = require('../../src/others/levenshtein-distance.js');
4
4
var levenshteinDistance = mod . levenshteinDistance ;
5
5
6
6
describe ( 'Levenstein\'s minimum edit distance algorithm' , function ( ) {
7
+ it ( 'should be defined' , function ( ) {
8
+ expect ( levenshteinDistance ) . toBeDefined ( ) ;
9
+ } ) ;
10
+
7
11
it ( '"" -> "" should return 0.' , function ( ) {
8
12
expect ( levenshteinDistance ( '' , '' ) ) . toBe ( 0 ) ;
9
13
} ) ;
@@ -20,6 +24,10 @@ describe('Levenstein\'s minimum edit distance algorithm', function () {
20
24
expect ( levenshteinDistance ( 'Sofia' , 'Sof' ) ) . toBe ( 2 ) ;
21
25
} ) ;
22
26
27
+ it ( '"kitten" -> "sitting" should return 3' , function ( ) {
28
+ expect ( levenshteinDistance ( 'kitten' , 'sitting' ) ) . toBe ( 3 ) ;
29
+ } ) ;
30
+
23
31
it ( '"google" -> "lookat" should return 4.' , function ( ) {
24
32
expect ( levenshteinDistance ( 'google' , 'lookat' ) ) . toBe ( 4 ) ;
25
33
} ) ;
@@ -39,4 +47,12 @@ describe('Levenstein\'s minimum edit distance algorithm', function () {
39
47
it ( '"rosebud" -> "budrose" should return 6.' , function ( ) {
40
48
expect ( levenshteinDistance ( 'rosebud' , 'budrose' ) ) . toBe ( 6 ) ;
41
49
} ) ;
50
+
51
+ it ( '"decided" -> "decisive" should return 4.' , function ( ) {
52
+ expect ( levenshteinDistance ( 'decided' , 'decisive' ) ) . toBe ( 4 ) ;
53
+ } ) ;
54
+
55
+ it ( '"similar" -> "simile" should return 2.' , function ( ) {
56
+ expect ( levenshteinDistance ( 'similar' , 'simile' ) ) . toBe ( 2 ) ;
57
+ } ) ;
42
58
} ) ;