summaryrefslogtreecommitdiff
path: root/src/test/java/io/github/bculkin2442/data/BooleanToggleTest.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2019-07-02 18:05:22 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2019-07-02 18:05:22 -0400
commit843329de434bb334d90927c4d22345373a388530 (patch)
treeb0ad1f764bd29ff43841e1095a5b58194c20cb37 /src/test/java/io/github/bculkin2442/data/BooleanToggleTest.java
parentac36f171a3cebb0993cc28548635e3f654f8e325 (diff)
Rename package root
The package root is now bjc, not io.github.bculkin2442.
Diffstat (limited to 'src/test/java/io/github/bculkin2442/data/BooleanToggleTest.java')
-rw-r--r--src/test/java/io/github/bculkin2442/data/BooleanToggleTest.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/test/java/io/github/bculkin2442/data/BooleanToggleTest.java b/src/test/java/io/github/bculkin2442/data/BooleanToggleTest.java
new file mode 100644
index 0000000..8211117
--- /dev/null
+++ b/src/test/java/io/github/bculkin2442/data/BooleanToggleTest.java
@@ -0,0 +1,38 @@
+package io.github.bculkin2442.data;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import bjc.data.BooleanToggle;
+
+/**
+ * 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());
+ }
+}