@@ -4,6 +4,10 @@ var mod = require('../../src/others/levenshtein-distance.js');
44var levenshteinDistance = mod . levenshteinDistance ;
55
66describe ( 'Levenstein\'s minimum edit distance algorithm' , function ( ) {
7+ it ( 'should be defined' , function ( ) {
8+ expect ( levenshteinDistance ) . toBeDefined ( ) ;
9+ } ) ;
10+
711 it ( '"" -> "" should return 0.' , function ( ) {
812 expect ( levenshteinDistance ( '' , '' ) ) . toBe ( 0 ) ;
913 } ) ;
@@ -20,6 +24,10 @@ describe('Levenstein\'s minimum edit distance algorithm', function () {
2024 expect ( levenshteinDistance ( 'Sofia' , 'Sof' ) ) . toBe ( 2 ) ;
2125 } ) ;
2226
27+ it ( '"kitten" -> "sitting" should return 3' , function ( ) {
28+ expect ( levenshteinDistance ( 'kitten' , 'sitting' ) ) . toBe ( 3 ) ;
29+ } ) ;
30+
2331 it ( '"google" -> "lookat" should return 4.' , function ( ) {
2432 expect ( levenshteinDistance ( 'google' , 'lookat' ) ) . toBe ( 4 ) ;
2533 } ) ;
@@ -39,4 +47,12 @@ describe('Levenstein\'s minimum edit distance algorithm', function () {
3947 it ( '"rosebud" -> "budrose" should return 6.' , function ( ) {
4048 expect ( levenshteinDistance ( 'rosebud' , 'budrose' ) ) . toBe ( 6 ) ;
4149 } ) ;
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+ } ) ;
4258} ) ;
0 commit comments