You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/12/12 09:18:52 UTC

[groovy] branch master updated: Add more tests

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 d84147a  Add more tests
d84147a is described below

commit d84147ab167feb70c62099415fa6ad9f90144c73
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Dec 12 17:10:06 2020 +0800

    Add more tests
---
 .../runtime/QueryableCollectionTest.groovy         | 123 +++++++++++++++++++++
 1 file changed, 123 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 1613556..93e64ac 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
@@ -104,6 +104,32 @@ class QueryableCollectionTest {
     }
 
     @Test
+    void testInnerJoin8() {
+        def nums1 = [].stream()
+        def nums2 = [2, 3, 4].stream()
+        def result = from(nums1).innerJoin(from(nums2), (a, b) -> a == b).toList()
+        assert [] == result
+    }
+
+    @Test
+    @CompileDynamic
+    void testInnerJoin9() {
+        def nums1 = [2, 3, 4].stream()
+        def nums2 = [].stream()
+        def result = from(nums1).innerJoin(from(nums2), (a, b) -> a == b).toList()
+        assert [] == result
+    }
+
+    @Test
+    @CompileDynamic
+    void testInnerJoin10() {
+        def nums1 = [].stream()
+        def nums2 = [].stream()
+        def result = from(nums1).innerJoin(from(nums2), (a, b) -> a == b).toList()
+        assert [] == result
+    }
+
+    @Test
     void testInnerHashJoin0() {
         def nums1 = [1, 2, 3]
         def nums2 = [1, 2, 3]
@@ -168,6 +194,32 @@ class QueryableCollectionTest {
     }
 
     @Test
+    void testInnerHashJoin8() {
+        def nums1 = []
+        def nums2 = [2, 3, 4]
+        def result = from(nums1).innerHashJoin(from(nums2), a -> a, b -> b).toList()
+        assert [] == result
+    }
+
+    @Test
+    @CompileDynamic
+    void testInnerHashJoin9() {
+        def nums1 = [2, 3, 4]
+        def nums2 = []
+        def result = from(nums1).innerHashJoin(from(nums2), a -> a, b -> b).toList()
+        assert [] == result
+    }
+
+    @Test
+    @CompileDynamic
+    void testInnerHashJoin10() {
+        def nums1 = []
+        def nums2 = []
+        def result = from(nums1).innerHashJoin(from(nums2), a -> a, b -> b).toList()
+        assert [] == result
+    }
+
+    @Test
     void testLeftJoin0() {
         def nums1 = [1, 2, 3]
         def nums2 = [1, 2, 3]
@@ -343,6 +395,41 @@ class QueryableCollectionTest {
         assert [[1, 1], [2, 2], [3, 3]] == result
     }
 
+    @Test
+    @CompileDynamic
+    void testLeftJoin11() {
+        def nums1 = [1, 2, 3]
+        def nums2 = []
+        def result = from(nums1).leftJoin(from(nums2), (a, b) -> a == b).toList()
+        assert [[1, null], [2, null], [3, null]] == result
+    }
+
+    @Test
+    @CompileDynamic
+    void testRightJoin11() {
+        def nums2 = [1, 2, 3].stream()
+        def nums1 = [].stream()
+        def result = from(nums1).rightJoin(from(nums2), (a, b) -> a == b).toList()
+        assert [[null, 1], [null, 2], [null, 3]] == result
+    }
+
+    @Test
+    @CompileDynamic
+    void testLeftJoin12() {
+        def nums1 = []
+        def nums2 = []
+        def result = from(nums1).leftJoin(from(nums2), (a, b) -> a == b).toList()
+        assert [] == result
+    }
+
+    @Test
+    @CompileDynamic
+    void testRightJoin12() {
+        def nums2 = [].stream()
+        def nums1 = [].stream()
+        def result = from(nums1).rightJoin(from(nums2), (a, b) -> a == b).toList()
+        assert [] == result
+    }
 
     @Test
     void testLeftHashJoin0() {
@@ -537,6 +624,42 @@ class QueryableCollectionTest {
     }
 
     @Test
+    @CompileDynamic
+    void testLeftHashJoin12() {
+        def nums1 = [1, 2, 3]
+        def nums2 = []
+        def result = from(nums1).leftHashJoin(from(nums2), a -> a, b -> b).toList()
+        assert [[1, null], [2, null], [3, null]] == result
+    }
+
+    @Test
+    @CompileDynamic
+    void testRightHashJoin12() {
+        def nums2 = [1, 2, 3].stream()
+        def nums1 = [].stream()
+        def result = from(nums1).rightHashJoin(from(nums2), a -> a, b -> b).toList()
+        assert [[null, 1], [null, 2], [null, 3]] == result
+    }
+
+    @Test
+    @CompileDynamic
+    void testLeftHashJoin13() {
+        def nums1 = []
+        def nums2 = []
+        def result = from(nums1).leftHashJoin(from(nums2), a -> a, b -> b).toList()
+        assert [] == result
+    }
+
+    @Test
+    @CompileDynamic
+    void testRightHashJoin13() {
+        def nums2 = [].stream()
+        def nums1 = [].stream()
+        def result = from(nums1).rightHashJoin(from(nums2), a -> a, b -> b).toList()
+        assert [] == result
+    }
+
+    @Test
     void testFullJoin() {
         def nums1 = [1, 2, 3]
         def nums2 = [2, 3, 4]