the browser-facing portion of osu!
at master 1.8 kB view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6namespace Tests\Libraries\Score; 7 8use App\Enums\Ruleset; 9use App\Models\Solo\Score; 10use Tests\TestCase; 11 12class ScoringModeTest extends TestCase 13{ 14 /** 15 * @see https://github.com/ppy/osu/blob/b535f7c51916ed09231b78aa422e6488cf9a2a12/osu.Game.Tests/Rulesets/Scoring/ScoreProcessorTest.cs#L77-L102 Client reference 16 */ 17 public static function classicScoreConversionDataProvider(): array 18 { 19 return [ 20 [0, 0, 'great'], 21 [34_734, 3_492, 'great'], 22 [69_925, 7_029, 'great'], 23 [154_499, 15_530, 'perfect'], 24 [326_963, 32_867, 'great'], 25 [326_963, 32_867, 'perfect'], 26 [0, 0, 'small_tick_hit'], 27 [493_652, 49_365, 'small_tick_hit'], 28 [0, 0, 'large_tick_hit'], 29 [326_963, 32_696, 'large_tick_hit'], 30 [371_627, 37_163, 'slider_tail_hit'], 31 [1_000_030, 100_003, 'small_bonus'], 32 [1_000_150, 100_015, 'large_bonus'], 33 ]; 34 } 35 36 /** 37 * @dataProvider classicScoreConversionDataProvider 38 */ 39 public function testConvertToClassic(int $standardisedScore, int $classicScore, string $maxHitResult): void 40 { 41 // Hardcoded by the referenced test 42 static $maxHitResultCount = 4; 43 static $ruleset = Ruleset::osu; 44 45 $score = Score::factory() 46 ->withData(['maximum_statistics' => [$maxHitResult => $maxHitResultCount]]) 47 ->make(['ruleset_id' => $ruleset->value, 'total_score' => $standardisedScore]); 48 49 $this->assertSame($classicScore, $score->getClassicTotalScore()); 50 } 51}