[groovy] branch master updated: Add more tests

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[groovy] branch master updated: Add more tests

Daniel.Sun
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 3fffff3  Add more tests
3fffff3 is described below

commit 3fffff314c8260da34455cddb4c49dad876d5efa
Author: Daniel Sun <[hidden email]>
AuthorDate: Sat Nov 21 22:31:58 2020 +0800

    Add more tests
---
 .../runtime/QueryableCollectionTest.groovy         | 48 ++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/subprojects/groovy-ginq/src/test/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollectionTest.groovy b/subprojects/groovy-ginq/src/test/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollectionTest.groovy
index f3fc0f1..e37720a 100644
--- a/subprojects/groovy-ginq/src/test/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollectionTest.groovy
+++ b/subprojects/groovy-ginq/src/test/groovy/org/apache/groovy/ginq/provider/collection/runtime/QueryableCollectionTest.groovy
@@ -56,6 +56,14 @@ class QueryableCollectionTest {
     }
 
     @Test
+    void testInnerJoin2() {
+        def nums1 = [1, 2, 3].stream()
+        def nums2 = [2, 3, 4].stream()
+        def result = from(nums1).innerJoin(from(nums2), (a, b) -> a == b).toList()
+        assert [[2, 2], [3, 3]] == result
+    }
+
+    @Test
     void testLeftJoin0() {
         def nums1 = [1, 2, 3]
         def nums2 = [1, 2, 3]
@@ -216,6 +224,22 @@ class QueryableCollectionTest {
     }
 
     @Test
+    void testLeftJoin10() {
+        def nums1 = [1, 2, 3].stream()
+        def nums2 = [1, 2, 3].stream()
+        def result = from(nums1).leftJoin(from(nums2), (a, b) -> a == b).toList()
+        assert [[1, 1], [2, 2], [3, 3]] == result
+    }
+
+    @Test
+    void testRightJoin10() {
+        def nums2 = [1, 2, 3].stream()
+        def nums1 = [1, 2, 3].stream()
+        def result = from(nums1).rightJoin(from(nums2), (a, b) -> a == b).toList()
+        assert [[1, 1], [2, 2], [3, 3]] == result
+    }
+
+    @Test
     void testFullJoin() {
         def nums1 = [1, 2, 3]
         def nums2 = [2, 3, 4]
@@ -232,6 +256,14 @@ class QueryableCollectionTest {
     }
 
     @Test
+    void testCrossJoin2() {
+        def nums1 = [1, 2, 3].stream()
+        def nums2 = [3, 4, 5].stream()
+        def result = from(nums1).crossJoin(from(nums2)).toList()
+        assert [[1, 3], [1, 4], [1, 5], [2, 3], [2, 4], [2, 5], [3, 3], [3, 4], [3, 5]] == result
+    }
+
+    @Test
     void testWhere() {
         def nums = [1, 2, 3, 4, 5]
         def result = from(nums).where(e -> e > 3).toList()
@@ -407,6 +439,14 @@ class QueryableCollectionTest {
     }
 
     @Test
+    void testIntersect2() {
+        def nums1 = [1, 2, 2, 3].stream()
+        def nums2 = [2, 3, 3, 4].stream()
+        def result = from(nums1).intersect(from(nums2)).toList()
+        assert [2, 3] == result
+    }
+
+    @Test
     void testMinus() {
         def nums1 = [1, 1, 2, 3]
         def nums2 = [2, 3, 4]
@@ -415,6 +455,14 @@ class QueryableCollectionTest {
     }
 
     @Test
+    void testMinus2() {
+        def nums1 = [1, 1, 2, 3].stream()
+        def nums2 = [2, 3, 4].stream()
+        def result = from(nums1).minus(from(nums2)).toList()
+        assert [1] == result
+    }
+
+    @Test
     void testFromWhereLimitSelect() {
         def nums1 = [1, 2, 3, 4, 5]
         def nums2 = [0, 1, 2, 3, 4, 5, 6]

Apache Groovy committer & PMC member

Blog: http://blog.sunlan.me
Twitter: @daniel_sun