wip: generate report

This commit is contained in:
Ilia Denisov
2026-02-03 23:41:18 +02:00
parent a567229f8a
commit adbe605783
36 changed files with 1037 additions and 391 deletions
+28 -38
View File
@@ -13,13 +13,11 @@ import (
func TestCargoCapacity(t *testing.T) {
test := func(cargoSize float64, expectCapacity float64) {
ship := game.ShipType{
ShipTypeReport: game.ShipTypeReport{
Drive: 1,
Armament: 1,
Weapons: 1,
Shields: 1,
Cargo: cargoSize,
},
Drive: 1,
Armament: 1,
Weapons: 1,
Shields: 1,
Cargo: cargoSize,
}
sg := game.ShipGroup{
Number: 1,
@@ -41,14 +39,12 @@ func TestCargoCapacity(t *testing.T) {
func TestCarryingAndFullMass(t *testing.T) {
Freighter := &game.ShipType{
ShipTypeReport: game.ShipTypeReport{
Name: "Freighter",
Drive: 8,
Armament: 0,
Weapons: 0,
Shields: 2,
Cargo: 10,
},
Name: "Freighter",
Drive: 8,
Armament: 0,
Weapons: 0,
Shields: 2,
Cargo: 10,
}
sg := &game.ShipGroup{
Number: 1,
@@ -75,14 +71,12 @@ func TestCarryingAndFullMass(t *testing.T) {
func TestSpeed(t *testing.T) {
Freighter := &game.ShipType{
ShipTypeReport: game.ShipTypeReport{
Name: "Freighter",
Drive: 8,
Armament: 0,
Weapons: 0,
Shields: 2,
Cargo: 10,
},
Name: "Freighter",
Drive: 8,
Armament: 0,
Weapons: 0,
Shields: 2,
Cargo: 10,
}
sg := &game.ShipGroup{
Number: 1,
@@ -106,14 +100,12 @@ func TestSpeed(t *testing.T) {
func TestBombingPower(t *testing.T) {
BattleStation := game.ShipType{
ShipTypeReport: game.ShipTypeReport{
Name: "Battle_Station",
Drive: 60.0,
Armament: 3,
Weapons: 30.0,
Shields: 100.0,
Cargo: 0.0,
},
Name: "Battle_Station",
Drive: 60.0,
Armament: 3,
Weapons: 30.0,
Shields: 100.0,
Cargo: 0.0,
}
sg := game.ShipGroup{
Number: 1,
@@ -145,13 +137,11 @@ func TestDriveEffective(t *testing.T) {
}
for i := range tc {
someShip := game.ShipType{
ShipTypeReport: game.ShipTypeReport{
Drive: tc[i].driveShipType,
Armament: rand.UintN(30) + 1,
Weapons: rand.Float64()*30 + 1,
Shields: rand.Float64()*100 + 1,
Cargo: rand.Float64()*20 + 1,
},
Drive: tc[i].driveShipType,
Armament: rand.UintN(30) + 1,
Weapons: rand.Float64()*30 + 1,
Shields: rand.Float64()*100 + 1,
Cargo: rand.Float64()*20 + 1,
}
sg := game.ShipGroup{
Number: rand.UintN(4) + 1,