From 7ebcf602acb4cb54bed65ffbfe86aa9ac0172bbf Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Tue, 16 Feb 2021 17:59:12 +0100 Subject: [PATCH] add simple test for result splitting with multiple ranks --- test/php/Nominatim/ResultTest.php | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 test/php/Nominatim/ResultTest.php diff --git a/test/php/Nominatim/ResultTest.php b/test/php/Nominatim/ResultTest.php new file mode 100644 index 00000000..c18aa762 --- /dev/null +++ b/test/php/Nominatim/ResultTest.php @@ -0,0 +1,35 @@ +iResultRank = $iResultRank; + + return $oResult; +} + + +class ResultTest extends \PHPUnit\Framework\TestCase +{ + public function testSplitResults() + { + $aSplitResults = Result::splitResults(array( + mkRankedResult(1, 2), + mkRankedResult(2, 0), + mkRankedResult(3, 0), + mkRankedResult(4, 2), + mkRankedResult(5, 1) + )); + + + $aHead = array_keys($aSplitResults['head']); + $aTail = array_keys($aSplitResults['tail']); + + $this->assertEquals($aHead, array(2, 3)); + $this->assertEquals($aTail, array(1, 4, 5)); + } +} -- 2.39.5