You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@griffin.apache.org by gu...@apache.org on 2018/06/15 07:28:48 UTC

incubator-griffin git commit: ut of timerange

Repository: incubator-griffin
Updated Branches:
  refs/heads/master b9e0743ff -> 0e34cc243


ut of timerange

Author: Lionel Liu <bh...@163.com>
Author: dodobel <12...@qq.com>

Closes #306 from bhlx3lyx7/spark2.


Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/0e34cc24
Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/0e34cc24
Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/0e34cc24

Branch: refs/heads/master
Commit: 0e34cc24333517ca6cb6f27c8623392fbdd04e78
Parents: b9e0743
Author: Lionel Liu <bh...@163.com>
Authored: Fri Jun 15 15:28:42 2018 +0800
Committer: William Guo <gu...@apache.org>
Committed: Fri Jun 15 15:28:42 2018 +0800

----------------------------------------------------------------------
 .../griffin/measure/context/TimeRangeTest.scala | 41 ++++++++++++++++++++
 1 file changed, 41 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/0e34cc24/measure/src/test/scala/org/apache/griffin/measure/context/TimeRangeTest.scala
----------------------------------------------------------------------
diff --git a/measure/src/test/scala/org/apache/griffin/measure/context/TimeRangeTest.scala b/measure/src/test/scala/org/apache/griffin/measure/context/TimeRangeTest.scala
new file mode 100644
index 0000000..7184cf7
--- /dev/null
+++ b/measure/src/test/scala/org/apache/griffin/measure/context/TimeRangeTest.scala
@@ -0,0 +1,41 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+package org.apache.griffin.measure.context
+
+import org.scalatest._
+
+class TimeRangeTest extends FlatSpec with Matchers {
+
+  "time range" should "be able to merge another time range" in {
+    val tr1 = TimeRange(1, 10, Set(2, 5, 8))
+    val tr2 = TimeRange(4, 15, Set(5, 6, 13, 7))
+    tr1.merge(tr2) should be (TimeRange(1, 15, Set(2, 5, 6, 7, 8, 13)))
+  }
+
+  it should "get minimum timestamp in not-empty timestamp set" in {
+    val tr = TimeRange(1, 10, Set(2, 5, 8))
+    tr.minTmstOpt should be (Some(2))
+  }
+
+  it should "not get minimum timestamp in empty timestamp set" in {
+    val tr = TimeRange(1, 10, Set[Long]())
+    tr.minTmstOpt should be (None)
+  }
+
+}