package games import ( "testing" ) func TestAddGame(t *testing.T) { game := NewGame(100,100) games := New() games.AddGame(game) if len(games.ListGames()) != 1 { t.Fatalf("Incorrect ListGames size expeciting 1 got %v", len(games.ListGames())) } } func TestAdd2Games(t *testing.T) { game := NewGame(100,100) game2 := NewGame(100,100) games := New() games.AddGame(game) games.AddGame(game2) if len(games.ListGames()) != 2 { t.Fatalf("Incorrect ListGames size expeciting 2 got %v", len(games.ListGames())) } if games.ListGames()[0].Id != game.Id { t.Fatalf("Incorrect gameid expected %v got %v", games.ListGames()[0].Id, game.Id) } }