11package com .thealgorithms .dynamicprogramming ;
22
3- import static org .junit .jupiter .api .Assertions .*;
43import static org .junit .jupiter .api .Assertions .assertAll ;
4+ import static org .junit .jupiter .api .Assertions .assertEquals ;
5+ import static org .junit .jupiter .api .Assertions .assertThrows ;
56
67import org .junit .jupiter .api .Test ;
78import org .junit .jupiter .params .ParameterizedTest ;
@@ -35,25 +36,25 @@ void testEditDistanceStringEmpty() {
3536 }
3637
3738 @ Test
38- void testEditDistance_NullValue () {
39+ void testEditDistanceNullValue () {
3940 assertThrows (NullPointerException .class , () -> { EditDistance .editDistance (null , "hello" ); });
4041 assertThrows (NullPointerException .class , () -> { EditDistance .editDistance ("hello" , null ); });
4142 assertThrows (NullPointerException .class , () -> { EditDistance .editDistance (null , null ); });
4243 }
4344
4445 @ Test
45- public void testEditDistance_BothEmptyStrings () {
46+ public void testEditDistanceBothEmptyStrings () {
4647 assertEquals (0 , EditDistance .editDistance ("" , "" ));
4748 }
4849
4950 @ Test
50- public void testEditDistance_OneEmptyString () {
51+ public void testEditDistanceOneEmptyString () {
5152 assertEquals (5 , EditDistance .editDistance ("" , "hello" ));
5253 assertEquals (7 , EditDistance .editDistance ("worldly" , "" ));
5354 }
5455
5556 @ Test
56- public void testEditDistance_OneEmptyString_Memoization () {
57+ public void testEditDistanceOneEmptyStringMemoization () {
5758 int [][] storage = new int [1 ][6 ];
5859 assertAll ("String assertions" ,
5960 ()
@@ -62,13 +63,13 @@ public void testEditDistance_OneEmptyString_Memoization() {
6263 }
6364
6465 @ Test
65- public void testEditDistance_EqualStrings () {
66+ public void testEditDistanceEqualStrings () {
6667 assertEquals (0 , EditDistance .editDistance ("test" , "test" ));
6768 assertEquals (0 , EditDistance .editDistance ("abc" , "abc" ));
6869 }
6970
7071 @ Test
71- public void testEditDistance_EqualStrings_Memoization () {
72+ public void testEditDistanceEqualStringsMemoization () {
7273 int [][] storage = new int [4 ][4 ];
7374 assertAll ("String assertions" ,
7475 ()
@@ -95,14 +96,14 @@ public void testEditDistance_EqualStrings_Memoization() {
9596 }
9697
9798 @ Test
98- public void testEditDistance_OneCharacterDifference () {
99+ public void testEditDistanceOneCharacterDifference () {
99100 assertEquals (1 , EditDistance .editDistance ("cat" , "bat" ));
100101 assertEquals (1 , EditDistance .editDistance ("cat" , "cats" ));
101102 assertEquals (1 , EditDistance .editDistance ("cats" , "cat" ));
102103 }
103104
104105 @ Test
105- public void testEditDistance_OneCharacterDifference_Memoization () {
106+ public void testEditDistanceOneCharacterDifferenceMemoization () {
106107 int [][] storage = new int [3 ][3 ];
107108 assertAll ("All assertions" ,
108109 ()
@@ -115,14 +116,14 @@ public void testEditDistance_OneCharacterDifference_Memoization() {
115116 }
116117
117118 @ Test
118- public void testEditDistance_GeneralCases () {
119+ public void testEditDistanceGeneralCases () {
119120 assertEquals (3 , EditDistance .editDistance ("kitten" , "sitting" ));
120121 assertEquals (2 , EditDistance .editDistance ("flaw" , "lawn" ));
121122 assertEquals (5 , EditDistance .editDistance ("intention" , "execution" ));
122123 }
123124
124125 @ Test
125- public void testEditDistance_GeneralCases_Memoization () {
126+ public void testEditDistanceGeneralCasesMemoization () {
126127 int [][] storage = new int [7 ][8 ];
127128 assertEquals (3 , EditDistance .editDistance ("kitten" , "sitting" , storage ));
128129 assertAll ("All assertions" , () -> assertEquals (0 , storage [0 ][0 ]), () -> assertEquals (3 , storage [6 ][7 ]));
0 commit comments