Skip to content

Commit

Permalink
SetAxiomsTest: new test cases added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Smoren committed Jan 27, 2023
1 parent 2a84198 commit ab276de
Showing 1 changed file with 91 additions and 1 deletion.
92 changes: 91 additions & 1 deletion tests/SetTheory/SetAxiomsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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]),
Expand All @@ -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]),
Expand Down Expand Up @@ -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]),
Expand Down Expand Up @@ -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]),
Expand Down

0 comments on commit ab276de

Please sign in to comment.