You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@crunch.apache.org by jw...@apache.org on 2012/08/08 02:47:05 UTC
[1/10] git commit: Move over scrunch unit tests
Updated Branches:
refs/heads/master a92a523fb -> 7971c86d6
Move over scrunch unit tests
Project: http://git-wip-us.apache.org/repos/asf/incubator-crunch/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-crunch/commit/7971c86d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-crunch/tree/7971c86d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-crunch/diff/7971c86d
Branch: refs/heads/master
Commit: 7971c86d6132fa3c406d3db790d7170fb924b70c
Parents: dfd2892
Author: jwills <jw...@apache.org>
Authored: Tue Aug 7 12:05:24 2012 -0700
Committer: jwills <jw...@apache.org>
Committed: Tue Aug 7 12:05:24 2012 -0700
----------------------------------------------------------------------
.../org/apache/crunch/scrunch/CrossJoinTest.scala | 61 +++++++++++++++
.../org/apache/crunch/scrunch/MapKeysFnTest.scala | 36 +++++++++
.../scala/org/apache/scrunch/CrossJoinTest.scala | 61 ---------------
.../scala/org/apache/scrunch/MapKeysFnTest.scala | 36 ---------
4 files changed, 97 insertions(+), 97 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/7971c86d/crunch-scrunch/src/test/scala/org/apache/crunch/scrunch/CrossJoinTest.scala
----------------------------------------------------------------------
diff --git a/crunch-scrunch/src/test/scala/org/apache/crunch/scrunch/CrossJoinTest.scala b/crunch-scrunch/src/test/scala/org/apache/crunch/scrunch/CrossJoinTest.scala
new file mode 100644
index 0000000..6cc5ae9
--- /dev/null
+++ b/crunch-scrunch/src/test/scala/org/apache/crunch/scrunch/CrossJoinTest.scala
@@ -0,0 +1,61 @@
+/**
+ * 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.crunch.scrunch
+
+import org.scalatest.junit.JUnitSuite
+import _root_.org.junit.Test
+
+class CrossJoinTest extends JUnitSuite {
+
+ @Test
+ def testCrossCollection() {
+ val testCases = List(Array(1,2,3,4,5), Array(6,7,8), Array.empty[Int])
+ val testCasePairs = testCases flatMap {test1 => testCases map {test2 => (test1,test2)}}
+
+ for ((test1, test2) <- testCasePairs) {
+ val X = Mem.collectionOf(test1: _*)
+ val Y = Mem.collectionOf(test2: _*)
+ val cross = X.cross(Y)
+
+ val crossSet = cross.materialize().toSet
+
+ assert(crossSet.size == test1.size * test2.size)
+ assert(test1.flatMap(t1 => test2.map(t2 => crossSet.contains((t1, t2)))).forall(_ == true))
+
+ }
+ }
+
+ @Test
+ def testCrossTable() {
+ val testCases = List(Array((1,2),(3,4),(5,6)), Array((7,8),(9,10)), Array.empty[(Int,Int)])
+ val testCasePairs = testCases flatMap {test1 => testCases map {test2 => (test1,test2)}}
+
+ for ((test1, test2) <- testCasePairs) {
+ val X = Mem.tableOf(test1)
+ val Y = Mem.tableOf(test2)
+ val cross = X.cross(Y)
+
+ val crossSet = cross.materializeToMap().toSet
+ val actualCross = test1.flatMap(t1 => test2.map(t2 => ((t1._1, t2._1), (t1._2, t2._2))))
+
+ assert(crossSet.size == test1.size * test2.size)
+ assert(actualCross.map(crossSet.contains(_)).forall(_ == true))
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/7971c86d/crunch-scrunch/src/test/scala/org/apache/crunch/scrunch/MapKeysFnTest.scala
----------------------------------------------------------------------
diff --git a/crunch-scrunch/src/test/scala/org/apache/crunch/scrunch/MapKeysFnTest.scala b/crunch-scrunch/src/test/scala/org/apache/crunch/scrunch/MapKeysFnTest.scala
new file mode 100644
index 0000000..552eac4
--- /dev/null
+++ b/crunch-scrunch/src/test/scala/org/apache/crunch/scrunch/MapKeysFnTest.scala
@@ -0,0 +1,36 @@
+/**
+ * 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.crunch.scrunch
+
+import _root_.org.scalatest.junit.JUnitSuite
+import _root_.org.junit.Test
+
+class MapKeysFnTest extends JUnitSuite {
+
+ @Test
+ def testMapKeys() {
+ val orig = Mem.tableOf(1 -> "a", 2 -> "b", 3 -> "c")
+ val inc = orig.mapKeys(_ + 1)
+
+ assert(
+ inc.keys.materialize
+ .zip(orig.keys.materialize)
+ .forall(x => x._1 == x._2 + 1))
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/7971c86d/scrunch/src/test/scala/org/apache/scrunch/CrossJoinTest.scala
----------------------------------------------------------------------
diff --git a/scrunch/src/test/scala/org/apache/scrunch/CrossJoinTest.scala b/scrunch/src/test/scala/org/apache/scrunch/CrossJoinTest.scala
deleted file mode 100644
index bbbf849..0000000
--- a/scrunch/src/test/scala/org/apache/scrunch/CrossJoinTest.scala
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.scrunch
-
-import org.scalatest.junit.JUnitSuite
-import _root_.org.junit.Test
-
-class CrossJoinTest extends JUnitSuite {
-
- @Test
- def testCrossCollection() {
- val testCases = List(Array(1,2,3,4,5), Array(6,7,8), Array.empty[Int])
- val testCasePairs = testCases flatMap {test1 => testCases map {test2 => (test1,test2)}}
-
- for ((test1, test2) <- testCasePairs) {
- val X = Mem.collectionOf(test1: _*)
- val Y = Mem.collectionOf(test2: _*)
- val cross = X.cross(Y)
-
- val crossSet = cross.materialize().toSet
-
- assert(crossSet.size == test1.size * test2.size)
- assert(test1.flatMap(t1 => test2.map(t2 => crossSet.contains((t1, t2)))).forall(_ == true))
-
- }
- }
-
- @Test
- def testCrossTable() {
- val testCases = List(Array((1,2),(3,4),(5,6)), Array((7,8),(9,10)), Array.empty[(Int,Int)])
- val testCasePairs = testCases flatMap {test1 => testCases map {test2 => (test1,test2)}}
-
- for ((test1, test2) <- testCasePairs) {
- val X = Mem.tableOf(test1)
- val Y = Mem.tableOf(test2)
- val cross = X.cross(Y)
-
- val crossSet = cross.materializeToMap().toSet
- val actualCross = test1.flatMap(t1 => test2.map(t2 => ((t1._1, t2._1), (t1._2, t2._2))))
-
- assert(crossSet.size == test1.size * test2.size)
- assert(actualCross.map(crossSet.contains(_)).forall(_ == true))
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-crunch/blob/7971c86d/scrunch/src/test/scala/org/apache/scrunch/MapKeysFnTest.scala
----------------------------------------------------------------------
diff --git a/scrunch/src/test/scala/org/apache/scrunch/MapKeysFnTest.scala b/scrunch/src/test/scala/org/apache/scrunch/MapKeysFnTest.scala
deleted file mode 100644
index 011a1b4..0000000
--- a/scrunch/src/test/scala/org/apache/scrunch/MapKeysFnTest.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.scrunch
-
-import _root_.org.scalatest.junit.JUnitSuite
-import _root_.org.junit.Test
-
-class MapKeysFnTest extends JUnitSuite {
-
- @Test
- def testMapKeys() {
- val orig = Mem.tableOf(1 -> "a", 2 -> "b", 3 -> "c")
- val inc = orig.mapKeys(_ + 1)
-
- assert(
- inc.keys.materialize
- .zip(orig.keys.materialize)
- .forall(x => x._1 == x._2 + 1))
- }
-
-}
\ No newline at end of file