package game_test

import (
	"testing"

	"galaxy/game/internal/model/game"

	"github.com/stretchr/testify/assert"
)

func TestTechSet(t *testing.T) {
	s := ts.Set(game.TechDrive, 10.5)
	assert.Equal(t, 1.1, ts.Value(game.TechDrive))
	assert.Equal(t, 1.2, ts.Value(game.TechWeapons))
	assert.Equal(t, 1.3, ts.Value(game.TechShields))
	assert.Equal(t, 1.4, ts.Value(game.TechCargo))

	assert.Equal(t, 10.5, s.Value(game.TechDrive))
	assert.Equal(t, 1.2, s.Value(game.TechWeapons))
	assert.Equal(t, 1.3, s.Value(game.TechShields))
	assert.Equal(t, 1.4, s.Value(game.TechCargo))

	s = s.Set(game.TechWeapons, 5.7)
	assert.Equal(t, 1.1, ts.Value(game.TechDrive))
	assert.Equal(t, 1.2, ts.Value(game.TechWeapons))
	assert.Equal(t, 1.3, ts.Value(game.TechShields))
	assert.Equal(t, 1.4, ts.Value(game.TechCargo))

	assert.Equal(t, 10.5, s.Value(game.TechDrive))
	assert.Equal(t, 5.7, s.Value(game.TechWeapons))
	assert.Equal(t, 1.3, s.Value(game.TechShields))
	assert.Equal(t, 1.4, s.Value(game.TechCargo))

	s = s.Set(game.TechShields, 2.13)
	assert.Equal(t, 1.1, ts.Value(game.TechDrive))
	assert.Equal(t, 1.2, ts.Value(game.TechWeapons))
	assert.Equal(t, 1.3, ts.Value(game.TechShields))
	assert.Equal(t, 1.4, ts.Value(game.TechCargo))

	assert.Equal(t, 10.5, s.Value(game.TechDrive))
	assert.Equal(t, 5.7, s.Value(game.TechWeapons))
	assert.Equal(t, 2.13, s.Value(game.TechShields))
	assert.Equal(t, 1.4, s.Value(game.TechCargo))

	s = s.Set(game.TechCargo, 3.1415926)
	assert.Equal(t, 1.1, ts.Value(game.TechDrive))
	assert.Equal(t, 1.2, ts.Value(game.TechWeapons))
	assert.Equal(t, 1.3, ts.Value(game.TechShields))
	assert.Equal(t, 1.4, ts.Value(game.TechCargo))

	assert.Equal(t, 10.5, s.Value(game.TechDrive))
	assert.Equal(t, 5.7, s.Value(game.TechWeapons))
	assert.Equal(t, 2.13, s.Value(game.TechShields))
	assert.Equal(t, 3.1415926, s.Value(game.TechCargo))
}
