Skip to content

Commit

Permalink
13.12-13.13
Browse files Browse the repository at this point in the history
  • Loading branch information
gardncl committed Apr 30, 2017
1 parent e757379 commit 2760ddf
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
22 changes: 22 additions & 0 deletions hashtables/src/test/java/CollatzConjectureTest.java
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 hashtables/src/test/java/ComputeStringDecompositionsTest.java
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));
}
}

0 comments on commit 2760ddf

Please sign in to comment.