game-village-politics-backend/tests/Unit/Game/DefeatedTest.php

17 lines
575 B
PHP
Raw Permalink Normal View History

<?php
use App\Game\Combat\Defeated;
it('weighs the fallen by the food they ate', function () {
$defeated = new Defeated(gameConfig());
expect($defeated->points(['spear' => 10, 'light_cavalry' => 2, 'nobleman' => 1]))->toBe(10 + 6 + 10)
->and($defeated->points(['militia' => 7]))->toBe(7)
->and($defeated->points([]))->toBe(0);
});
it('shares the points among defenders by what they had standing', function () {
expect(Defeated::share(30, [5 => 20.0, 9 => 10.0]))->toBe([5 => 20, 9 => 10])
->and(Defeated::share(30, []))->toBe([]);
});