diff options
| author | Ben Culkin <scorpress@gmail.com> | 2020-03-27 16:39:52 -0400 |
|---|---|---|
| committer | Ben Culkin <scorpress@gmail.com> | 2020-03-27 16:39:52 -0400 |
| commit | 373464d30d87bd8702fe27b920ed1406a0833ef3 (patch) | |
| tree | c357c0a4fdd8f3f6ea8eb812ddc853f263c6c550 /base/src/test/java/bjc/utils/data | |
| parent | e99f6c758c9e1ea5601e1076845912db5153e38c (diff) | |
Refactor test structure
Tests are now in a 'test' sub-package, so it is clear that they are
indeed test code, not just disjoint parts of the main code
Diffstat (limited to 'base/src/test/java/bjc/utils/data')
3 files changed, 0 insertions, 156 deletions
diff --git a/base/src/test/java/bjc/utils/data/BooleanToggleTest.java b/base/src/test/java/bjc/utils/data/BooleanToggleTest.java deleted file mode 100644 index 66f44c0..0000000 --- a/base/src/test/java/bjc/utils/data/BooleanToggleTest.java +++ /dev/null @@ -1,36 +0,0 @@ -package bjc.utils.data; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; - -/** - * Test for boolean toggles. - * @author bjculkin - * - */ -public class BooleanToggleTest { - - /** - * Test that boolean toggles work right. - */ - @Test - public void test() { - BooleanToggle tog = new BooleanToggle(); - - // Check initial value is false. - assertEquals(false, tog.peek()); - // Check that 'get' returns the old value - assertEquals(false, tog.get()); - // Check that 'get' swaps the value - assertEquals(true, tog.peek()); - // Check that we can round-trip back. - assertEquals(true, tog.get()); - assertEquals(false, tog.peek()); - - tog.set(true); - - // Check set works - assertEquals(true, tog.peek()); - } -} diff --git a/base/src/test/java/bjc/utils/data/CircularIteratorTest.java b/base/src/test/java/bjc/utils/data/CircularIteratorTest.java deleted file mode 100644 index 5e20a17..0000000 --- a/base/src/test/java/bjc/utils/data/CircularIteratorTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package bjc.utils.data; - -import static bjc.utils.funcutils.TestUtils.assertIteratorEquals; - -import java.util.Arrays; -import java.util.List; - -import org.junit.Test; - -/** - * Test for circular iterators., - * - * @author bjculkin - * - */ -public class CircularIteratorTest { - - /** - * Test regular repetition of the entire iterator. - */ - @Test - public void testRegular() { - List<String> lst = Arrays.asList("a", "b", "c"); - - CircularIterator<String> itr = new CircularIterator<>(lst); - - // Check we get initial values correctly, and have more remaining - assertIteratorEquals(true, itr, "a", "b", "c"); - - // Check we repeat correctly, and can still repeat - assertIteratorEquals(true, itr, "a", "b", "c"); - } - - /** - * Test that the last element repeats correctly. - */ - @Test - public void testRepLast() { - List<String> lst = Arrays.asList("a", "b", "c"); - - CircularIterator<String> itr = new CircularIterator<>(lst, false); - - // Check we get initial values correctly, and have more remaining - assertIteratorEquals(true, itr, "a", "b", "c"); - - // Check we repeat correctly, and can still repeat - assertIteratorEquals(true, itr, "c", "c", "c"); - } -} diff --git a/base/src/test/java/bjc/utils/data/QueuedIteratorTest.java b/base/src/test/java/bjc/utils/data/QueuedIteratorTest.java deleted file mode 100644 index bbbca56..0000000 --- a/base/src/test/java/bjc/utils/data/QueuedIteratorTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package bjc.utils.data; - -import static bjc.utils.data.QueuedIterator.queued; -import static bjc.utils.funcutils.TestUtils.assertIteratorEquals; -import static java.util.Arrays.asList; - -import org.junit.Test; - -/** - * Test of QueuedIterator. - * - * @author bjculkin - * - */ -public class QueuedIteratorTest { - - /** - * Test of functionality. - */ - @Test - public void test() { - assertIteratorEquals(false, queued()); - - assertIteratorEquals(false, queued(1, 2, 3), 1, 2, 3); - assertIteratorEquals(false, queued(asList(1, 2, 3), asList(3, 2, 1)), 1, 2, 3, 3, 2, 1); - - } - - /** - * Test of before() method. - */ - @Test - public void testBefore() { - QueuedIterator<Integer> itr = queued(1, 2, 3); - - assertIteratorEquals(true, itr, 1, 2); - - itr.before(1, 2, 3); - - assertIteratorEquals(false, itr, 1, 2, 3, 3); - } - - /** - * Test of after() method. - */ - @Test - public void testAfter() { - QueuedIterator<Integer> itr = queued(1, 2, 3); - - assertIteratorEquals(true, itr, 1, 2); - - itr.after(1, 2, 3); - - assertIteratorEquals(false, itr, 3, 1, 2, 3); - } - - /** - * Test of last() method. - */ - @Test - public void testLast() { - QueuedIterator<Integer> itr = queued(1, 2, 3); - - assertIteratorEquals(true, itr, 1, 2); - - itr.after(4); - itr.last(1, 2, 3); - - assertIteratorEquals(false, itr, 3, 4, 1, 2, 3); - } -} |
