@@ -56,10 +56,9 @@ public void testEditDistance_OneEmptyString() {
5656 public void testEditDistance_OneEmptyString_Memoization () {
5757 int [][] storage = new int [1 ][6 ];
5858 assertAll ("String assertions" ,
59- ()
60- -> assertEquals (5 , EditDistance .editDistance ("" , "hello" , storage )),
61- () -> assertEquals (0 , storage [0 ][0 ]), () -> assertEquals (0 , storage [0 ][1 ]), () -> assertEquals (0 , storage [0 ][2 ]), () -> assertEquals (0 , storage [0 ][3 ]), () -> assertEquals (0 , storage [0 ][4 ]), () -> assertEquals (5 , storage [0 ][5 ])
62- );
59+ ()
60+ -> assertEquals (5 , EditDistance .editDistance ("" , "hello" , storage )),
61+ () -> assertEquals (0 , storage [0 ][0 ]), () -> assertEquals (0 , storage [0 ][1 ]), () -> assertEquals (0 , storage [0 ][2 ]), () -> assertEquals (0 , storage [0 ][3 ]), () -> assertEquals (0 , storage [0 ][4 ]), () -> assertEquals (5 , storage [0 ][5 ]));
6362 }
6463
6564 @ Test
@@ -72,27 +71,27 @@ public void testEditDistance_EqualStrings() {
7271 public void testEditDistance_EqualStrings_Memoization () {
7372 int [][] storage = new int [4 ][4 ];
7473 assertAll ("String assertions" ,
75- () ->
76- assertEquals (0 , EditDistance .editDistance ("abc" , "abc" , storage )),
77- () ->
78- assertEquals (0 , storage [0 ][0 ]),
79- () ->
80- assertEquals (0 , storage [0 ][1 ]),
81- () ->
82- assertEquals (0 , storage [0 ][2 ]),
83- () ->
84- assertEquals (0 , storage [0 ][3 ]),
85- () ->
86- assertEquals (0 , storage [1 ][0 ]),
87- () ->
88- assertEquals (0 , storage [1 ][1 ]),
89- () ->
90- assertEquals (0 , storage [1 ][2 ]),
91- () ->
92- assertEquals (0 , storage [1 ][3 ]),
93- () ->
94- assertEquals (0 , storage [2 ][0 ]),
95- () -> assertEquals (0 , storage [2 ][1 ]), () -> assertEquals (0 , storage [2 ][2 ]), () -> assertEquals (0 , storage [2 ][3 ]), () -> assertEquals (0 , storage [3 ][0 ]), () -> assertEquals (0 , storage [3 ][1 ]), () -> assertEquals (0 , storage [3 ][2 ]), () -> assertEquals (0 , storage [3 ][3 ])
74+ ()
75+ -> assertEquals (0 , EditDistance .editDistance ("abc" , "abc" , storage )),
76+ ()
77+ -> assertEquals (0 , storage [0 ][0 ]),
78+ ()
79+ -> assertEquals (0 , storage [0 ][1 ]),
80+ ()
81+ -> assertEquals (0 , storage [0 ][2 ]),
82+ ()
83+ -> assertEquals (0 , storage [0 ][3 ]),
84+ ()
85+ -> assertEquals (0 , storage [1 ][0 ]),
86+ ()
87+ -> assertEquals (0 , storage [1 ][1 ]),
88+ ()
89+ -> assertEquals (0 , storage [1 ][2 ]),
90+ ()
91+ -> assertEquals (0 , storage [1 ][3 ]),
92+ ()
93+ -> assertEquals (0 , storage [2 ][0 ]),
94+ () -> assertEquals (0 , storage [2 ][1 ]), () -> assertEquals (0 , storage [2 ][2 ]), () -> assertEquals (0 , storage [2 ][3 ]), () -> assertEquals (0 , storage [3 ][0 ]), () -> assertEquals (0 , storage [3 ][1 ]), () -> assertEquals (0 , storage [3 ][2 ]), () -> assertEquals (0 , storage [3 ][3 ])
9695 );
9796 }
9897
@@ -107,13 +106,13 @@ public void testEditDistance_OneCharacterDifference() {
107106 public void testEditDistance_OneCharacterDifference_Memoization () {
108107 int [][] storage = new int [3 ][3 ];
109108 assertAll ("All assertions" ,
110- () ->
111- assertEquals (1 , EditDistance .editDistance ("at" , "it" , storage )),
112- () ->
113- assertEquals (0 , storage [0 ][0 ]),
114- () ->
115- assertEquals (1 , storage [0 ][1 ]),
116- () -> assertEquals (2 , storage [0 ][2 ]), () -> assertEquals (1 , storage [1 ][0 ]), () -> assertEquals (0 , storage [1 ][1 ]), () -> assertEquals (1 , storage [1 ][2 ]), () -> assertEquals (2 , storage [2 ][0 ]), () -> assertEquals (1 , storage [2 ][1 ]), () -> assertEquals (1 , storage [2 ][2 ])
109+ ()
110+ -> assertEquals (1 , EditDistance .editDistance ("at" , "it" , storage )),
111+ ()
112+ -> assertEquals (0 , storage [0 ][0 ]),
113+ ()
114+ -> assertEquals (1 , storage [0 ][1 ]),
115+ () -> assertEquals (2 , storage [0 ][2 ]), () -> assertEquals (1 , storage [1 ][0 ]), () -> assertEquals (0 , storage [1 ][1 ]), () -> assertEquals (1 , storage [1 ][2 ]), () -> assertEquals (2 , storage [2 ][0 ]), () -> assertEquals (1 , storage [2 ][1 ]), () -> assertEquals (1 , storage [2 ][2 ])
117116 );
118117 }
119118
0 commit comments