-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestRecursion.java
More file actions
42 lines (34 loc) · 1.09 KB
/
TestRecursion.java
File metadata and controls
42 lines (34 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.ArrayList;
import org.junit.Test;
public class TestRecursion {
@Test
public void junk() {
String a = "c";
int x = a.length() -1;
String sub = a.substring(1);
System.out.println(sub);
}
@Test
public void TestReverseString() {
String s = "hello";
var expected = ("olleh");
var actual = new recursion().ReverseString(s).toString();
assertEquals( expected, actual);
}
@Test
public void TestTowerOfHanoi() {
int n = 3,from = 1,aux = 2,to = 3;
ArrayList<String> expected = new ArrayList<String>();
expected.add("1,3");
expected.add("1,2");
expected.add("3,2");
expected.add("1,3");
expected.add("2,1");
expected.add("2,3");
expected.add("1,3");
var actual = recursion.TowerOfHanoi(n, from, aux, to, new ArrayList<String>());
assertArrayEquals(expected.toArray(), actual.toArray());
}
}