-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class CollatzConjectureTest { | ||
|
||
private boolean expected; | ||
private int n; | ||
|
||
@Test | ||
public void testCollatzConjecture() throws Exception { | ||
expected = true; | ||
n = 10000; | ||
|
||
test(expected, n); | ||
} | ||
|
||
private void test(boolean expected, int n) { | ||
assertEquals(expected, CollatzConjecture.testCollatzConjecture(n)); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
hashtables/src/test/java/ComputeStringDecompositionsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import org.junit.Test; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class ComputeStringDecompositionsTest { | ||
|
||
private List<String> expected; | ||
private String s; | ||
private List<String> words; | ||
|
||
@Test | ||
public void findAllSubstring1() throws Exception { | ||
expected = Arrays.asList( | ||
"aplanacan", | ||
"canaplana" | ||
); | ||
s = "amanaplanacanalcanaplanaalpmna"; | ||
words = Arrays.asList( | ||
"can", | ||
"apl", | ||
"ana" | ||
); | ||
|
||
test(expected, s, words); | ||
} | ||
|
||
private void test(List<String> expected, String s, List<String> words) { | ||
AssertUtils.assertSameContents(expected, ComputeStringDecompositions.findAllSubstring(s, words)); | ||
} | ||
} |