expectException(CondorcetInternalException::class); Permutations::getPossibleCountOfPermutations(0); } public function testIntegerOverflowWithBigInt(): void { $this->expectException(IntegerOverflowException::class); Permutations::getPossibleCountOfPermutations(42); } public function testIntegerOverflowWithoutBigInt(): void { Permutations::$useBigIntegerIfAvailable = false; $this->expectException(IntegerOverflowException::class); Permutations::getPossibleCountOfPermutations(42); } public function testPermutationsAllResultsFor3(): void { $p = new Permutations([0, 1, 2]); $r = $p->getResults(); self::assertInstanceOf(\SplFixedArray::class, $r); self::assertSame(6, $r->getSize()); self::assertSame( [[1=>0, 2=>1, 3=>2], [1=>1, 2=>0, 3=>2], [1=>1, 2=>2, 3=>0], [1=>0, 2=>2, 3=>1], [1=>2, 2=>0, 3=>1], [1=>2, 2=>1, 3=>0], ], $r->toArray() ); } public function testPermutationsAllResultsFor1(): void { $p = new Permutations([42]); $r = $p->getResults(); self::assertInstanceOf(\SplFixedArray::class, $r); self::assertSame(1, $r->getSize()); self::assertSame([[1=>42]], $r->toArray()); } }