testutils

package
v0.0.0-...-80cf271 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2025 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockPlayerManager

type MockPlayerManager struct {
	// contains filtered or unexported fields
}

MockPlayerManager implements chunk.PlayerManager for testing

func NewMockPlayerManager

func NewMockPlayerManager() *MockPlayerManager

func (*MockPlayerManager) AddToInventory

func (m *MockPlayerManager) AddToInventory(ctx context.Context, playerID int64, resourceType, resourceSubtype, quantity int64) error

func (*MockPlayerManager) GetInventory

func (m *MockPlayerManager) GetInventory(playerID int64) map[int64]int64

func (*MockPlayerManager) GetStats

func (m *MockPlayerManager) GetStats(playerID int64) []chunk.HarvestStatsUpdate

func (*MockPlayerManager) UpdateHarvestStats

func (m *MockPlayerManager) UpdateHarvestStats(ctx context.Context, playerID int64, update chunk.HarvestStatsUpdate) error

type TestWorld

type TestWorld struct {
	DB            *sql.DB
	ChunkManager  *chunk.Manager
	PlayerManager *MockPlayerManager
	// contains filtered or unexported fields
}

TestWorld represents a test world with database and chunk manager

func CreateTestWorld

func CreateTestWorld(t *testing.T) *TestWorld

CreateTestWorld creates a new test world with a temporary database

func (*TestWorld) Cleanup

func (tw *TestWorld) Cleanup()

Cleanup closes the database and removes the temporary file

func (*TestWorld) CreateInactiveTestNode

func (tw *TestWorld) CreateInactiveTestNode(t *testing.T, chunkX, chunkZ, localX, localZ, nodeType int64) *chunk.ResourceNode

CreateInactiveTestNode creates a test node that is inactive/depleted

func (*TestWorld) CreateTestNode

func (tw *TestWorld) CreateTestNode(t *testing.T, chunkX, chunkZ, localX, localZ, nodeType, yield int64) *chunk.ResourceNode

CreateTestNode creates a test node in the database

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL