|
1 | 1 | package logic |
2 | 2 |
|
3 | | -import "testing" |
| 3 | +import ( |
| 4 | + "testing" |
| 5 | + |
| 6 | + "github.com/morozov/river-raid-ebiten/pkg/state" |
| 7 | +) |
4 | 8 |
|
5 | 9 | func TestUpdateFuel_ConsumesOnEvenTick(t *testing.T) { |
6 | 10 | t.Parallel() |
@@ -42,37 +46,37 @@ func TestUpdateFuel_EmptyTriggersDeath(t *testing.T) { |
42 | 46 | t.Errorf("fuel = %d, want 0", fuel) |
43 | 47 | } |
44 | 48 |
|
45 | | - if result != FuelResultNoFuel { |
46 | | - t.Error("expected FuelResultNoFuel") |
| 49 | + if result != state.FuelStateEmpty { |
| 50 | + t.Error("expected FuelStateEmpty") |
47 | 51 | } |
48 | 52 | } |
49 | 53 |
|
50 | 54 | func TestUpdateFuel_LowFuelWarning(t *testing.T) { |
51 | 55 | t.Parallel() |
52 | 56 |
|
53 | 57 | _, result := UpdateFuel(63, 1, false) |
54 | | - if result != FuelResultLowFuel { |
55 | | - t.Error("expected FuelResultLowFuel at 63") |
| 58 | + if result != state.FuelStateLow { |
| 59 | + t.Error("expected FuelStateLow at 63") |
56 | 60 | } |
57 | 61 |
|
58 | 62 | _, result = UpdateFuel(64, 1, false) |
59 | | - if result != FuelResultNormal { |
60 | | - t.Error("expected no FuelResultNormal at 64") |
| 63 | + if result != state.FuelStateNormal { |
| 64 | + t.Error("expected FuelStateNormal at 64") |
61 | 65 | } |
62 | 66 | } |
63 | 67 |
|
64 | 68 | func TestUpdateFuel_FuelFullOnCapTransition(t *testing.T) { |
65 | 69 | t.Parallel() |
66 | 70 |
|
67 | | - // Fuel just below cap → transitions to cap: FuelFull should be set. |
| 71 | + // FuelState just below cap → transitions to cap: FuelFull should be set. |
68 | 72 | _, result := UpdateFuel(250, 0, true) |
69 | | - if result != FuelResultFullFuel { |
70 | | - t.Error("expected FuelResultFullFuel when fuel reaches cap") |
| 73 | + if result != state.FuelStateFull { |
| 74 | + t.Error("expected FuelStateFull when fuel reaches cap") |
71 | 75 | } |
72 | 76 |
|
73 | 77 | // Not refueling with enough fuel. |
74 | 78 | _, result = UpdateFuel(250, 0, false) |
75 | | - if result != FuelResultNormal { |
76 | | - t.Error("expected no FuelResultNormal when not refueling") |
| 79 | + if result != state.FuelStateNormal { |
| 80 | + t.Error("expected FuelStateNormal when not refueling") |
77 | 81 | } |
78 | 82 | } |
0 commit comments