diff --git a/tests/SetTheory/SetAxiomsTest.php b/tests/SetTheory/SetAxiomsTest.php index 426f3d23c..14427e958 100644 --- a/tests/SetTheory/SetAxiomsTest.php +++ b/tests/SetTheory/SetAxiomsTest.php @@ -744,9 +744,17 @@ public function testPartialIntersectionDefinition(int $m, Set ...$sets) // Given $allSets = $sets; $s = array_shift($sets); + $totalElementsCount = array_reduce($allSets, static function (int $carry, Set $set) { + return $carry + count($set); + }, 0); + $partialIntersection = $s->intersectPartial($m, ...$sets); // When - $partialIntersection = $s->intersectPartial($m, ...$sets); + if ($totalElementsCount === 0) { + // Then + // Assert than for any M and N M-partial intersection of N empty sets is an empty set. + $this->assertCount(0, $partialIntersection); + } // Then foreach ($partialIntersection as $value) { @@ -775,6 +783,14 @@ public function testPartialIntersectionDefinition(int $m, Set ...$sets) public function dataProviderForPartialIntersectionDefinition(): array { return [ + [ + 1, + new Set(), + ], + [ + 2, + new Set(), + ], [ 1, new Set([1]), @@ -783,6 +799,21 @@ public function dataProviderForPartialIntersectionDefinition(): array 2, new Set([1]), ], + [ + 1, + new Set(), + new Set(), + ], + [ + 2, + new Set(), + new Set(), + ], + [ + 3, + new Set(), + new Set(), + ], [ 1, new Set([1]), @@ -848,6 +879,30 @@ public function dataProviderForPartialIntersectionDefinition(): array new Set([1, 2, 3, 4, 5]), new Set([6, 7, 8, 9, 10]), ], + [ + 1, + new Set(), + new Set(), + new Set(), + ], + [ + 2, + new Set(), + new Set(), + new Set(), + ], + [ + 3, + new Set(), + new Set(), + new Set(), + ], + [ + 4, + new Set(), + new Set(), + new Set(), + ], [ 1, new Set([1, 2, 3, 4, 5]), @@ -920,6 +975,41 @@ public function dataProviderForPartialIntersectionDefinition(): array new Set([2, 3, 4, 5]), new Set([3, 4, 5, 6, 7]), ], + [ + 1, + new Set(), + new Set(), + new Set(), + new Set(), + ], + [ + 2, + new Set(), + new Set(), + new Set(), + new Set(), + ], + [ + 3, + new Set(), + new Set(), + new Set(), + new Set(), + ], + [ + 4, + new Set(), + new Set(), + new Set(), + new Set(), + ], + [ + 5, + new Set(), + new Set(), + new Set(), + new Set(), + ], [ 1, new Set([1, 2, 3]),