diff options
Diffstat (limited to 'src/test/scala/org/xapek')
-rw-r--r-- | src/test/scala/org/xapek/influxdb/AppTest.scala | 43 | ||||
-rw-r--r-- | src/test/scala/org/xapek/influxdb/SizedTest.scala | 23 |
2 files changed, 66 insertions, 0 deletions
diff --git a/src/test/scala/org/xapek/influxdb/AppTest.scala b/src/test/scala/org/xapek/influxdb/AppTest.scala new file mode 100644 index 0000000..26ed08f --- /dev/null +++ b/src/test/scala/org/xapek/influxdb/AppTest.scala @@ -0,0 +1,43 @@ +package org.xapek.influxdb + +import org.junit._ +import Assert._ +import org.xapek.influxdb.Influxdb._ + +@Test +class AppTest { + + @Test + def testStatements() = { + assertTrue((Influxdb SELECT "foo" FROM "bla" WHERE col("a") == "asd") + .toString().contains("as")) + + assertTrue((Influxdb SELECT List("foo", "bla") FROM "bla" WHERE col("a") == "asd") + .toString().contains("foo")) + + assertTrue((Influxdb SELECT List("foo", "bla") FROM "bla" WHERE col("a") == 1) + .toString().contains("== 1")) + + assertTrue((Influxdb + SELECT col("foo") + FROM "bla" + WHERE col("a") == "asd" || col("b") == "C" && col("c") == "d").toString().contains("bla")) + + assertTrue((Influxdb + SELECT "foo" + FROM "bla" + WHERE (col("a") == "asd" || col("b") == "C") && col("c") == "d").toString().contains("foo")) + + assertTrue((Influxdb + SELECT "foo" + FROM "bla" + WHERE (col("a") == "asd" || col("b") == "C") && col("c") == "d" + GROUP_BY "asd").toString().contains("GROUP BY")) + + assertTrue((Influxdb + SELECT col("foo") + FROM "bla" + WHERE (col("a") == "asd" || col("b") == "C") && col("c") == "d" + GROUP_BY "asd" <<= "asd2").toString().contains("asd2")) + } +} diff --git a/src/test/scala/org/xapek/influxdb/SizedTest.scala b/src/test/scala/org/xapek/influxdb/SizedTest.scala new file mode 100644 index 0000000..5f51e91 --- /dev/null +++ b/src/test/scala/org/xapek/influxdb/SizedTest.scala @@ -0,0 +1,23 @@ +package org.xapek.influxdb + +import org.junit._ +import org.junit.Assert._ +import org.xapek.influxdb.Influxdb._ + +@Test +class SizedTest { + @Test + def testStatements() = { + val s1 = SizedOp.wrap("abc") + assertEquals(1, SizedOp.count(s1)) + assertEquals(List("abc"), s1.unsized) + + val s2 = SizedOp.add(s1, "cde") + assertEquals(2, SizedOp.count(s2)) + assertEquals(List("abc", "cde"), s2.unsized) + + val s3 = SizedOp.add(s2, "fgh") + assertEquals(SizedOp.count(s3), 3) + assertEquals(List("abc", "cde", "fgh"), s3.unsized) + } +} |