From a52a91d6a96529dbefaae9f682af3a6025190e8d Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Fri, 5 Jun 2015 22:33:32 +0200 Subject: some things work --- src/test/scala/org/xapek/influxdb/AppTest.scala | 43 +++++++++++++++++++++++ src/test/scala/org/xapek/influxdb/SizedTest.scala | 23 ++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 src/test/scala/org/xapek/influxdb/AppTest.scala create mode 100644 src/test/scala/org/xapek/influxdb/SizedTest.scala (limited to 'src/test') 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) + } +} -- cgit v1.2.1