Files
ai-web/tests/Unit/ModelScoringServiceTest.php
jiangdong.cheng aa16c9f8c2
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
init
2026-02-11 17:28:36 +08:00

37 lines
773 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit;
use App\Models\AiModel;
use App\Services\ModelScoringService;
use Tests\TestCase;
class ModelScoringServiceTest extends TestCase
{
public function test_it_calculates_weighted_score(): void
{
$service = new ModelScoringService();
$score = $service->calculateTotal(90, 70, 80);
$this->assertSame(82, $score);
}
public function test_it_bounds_scores_when_apply_called(): void
{
$service = new ModelScoringService();
$model = new AiModel([
'effectiveness_score' => 120,
'price_score' => -10,
'speed_score' => 80,
]);
$service->apply($model);
$this->assertSame(66, $model->total_score);
}
}