init
This commit is contained in:
16
tests/Unit/ExampleTest.php
Normal file
16
tests/Unit/ExampleTest.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ExampleTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* A basic test example.
|
||||
*/
|
||||
public function test_that_true_is_true(): void
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
}
|
||||
36
tests/Unit/ModelScoringServiceTest.php
Normal file
36
tests/Unit/ModelScoringServiceTest.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user