public function testFindTriples() { $array = [1, 1, 1, 2, 2, 3, 3, 2]; $triples = Math::findTriples($array); $this->assertContains(2, $triples); $this->assertCount(2, $triples); }
protected function checkNumbersHistory() { if (count($this->numbersHistory) !== 15) { return; } $halfScores = []; foreach ($this->numbersHistory as $number) { $halfScores[] = Math::numberToHalfScore($number); } $triples = Math::findTriples($halfScores); if (count($triples) > 0) { throw new FolderException('Folder can\'t contain same halfscore more than twice'); } }