code cleanup

This commit is contained in:
Fran Jurmanović
2025-09-18 13:33:51 +02:00
parent 901dbe697e
commit 5e7c96697a
83 changed files with 2832 additions and 2186 deletions

View File

@@ -7,13 +7,11 @@ import (
"github.com/google/uuid"
)
// StateHistoryTestData provides simple test data generators
type StateHistoryTestData struct {
ServerID uuid.UUID
BaseTime time.Time
}
// NewStateHistoryTestData creates a new test data generator
func NewStateHistoryTestData(serverID uuid.UUID) *StateHistoryTestData {
return &StateHistoryTestData{
ServerID: serverID,
@@ -21,7 +19,6 @@ func NewStateHistoryTestData(serverID uuid.UUID) *StateHistoryTestData {
}
}
// CreateStateHistory creates a basic state history entry
func (td *StateHistoryTestData) CreateStateHistory(session model.TrackSession, track string, playerCount int, sessionID uuid.UUID) model.StateHistory {
return model.StateHistory{
ID: uuid.New(),
@@ -36,7 +33,6 @@ func (td *StateHistoryTestData) CreateStateHistory(session model.TrackSession, t
}
}
// CreateMultipleEntries creates multiple state history entries for the same session
func (td *StateHistoryTestData) CreateMultipleEntries(session model.TrackSession, track string, playerCounts []int) []model.StateHistory {
sessionID := uuid.New()
var entries []model.StateHistory
@@ -59,7 +55,6 @@ func (td *StateHistoryTestData) CreateMultipleEntries(session model.TrackSession
return entries
}
// CreateBasicFilter creates a basic filter for testing
func CreateBasicFilter(serverID string) *model.StateHistoryFilter {
return &model.StateHistoryFilter{
ServerBasedFilter: model.ServerBasedFilter{
@@ -68,7 +63,6 @@ func CreateBasicFilter(serverID string) *model.StateHistoryFilter {
}
}
// CreateFilterWithSession creates a filter with session type
func CreateFilterWithSession(serverID string, session model.TrackSession) *model.StateHistoryFilter {
return &model.StateHistoryFilter{
ServerBasedFilter: model.ServerBasedFilter{
@@ -78,7 +72,6 @@ func CreateFilterWithSession(serverID string, session model.TrackSession) *model
}
}
// LogLines contains sample ACC server log lines for testing
var SampleLogLines = []string{
"[2024-01-15 14:30:25.123] Session changed: NONE -> PRACTICE",
"[2024-01-15 14:30:30.456] 1 client(s) online",
@@ -95,7 +88,6 @@ var SampleLogLines = []string{
"[2024-01-15 15:00:05.123] Session changed: RACE -> NONE",
}
// ExpectedSessionChanges represents the expected session changes from parsing the sample log lines
var ExpectedSessionChanges = []struct {
From model.TrackSession
To model.TrackSession
@@ -106,5 +98,4 @@ var ExpectedSessionChanges = []struct {
{model.SessionRace, model.SessionUnknown},
}
// ExpectedPlayerCounts represents the expected player counts from parsing the sample log lines
var ExpectedPlayerCounts = []int{1, 3, 5, 8, 12, 15, 14, 0}