diff --git a/src/ItemList.php b/src/ItemList.php index a0047eca..ad2d4e93 100644 --- a/src/ItemList.php +++ b/src/ItemList.php @@ -122,7 +122,7 @@ public function topN(int $n): self } $topNList = new self(); - $topNList->insertFromArray(array_slice($this->list, 0, $n)); + $topNList->insertFromArray(array_slice($this->list, -$n, $n)); return $topNList; } diff --git a/tests/data/expected.csv b/tests/data/expected.csv index 64dddc9f..b50e5c93 100644 --- a/tests/data/expected.csv +++ b/tests/data/expected.csv @@ -1037,7 +1037,7 @@ 3bd6564e4bffc131afe76760e02db797,3,64910.2,36.7,1,0,16.5 3bda69c3fe4e30d6944a02d696661fe3,1,0,29.2,1,0,29.2 3bdea76452dfd0a2dd349e05688ceea7,1,0,36.2,1,0,36.2 -3bec6daa3c92aab45d0db63b688bad9e,5,89806.4,34.3,1,0,36.2 +3bec6daa3c92aab45d0db63b688bad9e,5,89806.4,34.3,2,79806.3,18.1 3becb246809835f192b15039849f3528,1,0,27.5,1,0,27.5 3bee0a82a9098c92945daac991fca070,2,12.3,23.7,1,0,7.1 3c1b74fc52f870503d59c3327da6d203,2,607620.3,40,1,0,24.2 @@ -1466,7 +1466,7 @@ 547b3c46daded352fbf63c857d87921c,6,8937399.5,61.4,2,167690.3,50.8 548c715873b6223fe988a0f94c932b05,1,0,57.2,1,0,57.2 549e072fe0adbf86a9cdf96456702e6b,2,58806.3,26.5,1,0,8 -54aa5358f035a72d895437e03cf3393c,2,121,35.2,1,0,51.2 +54aa5358f035a72d895437e03cf3393c,1,0,51.2,1,0,51.2 54d00e9d39e00973e74abb7d463509df,2,3782.3,43.7,1,0,13.1 54d7241c191e5c5d30f55f86f3c2a1e2,2,25600,37.6,1,0,11.3 54ebd8d18b8e5eed18b5f0e263dc6449,2,9,36.5,1,0,10.9 @@ -1709,7 +1709,7 @@ 62dcab5291143dc6fc110ed65e070627,2,2500,27.3,2,2500,27.3 62e6b715a5a841db4292ce86055ad993,3,2646757.6,61,3,2646757.6,61 62f1be6037444d4f1f37a941da288493,1,0,30.1,1,0,30.1 -62f9a1e4dc829da0729325702c2b031c,2,16,44.9,2,324,32.7 +62f9a1e4dc829da0729325702c2b031c,2,121,44.9,2,324,32.7 62fd86f546a52d904692e1a9e919e089,1,0,12.5,1,0,12.5 62fd8a5e4b91cd6c7cd1d0aebd05c4ca,1,0,40.9,1,0,40.9 63102af3c3bc3f814be53dffddb29e2d,1,0,18.6,1,0,18.6 @@ -1724,7 +1724,7 @@ 63612b0a7235d56f612cf35638b6363e,1,0,20.4,1,0,20.4 6362975c6a32ff5ad690d020c34b2598,1,0,30.1,1,0,30.1 636a032bc0ef4304fe927ce6422ccd9a,1,0,25.8,1,0,25.8 -6377c9f21e9843a9ffc592de1c674a98,3,32101.6,44.7,2,459006.3,10 +6377c9f21e9843a9ffc592de1c674a98,3,32101.6,44.7,2,127806.3,10 638c27f7695650b512855b5a328ef2c5,1,0,44.6,1,0,44.6 63941c7ab6b417593923d1f9ed6673b7,1,0,44.1,1,0,44.1 63a19473494f76017c8b0aab3d1753d4,2,2450.3,33.7,1,0,10.1 @@ -2076,7 +2076,7 @@ 77ee435e81a6ed974d2d23d5ad92d758,1,0,43.8,1,0,43.8 77f36d03b8b0972966f784ede18df036,1,0,31.8,1,0,31.8 7803029edad1118c42361b90838021ff,1,0,15.5,1,0,15.5 -7808268fc06dc358047e06d04131dae6,2,34225,55,2,121,40 +7808268fc06dc358047e06d04131dae6,2,121,40,2,121,40 780e3fcb605b33a5293dc71d295e4f38,1,0,34.7,1,0,34.7 7818ebbfce480f11d9c91b9fdfeae9d7,1,0,33.9,1,0,33.9 78202b56af66040afa4b19d23164168b,1,0,18.9,1,0,18.9 @@ -2227,7 +2227,7 @@ 808255961bd2cd69ada085757150b913,1,0,38,1,0,38 808b82b9297c4ab6bbd366c4e189962c,1,0,33.3,1,0,33.3 80ad76b20162a20c96fd28c1a0fd1554,1,0,57.8,1,0,57.8 -80b35862e48198d457d850237619a1be,1,0,33.3,1,0,33.3 +80b35862e48198d457d850237619a1be,1,0,73.1,1,0,33.3 80bfcbb8cabb6d518bd218a09f72d280,1,0,26.1,1,0,26.1 80d45c7ecee2bf6045d135f0b149a218,1,0,56.3,1,0,56.3 80f0a1007c7e471ed1bfff1373ba6b53,2,756.3,47.1,2,36290.3,12.3 @@ -3553,7 +3553,7 @@ d0efe6d5522001320a4372da93769920,1,0,33.1,1,0,33.1 d10e78eff303de831aff0a556a536a0f,1,0,48.7,1,0,48.7 d11076dc6cd4720a1fe9add55d2281aa,1,0,14.9,1,0,14.9 d1239d721e49347c9804bed0a6db56ab,1,0,39.3,1,0,39.3 -d12f9cb4e8c278ab3286ae03ea30313a,2,39204,11.5,1,0,7 +d12f9cb4e8c278ab3286ae03ea30313a,2,90000,23.3,1,0,7 d130d596db644f016ca8529c8abf46cc,1,0,37.8,1,0,37.8 d138dfe2bd5abdd66b951e505e6ce634,1,0,21.3,1,0,21.3 d144251f58433c0af02fa1a09ce64d30,1,0,74.6,1,0,74.6 @@ -3968,7 +3968,7 @@ ea7122ae9954678d540f9b751e7332d1,2,303050.3,27.7,1,0,16.8 ea80be7cc0e28b418054440bef9af100,1,0,25.5,1,0,25.5 ea8a581abae0dc3e269d0ffc7e6ab65f,1,0,22.6,1,0,22.6 eabe5412040e26fb2b47f6d7bf08bd4b,1,0,17.1,1,0,17.1 -eacf25c832163cc3c02cc8ef67e5ac81,2,256,27,1,0,16.4 +eacf25c832163cc3c02cc8ef67e5ac81,2,256,27,2,36,8.2 eae143840bf7f0fc86e134802c7dc547,1,0,23.7,1,0,23.7 eaf265fc1e76d003d97acb83e904fae7,1,0,18.8,1,0,18.8 eaf774f16798d781d477621ac7d6de69,1,0,23.5,1,0,23.5