feat: snapshot creation integration test (#47)
Reviewed-on: twhelp/corev3#47
This commit is contained in:
parent
5737a756f3
commit
3d85c84527
|
@ -64,7 +64,7 @@ func testEnnoblementRepository(t *testing.T, newRepos func(t *testing.T) reposit
|
|||
ennoblements, err := repos.ennoblement.List(ctx, listParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
res := make(map[string][]int)
|
||||
m := make(map[string][]int)
|
||||
|
||||
for _, p := range params {
|
||||
key := fmt.Sprintf("%s-%d", p.ServerKey(), p.Base().VillageID())
|
||||
|
@ -76,12 +76,12 @@ func testEnnoblementRepository(t *testing.T, newRepos func(t *testing.T) reposit
|
|||
cmpopts.EquateApproxTime(time.Minute),
|
||||
gocmp.AllowUnexported(domain.BaseEnnoblement{}),
|
||||
) {
|
||||
res[key] = append(res[key], i)
|
||||
m[key] = append(m[key], i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for key, indexes := range res {
|
||||
for key, indexes := range m {
|
||||
assert.Len(t, indexes, 1, key)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,19 +63,19 @@ func testPlayerSnapshotRepository(t *testing.T, newRepos func(t *testing.T) repo
|
|||
playerSnapshots, err := repos.playerSnapshot.List(ctx, domain.NewListPlayerSnapshotsParams())
|
||||
require.NoError(t, err)
|
||||
|
||||
res := make(map[string][]int)
|
||||
m := make(map[string][]int)
|
||||
|
||||
for _, p := range params {
|
||||
key := fmt.Sprintf("%s-%d-%s", p.ServerKey(), p.PlayerID(), p.Date().Format(dateFormat))
|
||||
|
||||
for i, ps := range playerSnapshots {
|
||||
if ps.ServerKey() == p.ServerKey() && ps.PlayerID() == p.PlayerID() && ps.Date().Equal(p.Date()) {
|
||||
res[key] = append(res[key], i)
|
||||
m[key] = append(m[key], i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for key, indexes := range res {
|
||||
for key, indexes := range m {
|
||||
assert.Len(t, indexes, 1, key)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ func testTribeChangeRepository(t *testing.T, newRepos func(t *testing.T) reposit
|
|||
tribeChanges, err := repos.tribeChange.List(ctx, listParams)
|
||||
require.NoError(t, err)
|
||||
|
||||
res := make(map[string][]int)
|
||||
m := make(map[string][]int)
|
||||
|
||||
for _, p := range params {
|
||||
key := fmt.Sprintf("%s-%d-%d-%d", p.ServerKey(), p.PlayerID(), p.OldTribeID(), p.NewTribeID())
|
||||
|
@ -71,12 +71,12 @@ func testTribeChangeRepository(t *testing.T, newRepos func(t *testing.T) reposit
|
|||
for i, tc := range tribeChanges {
|
||||
//nolint:lll
|
||||
if tc.ServerKey() == p.ServerKey() && tc.PlayerID() == p.PlayerID() && tc.OldTribeID() == p.OldTribeID() && tc.NewTribeID() == p.NewTribeID() {
|
||||
res[key] = append(res[key], i)
|
||||
m[key] = append(m[key], i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for key, indexes := range res {
|
||||
for key, indexes := range m {
|
||||
assert.Len(t, indexes, 1, key)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,19 +65,19 @@ func testTribeSnapshotRepository(t *testing.T, newRepos func(t *testing.T) repos
|
|||
tribeSnapshots, err := repos.tribeSnapshot.List(ctx, domain.NewListTribeSnapshotsParams())
|
||||
require.NoError(t, err)
|
||||
|
||||
res := make(map[string][]int)
|
||||
m := make(map[string][]int)
|
||||
|
||||
for _, p := range params {
|
||||
key := fmt.Sprintf("%s-%d-%s", p.ServerKey(), p.TribeID(), p.Date().Format(dateFormat))
|
||||
|
||||
for i, ts := range tribeSnapshots {
|
||||
if ts.ServerKey() == p.ServerKey() && ts.TribeID() == p.TribeID() && ts.Date().Equal(p.Date()) {
|
||||
res[key] = append(res[key], i)
|
||||
m[key] = append(m[key], i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for key, indexes := range res {
|
||||
for key, indexes := range m {
|
||||
assert.Len(t, indexes, 1, key)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,354 @@
|
|||
package service_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
"slices"
|
||||
"syscall"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.dwysokinski.me/twhelp/corev3/internal/adapter"
|
||||
"gitea.dwysokinski.me/twhelp/corev3/internal/app"
|
||||
"gitea.dwysokinski.me/twhelp/corev3/internal/bun/buntest"
|
||||
"gitea.dwysokinski.me/twhelp/corev3/internal/domain"
|
||||
"gitea.dwysokinski.me/twhelp/corev3/internal/port"
|
||||
"gitea.dwysokinski.me/twhelp/corev3/internal/watermill/watermillamqptest"
|
||||
"gitea.dwysokinski.me/twhelp/corev3/internal/watermill/watermillmsg"
|
||||
"gitea.dwysokinski.me/twhelp/corev3/internal/watermill/watermilltest"
|
||||
"github.com/ThreeDotsLabs/watermill"
|
||||
"github.com/ThreeDotsLabs/watermill-amqp/v2/pkg/amqp"
|
||||
"github.com/brianvoe/gofakeit/v6"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestSnapshotCreation(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
if testing.Short() {
|
||||
t.Skip("skipping long-running test")
|
||||
}
|
||||
|
||||
ctxTimeout, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
ctx, stop := signal.NotifyContext(ctxTimeout, os.Interrupt, syscall.SIGTERM)
|
||||
defer stop()
|
||||
|
||||
// bun
|
||||
db := postgres.NewDB(t)
|
||||
buntest.NewFixture(db).Load(t, ctx, os.DirFS("./testdata/snapshotcreation"), "fixture.yml")
|
||||
|
||||
// watermill
|
||||
marshaler := watermillmsg.JSONMarshaler{NewUUID: watermill.NewUUID}
|
||||
generateExchangeAndRoutingKeyName := func(topic string) string {
|
||||
return topic + "_snapshots"
|
||||
}
|
||||
rmqConn := rabbitMQ.NewConnection(t)
|
||||
nopLogger := watermill.NopLogger{}
|
||||
_, serverSub := watermillamqptest.NewPubSub(
|
||||
t,
|
||||
rmqConn,
|
||||
amqp.GenerateQueueNameTopicNameWithSuffix("_snapshots_server"),
|
||||
generateExchangeAndRoutingKeyName,
|
||||
)
|
||||
playerPub, playerSub := watermillamqptest.NewPubSub(
|
||||
t,
|
||||
rmqConn,
|
||||
amqp.GenerateQueueNameTopicNameWithSuffix("_snapshots_player"),
|
||||
generateExchangeAndRoutingKeyName,
|
||||
)
|
||||
tribePub, tribeSub := watermillamqptest.NewPubSub(
|
||||
t,
|
||||
rmqConn,
|
||||
amqp.GenerateQueueNameTopicNameWithSuffix("_snapshots_tribe"),
|
||||
generateExchangeAndRoutingKeyName,
|
||||
)
|
||||
|
||||
// events/commands
|
||||
tribeSnapshotCmdCreate := gofakeit.UUID()
|
||||
tribeSnapshotEventCreated := gofakeit.UUID()
|
||||
playerSnapshotCmdCreate := gofakeit.UUID()
|
||||
playerSnapshotEventCreated := gofakeit.UUID()
|
||||
|
||||
// adapters
|
||||
versionRepo := adapter.NewVersionBunRepository(db)
|
||||
serverRepo := adapter.NewServerBunRepository(db)
|
||||
tribeRepo := adapter.NewTribeBunRepository(db)
|
||||
playerRepo := adapter.NewPlayerBunRepository(db)
|
||||
tribeSnapshotRepo := adapter.NewTribeSnapshotBunRepository(db)
|
||||
playerSnapshotRepo := adapter.NewPlayerSnapshotBunRepository(db)
|
||||
tribeSnapshotPublisher := adapter.NewSnapshotWatermillPublisher(
|
||||
tribePub,
|
||||
marshaler,
|
||||
tribeSnapshotCmdCreate,
|
||||
tribeSnapshotEventCreated,
|
||||
)
|
||||
playerSnapshotPublisher := adapter.NewSnapshotWatermillPublisher(
|
||||
playerPub,
|
||||
marshaler,
|
||||
playerSnapshotCmdCreate,
|
||||
playerSnapshotEventCreated,
|
||||
)
|
||||
|
||||
// services
|
||||
versionSvc := app.NewVersionService(versionRepo)
|
||||
serverSvc := app.NewServerService(serverRepo, nil, nil)
|
||||
tribeSvc := app.NewTribeService(tribeRepo, nil, nil)
|
||||
playerSvc := app.NewPlayerService(playerRepo, nil, nil, nil)
|
||||
tribeSnapshotSvc := app.NewTribeSnapshotService(tribeSnapshotRepo, tribeSvc, tribeSnapshotPublisher)
|
||||
playerSnapshotSvc := app.NewPlayerSnapshotService(playerSnapshotRepo, playerSvc, playerSnapshotPublisher)
|
||||
snapshotSvc := app.NewSnapshotService(versionSvc, serverSvc, tribeSnapshotPublisher, playerSnapshotPublisher)
|
||||
|
||||
watermilltest.RunRouterWithContext(
|
||||
t,
|
||||
ctx,
|
||||
port.NewServerWatermillConsumer(
|
||||
serverSvc,
|
||||
serverSub,
|
||||
nopLogger,
|
||||
marshaler,
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
tribeSnapshotEventCreated,
|
||||
playerSnapshotEventCreated,
|
||||
),
|
||||
port.NewPlayerWatermillConsumer(
|
||||
nil,
|
||||
playerSnapshotSvc,
|
||||
playerSub,
|
||||
nopLogger,
|
||||
marshaler,
|
||||
"",
|
||||
playerSnapshotCmdCreate,
|
||||
),
|
||||
port.NewTribeWatermillConsumer(
|
||||
nil,
|
||||
tribeSnapshotSvc,
|
||||
tribeSub,
|
||||
nopLogger,
|
||||
marshaler,
|
||||
"",
|
||||
"",
|
||||
tribeSnapshotCmdCreate,
|
||||
),
|
||||
)
|
||||
|
||||
require.NoError(t, snapshotSvc.Create(ctx))
|
||||
|
||||
assert.EventuallyWithTf(t, func(collect *assert.CollectT) {
|
||||
require.NoError(collect, ctx.Err())
|
||||
|
||||
listParams := domain.NewListServersParams()
|
||||
require.NoError(collect, listParams.SetSort([]domain.ServerSort{
|
||||
domain.ServerSortKeyASC,
|
||||
}))
|
||||
require.NoError(collect, listParams.SetSpecial(domain.NullBool{
|
||||
Value: false,
|
||||
Valid: true,
|
||||
}))
|
||||
require.NoError(collect, listParams.SetLimit(domain.ServerListMaxLimit))
|
||||
|
||||
for {
|
||||
servers, err := serverRepo.List(ctx, listParams)
|
||||
require.NoError(collect, err)
|
||||
|
||||
if len(servers) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
for _, s := range servers {
|
||||
assert.WithinDuration(collect, time.Now(), s.PlayerSnapshotsCreatedAt(), time.Minute, s.Key())
|
||||
assert.WithinDuration(collect, time.Now(), s.TribeSnapshotsCreatedAt(), time.Minute, s.Key())
|
||||
}
|
||||
|
||||
require.NoError(collect, listParams.SetKeyGT(domain.NullString{
|
||||
Value: servers[len(servers)-1].Key(),
|
||||
Valid: true,
|
||||
}))
|
||||
}
|
||||
}, 30*time.Second, 500*time.Millisecond, "servers")
|
||||
|
||||
assert.EventuallyWithTf(t, func(collect *assert.CollectT) {
|
||||
require.NoError(collect, ctx.Err())
|
||||
|
||||
listTribesParams := domain.NewListTribesParams()
|
||||
require.NoError(collect, listTribesParams.SetSort([]domain.TribeSort{
|
||||
domain.TribeSortServerKeyASC,
|
||||
domain.TribeSortIDASC,
|
||||
}))
|
||||
require.NoError(collect, listTribesParams.SetDeleted(domain.NullBool{
|
||||
Value: false,
|
||||
Valid: true,
|
||||
}))
|
||||
require.NoError(collect, listTribesParams.SetLimit(domain.TribeListMaxLimit))
|
||||
|
||||
var allTribes domain.Tribes
|
||||
|
||||
for {
|
||||
tribes, err := tribeRepo.List(ctx, listTribesParams)
|
||||
require.NoError(collect, err)
|
||||
|
||||
if len(tribes) == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
allTribes = append(allTribes, tribes...)
|
||||
|
||||
require.NoError(collect, listTribesParams.SetIDGT(domain.NullInt{
|
||||
Value: tribes[len(tribes)-1].ID(),
|
||||
Valid: true,
|
||||
}))
|
||||
}
|
||||
|
||||
listSnapshotsParams := domain.NewListTribeSnapshotsParams()
|
||||
require.NoError(collect, listSnapshotsParams.SetSort([]domain.TribeSnapshotSort{
|
||||
domain.TribeSnapshotSortServerKeyASC,
|
||||
domain.TribeSnapshotSortDateASC,
|
||||
domain.TribeSnapshotSortIDASC,
|
||||
}))
|
||||
require.NoError(collect, listSnapshotsParams.SetLimit(domain.TribeSnapshotListMaxLimit))
|
||||
|
||||
cnt := 0
|
||||
|
||||
for {
|
||||
snapshots, err := tribeSnapshotRepo.List(ctx, listSnapshotsParams)
|
||||
require.NoError(collect, err)
|
||||
|
||||
if len(snapshots) == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
for _, ts := range snapshots {
|
||||
cnt++
|
||||
msg := fmt.Sprintf("TribeID=%d,ServerKey=%s", ts.TribeID(), ts.ServerKey())
|
||||
|
||||
idx := slices.IndexFunc(allTribes, func(t domain.Tribe) bool {
|
||||
return t.ID() == ts.TribeID() && t.ServerKey() == ts.ServerKey()
|
||||
})
|
||||
if !assert.GreaterOrEqual(
|
||||
collect,
|
||||
idx,
|
||||
0,
|
||||
msg,
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
tribe := allTribes[idx]
|
||||
|
||||
assert.NotZero(collect, ts.ID(), msg)
|
||||
assert.Equal(collect, tribe.ID(), ts.TribeID(), msg)
|
||||
assert.Equal(collect, tribe.ServerKey(), ts.ServerKey(), msg)
|
||||
assert.Equal(collect, tribe.NumMembers(), ts.NumMembers(), msg)
|
||||
assert.Equal(collect, tribe.NumVillages(), ts.NumVillages(), msg)
|
||||
assert.Equal(collect, tribe.Points(), ts.Points(), msg)
|
||||
assert.Equal(collect, tribe.AllPoints(), ts.AllPoints(), msg)
|
||||
assert.Equal(collect, tribe.Rank(), ts.Rank(), msg)
|
||||
assert.Equal(collect, tribe.OD(), ts.OD(), msg)
|
||||
assert.InDelta(collect, tribe.Dominance(), ts.Dominance(), 0.001, msg)
|
||||
assert.WithinDuration(collect, time.Now(), ts.CreatedAt(), time.Minute, msg)
|
||||
assert.WithinDuration(collect, time.Now(), ts.Date(), 24*time.Hour, msg)
|
||||
}
|
||||
|
||||
require.NoError(collect, listSnapshotsParams.SetOffset(listSnapshotsParams.Offset()+listSnapshotsParams.Limit()))
|
||||
}
|
||||
|
||||
//nolint:testifylint
|
||||
assert.Equal(collect, len(allTribes), cnt)
|
||||
}, 30*time.Second, 500*time.Millisecond, "tribes")
|
||||
|
||||
assert.EventuallyWithTf(t, func(collect *assert.CollectT) {
|
||||
require.NoError(collect, ctx.Err())
|
||||
|
||||
listPlayersParams := domain.NewListPlayersParams()
|
||||
require.NoError(collect, listPlayersParams.SetSort([]domain.PlayerSort{
|
||||
domain.PlayerSortServerKeyASC,
|
||||
domain.PlayerSortIDASC,
|
||||
}))
|
||||
require.NoError(collect, listPlayersParams.SetDeleted(domain.NullBool{
|
||||
Value: false,
|
||||
Valid: true,
|
||||
}))
|
||||
require.NoError(collect, listPlayersParams.SetLimit(domain.PlayerListMaxLimit))
|
||||
|
||||
var allPlayers domain.Players
|
||||
|
||||
for {
|
||||
players, err := playerRepo.List(ctx, listPlayersParams)
|
||||
require.NoError(collect, err)
|
||||
|
||||
if len(players) == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
allPlayers = append(allPlayers, players...)
|
||||
|
||||
require.NoError(collect, listPlayersParams.SetIDGT(domain.NullInt{
|
||||
Value: players[len(players)-1].ID(),
|
||||
Valid: true,
|
||||
}))
|
||||
}
|
||||
|
||||
listSnapshotsParams := domain.NewListPlayerSnapshotsParams()
|
||||
require.NoError(collect, listSnapshotsParams.SetSort([]domain.PlayerSnapshotSort{
|
||||
domain.PlayerSnapshotSortServerKeyASC,
|
||||
domain.PlayerSnapshotSortDateASC,
|
||||
domain.PlayerSnapshotSortIDASC,
|
||||
}))
|
||||
require.NoError(collect, listSnapshotsParams.SetLimit(domain.PlayerSnapshotListMaxLimit))
|
||||
|
||||
cnt := 0
|
||||
|
||||
for {
|
||||
snapshots, err := playerSnapshotRepo.List(ctx, listSnapshotsParams)
|
||||
require.NoError(collect, err)
|
||||
|
||||
if len(snapshots) == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
for _, ps := range snapshots {
|
||||
cnt++
|
||||
msg := fmt.Sprintf("PlayerID=%d,ServerKey=%s", ps.PlayerID(), ps.ServerKey())
|
||||
|
||||
idx := slices.IndexFunc(allPlayers, func(p domain.Player) bool {
|
||||
return p.ID() == ps.PlayerID() && p.ServerKey() == ps.ServerKey()
|
||||
})
|
||||
if !assert.GreaterOrEqual(
|
||||
collect,
|
||||
idx,
|
||||
0,
|
||||
msg,
|
||||
) {
|
||||
continue
|
||||
}
|
||||
|
||||
player := allPlayers[idx]
|
||||
|
||||
assert.NotZero(collect, ps.ID(), msg)
|
||||
assert.Equal(collect, player.ID(), ps.PlayerID(), msg)
|
||||
assert.Equal(collect, player.ServerKey(), ps.ServerKey(), msg)
|
||||
assert.Equal(collect, player.NumVillages(), ps.NumVillages(), msg)
|
||||
assert.Equal(collect, player.Points(), ps.Points(), msg)
|
||||
assert.Equal(collect, player.Rank(), ps.Rank(), msg)
|
||||
assert.Equal(collect, player.TribeID(), ps.TribeID(), msg)
|
||||
assert.Equal(collect, player.OD(), ps.OD(), msg)
|
||||
assert.WithinDuration(collect, time.Now(), ps.CreatedAt(), time.Minute, msg)
|
||||
assert.WithinDuration(collect, time.Now(), ps.Date(), 24*time.Hour, msg)
|
||||
}
|
||||
|
||||
require.NoError(collect, listSnapshotsParams.SetOffset(listSnapshotsParams.Offset()+listSnapshotsParams.Limit()))
|
||||
}
|
||||
|
||||
//nolint:testifylint
|
||||
assert.Equal(collect, len(allPlayers), cnt)
|
||||
}, 30*time.Second, 500*time.Millisecond, "players")
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -82,8 +82,8 @@ func TestClient_GetServerConfig(t *testing.T) {
|
|||
|
||||
cfg, err := newClient(srv.Client()).GetServerConfig(context.Background(), parseURL(t, srv.URL))
|
||||
require.NoError(t, err)
|
||||
assert.InEpsilon(t, 4.5, cfg.Speed, 0.01)
|
||||
assert.InEpsilon(t, 0.5, cfg.UnitSpeed, 0.01)
|
||||
assert.InDelta(t, 4.5, cfg.Speed, 0.01)
|
||||
assert.InDelta(t, 0.5, cfg.UnitSpeed, 0.01)
|
||||
assert.Equal(t, 1, cfg.Moral)
|
||||
|
||||
assert.Equal(t, 1, cfg.Build.Destroy)
|
||||
|
@ -109,8 +109,8 @@ func TestClient_GetServerConfig(t *testing.T) {
|
|||
assert.Equal(t, 0, cfg.Game.Church)
|
||||
assert.Equal(t, 0, cfg.Game.Watchtower)
|
||||
assert.Equal(t, 0, cfg.Game.Stronghold)
|
||||
assert.InEpsilon(t, 0.5, cfg.Game.FakeLimit, 0.01)
|
||||
assert.InEpsilon(t, 0.001, cfg.Game.BarbarianRise, 0)
|
||||
assert.InDelta(t, 0.5, cfg.Game.FakeLimit, 0.01)
|
||||
assert.InDelta(t, 0.001, cfg.Game.BarbarianRise, 0)
|
||||
assert.Equal(t, 1, cfg.Game.BarbarianShrink)
|
||||
assert.Equal(t, 800, cfg.Game.BarbarianMaxPoints)
|
||||
assert.Equal(t, 1, cfg.Game.Scavenging)
|
||||
|
@ -143,7 +143,7 @@ func TestClient_GetServerConfig(t *testing.T) {
|
|||
assert.Equal(t, 0, cfg.Snob.CheapRebuild)
|
||||
assert.Equal(t, 2, cfg.Snob.Rise)
|
||||
assert.Equal(t, 50, cfg.Snob.MaxDist)
|
||||
assert.InEpsilon(t, 1.0, cfg.Snob.Factor, 0.01)
|
||||
assert.InDelta(t, 1.0, cfg.Snob.Factor, 0.01)
|
||||
assert.Equal(t, 28000, cfg.Snob.CoinWood)
|
||||
assert.Equal(t, 30000, cfg.Snob.CoinStone)
|
||||
assert.Equal(t, 25000, cfg.Snob.CoinIron)
|
||||
|
@ -186,7 +186,7 @@ func TestClient_GetServerConfig(t *testing.T) {
|
|||
assert.Equal(t, 2, cfg.Night.Active)
|
||||
assert.Equal(t, 23, cfg.Night.StartHour)
|
||||
assert.Equal(t, 7, cfg.Night.EndHour)
|
||||
assert.InEpsilon(t, 3.5, cfg.Night.DefFactor, 0.01)
|
||||
assert.InDelta(t, 3.5, cfg.Night.DefFactor, 0.01)
|
||||
assert.Equal(t, 14, cfg.Night.Duration)
|
||||
|
||||
assert.Equal(t, 3, cfg.Win.Check)
|
||||
|
@ -207,99 +207,99 @@ func TestClient_GetUnitInfo(t *testing.T) {
|
|||
unitInfo, err := newClient(srv.Client()).GetUnitInfo(context.Background(), parseURL(t, srv.URL))
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.InEpsilon(t, 226.66666666667, unitInfo.Spear.BuildTime, 0.01)
|
||||
assert.InDelta(t, 226.66666666667, unitInfo.Spear.BuildTime, 0.01)
|
||||
assert.Equal(t, 1, unitInfo.Spear.Pop)
|
||||
assert.InEpsilon(t, 8.0, unitInfo.Spear.Speed, 0.01)
|
||||
assert.InDelta(t, 8.0, unitInfo.Spear.Speed, 0.01)
|
||||
assert.Equal(t, 10, unitInfo.Spear.Attack)
|
||||
assert.Equal(t, 15, unitInfo.Spear.Defense)
|
||||
assert.Equal(t, 45, unitInfo.Spear.DefenseCavalry)
|
||||
assert.Equal(t, 20, unitInfo.Spear.DefenseArcher)
|
||||
assert.Equal(t, 25, unitInfo.Spear.Carry)
|
||||
|
||||
assert.InEpsilon(t, 333.33333333333, unitInfo.Sword.BuildTime, 0.01)
|
||||
assert.InDelta(t, 333.33333333333, unitInfo.Sword.BuildTime, 0.01)
|
||||
assert.Equal(t, 1, unitInfo.Sword.Pop)
|
||||
assert.InEpsilon(t, 9.7777777777778, unitInfo.Sword.Speed, 0.01)
|
||||
assert.InDelta(t, 9.7777777777778, unitInfo.Sword.Speed, 0.01)
|
||||
assert.Equal(t, 25, unitInfo.Sword.Attack)
|
||||
assert.Equal(t, 50, unitInfo.Sword.Defense)
|
||||
assert.Equal(t, 15, unitInfo.Sword.DefenseCavalry)
|
||||
assert.Equal(t, 40, unitInfo.Sword.DefenseArcher)
|
||||
assert.Equal(t, 15, unitInfo.Sword.Carry)
|
||||
|
||||
assert.InEpsilon(t, 293.33333333333, unitInfo.Axe.BuildTime, 0.01)
|
||||
assert.InDelta(t, 293.33333333333, unitInfo.Axe.BuildTime, 0.01)
|
||||
assert.Equal(t, 1, unitInfo.Axe.Pop)
|
||||
assert.InEpsilon(t, 8.0, unitInfo.Axe.Speed, 0.01)
|
||||
assert.InDelta(t, 8.0, unitInfo.Axe.Speed, 0.01)
|
||||
assert.Equal(t, 40, unitInfo.Axe.Attack)
|
||||
assert.Equal(t, 10, unitInfo.Axe.Defense)
|
||||
assert.Equal(t, 5, unitInfo.Axe.DefenseCavalry)
|
||||
assert.Equal(t, 10, unitInfo.Axe.DefenseArcher)
|
||||
assert.Equal(t, 10, unitInfo.Axe.Carry)
|
||||
|
||||
assert.InEpsilon(t, 200.0, unitInfo.Spy.BuildTime, 0.01)
|
||||
assert.InDelta(t, 200.0, unitInfo.Spy.BuildTime, 0.01)
|
||||
assert.Equal(t, 2, unitInfo.Spy.Pop)
|
||||
assert.InEpsilon(t, 4.0, unitInfo.Spy.Speed, 0.01)
|
||||
assert.InDelta(t, 4.0, unitInfo.Spy.Speed, 0.01)
|
||||
assert.Equal(t, 0, unitInfo.Spy.Attack)
|
||||
assert.Equal(t, 2, unitInfo.Spy.Defense)
|
||||
assert.Equal(t, 1, unitInfo.Spy.DefenseCavalry)
|
||||
assert.Equal(t, 2, unitInfo.Spy.DefenseArcher)
|
||||
assert.Equal(t, 0, unitInfo.Spy.Carry)
|
||||
|
||||
assert.InEpsilon(t, 400.0, unitInfo.Light.BuildTime, 0.01)
|
||||
assert.InDelta(t, 400.0, unitInfo.Light.BuildTime, 0.01)
|
||||
assert.Equal(t, 4, unitInfo.Light.Pop)
|
||||
assert.InEpsilon(t, 4.4444444444444, unitInfo.Light.Speed, 0.01)
|
||||
assert.InDelta(t, 4.4444444444444, unitInfo.Light.Speed, 0.01)
|
||||
assert.Equal(t, 130, unitInfo.Light.Attack)
|
||||
assert.Equal(t, 30, unitInfo.Light.Defense)
|
||||
assert.Equal(t, 40, unitInfo.Light.DefenseCavalry)
|
||||
assert.Equal(t, 30, unitInfo.Light.DefenseArcher)
|
||||
assert.Equal(t, 80, unitInfo.Light.Carry)
|
||||
|
||||
assert.InEpsilon(t, 600.0, unitInfo.Marcher.BuildTime, 0.01)
|
||||
assert.InDelta(t, 600.0, unitInfo.Marcher.BuildTime, 0.01)
|
||||
assert.Equal(t, 5, unitInfo.Marcher.Pop)
|
||||
assert.InEpsilon(t, 4.4444444444444, unitInfo.Marcher.Speed, 0.01)
|
||||
assert.InDelta(t, 4.4444444444444, unitInfo.Marcher.Speed, 0.01)
|
||||
assert.Equal(t, 120, unitInfo.Marcher.Attack)
|
||||
assert.Equal(t, 40, unitInfo.Marcher.Defense)
|
||||
assert.Equal(t, 30, unitInfo.Marcher.DefenseCavalry)
|
||||
assert.Equal(t, 50, unitInfo.Marcher.DefenseArcher)
|
||||
assert.Equal(t, 50, unitInfo.Marcher.Carry)
|
||||
|
||||
assert.InEpsilon(t, 800.0, unitInfo.Heavy.BuildTime, 0.01)
|
||||
assert.InDelta(t, 800.0, unitInfo.Heavy.BuildTime, 0.01)
|
||||
assert.Equal(t, 6, unitInfo.Heavy.Pop)
|
||||
assert.InEpsilon(t, 4.8888888888889, unitInfo.Heavy.Speed, 0.01)
|
||||
assert.InDelta(t, 4.8888888888889, unitInfo.Heavy.Speed, 0.01)
|
||||
assert.Equal(t, 150, unitInfo.Heavy.Attack)
|
||||
assert.Equal(t, 200, unitInfo.Heavy.Defense)
|
||||
assert.Equal(t, 80, unitInfo.Heavy.DefenseCavalry)
|
||||
assert.Equal(t, 180, unitInfo.Heavy.DefenseArcher)
|
||||
assert.Equal(t, 50, unitInfo.Heavy.Carry)
|
||||
|
||||
assert.InEpsilon(t, 1066.6666666667, unitInfo.Ram.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1066.6666666667, unitInfo.Ram.BuildTime, 0.01)
|
||||
assert.Equal(t, 5, unitInfo.Ram.Pop)
|
||||
assert.InEpsilon(t, 13.333333333333, unitInfo.Ram.Speed, 0.01)
|
||||
assert.InDelta(t, 13.333333333333, unitInfo.Ram.Speed, 0.01)
|
||||
assert.Equal(t, 2, unitInfo.Ram.Attack)
|
||||
assert.Equal(t, 20, unitInfo.Ram.Defense)
|
||||
assert.Equal(t, 50, unitInfo.Ram.DefenseCavalry)
|
||||
assert.Equal(t, 20, unitInfo.Ram.DefenseArcher)
|
||||
assert.Equal(t, 0, unitInfo.Ram.Carry)
|
||||
|
||||
assert.InEpsilon(t, 1600.0, unitInfo.Catapult.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1600.0, unitInfo.Catapult.BuildTime, 0.01)
|
||||
assert.Equal(t, 8, unitInfo.Catapult.Pop)
|
||||
assert.InEpsilon(t, 13.333333333333, unitInfo.Catapult.Speed, 0.01)
|
||||
assert.InDelta(t, 13.333333333333, unitInfo.Catapult.Speed, 0.01)
|
||||
assert.Equal(t, 100, unitInfo.Catapult.Attack)
|
||||
assert.Equal(t, 100, unitInfo.Catapult.Defense)
|
||||
assert.Equal(t, 50, unitInfo.Catapult.DefenseCavalry)
|
||||
assert.Equal(t, 100, unitInfo.Catapult.DefenseArcher)
|
||||
assert.Equal(t, 0, unitInfo.Catapult.Carry)
|
||||
|
||||
assert.InEpsilon(t, 4000.0, unitInfo.Snob.BuildTime, 0.01)
|
||||
assert.InDelta(t, 4000.0, unitInfo.Snob.BuildTime, 0.01)
|
||||
assert.Equal(t, 100, unitInfo.Snob.Pop)
|
||||
assert.InEpsilon(t, 15.555555555556, unitInfo.Snob.Speed, 0.01)
|
||||
assert.InDelta(t, 15.555555555556, unitInfo.Snob.Speed, 0.01)
|
||||
assert.Equal(t, 30, unitInfo.Snob.Attack)
|
||||
assert.Equal(t, 100, unitInfo.Snob.Defense)
|
||||
assert.Equal(t, 50, unitInfo.Snob.DefenseCavalry)
|
||||
assert.Equal(t, 100, unitInfo.Snob.DefenseArcher)
|
||||
assert.Equal(t, 0, unitInfo.Snob.Carry)
|
||||
|
||||
assert.InEpsilon(t, 1.0, unitInfo.Militia.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.0, unitInfo.Militia.BuildTime, 0.01)
|
||||
assert.Equal(t, 0, unitInfo.Militia.Pop)
|
||||
assert.InEpsilon(t, 0.016666666666667, unitInfo.Militia.Speed, 0.01)
|
||||
assert.InDelta(t, 0.016666666666667, unitInfo.Militia.Speed, 0.01)
|
||||
assert.Equal(t, 0, unitInfo.Militia.Attack)
|
||||
assert.Equal(t, 15, unitInfo.Militia.Defense)
|
||||
assert.Equal(t, 45, unitInfo.Militia.DefenseCavalry)
|
||||
|
@ -328,12 +328,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 80, buildingInfo.Main.Stone)
|
||||
assert.Equal(t, 70, buildingInfo.Main.Iron)
|
||||
assert.Equal(t, 5, buildingInfo.Main.Pop)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Main.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.275, buildingInfo.Main.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Main.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Main.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 900.0, buildingInfo.Main.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Main.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Main.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.275, buildingInfo.Main.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Main.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Main.PopFactor, 0.01)
|
||||
assert.InDelta(t, 900.0, buildingInfo.Main.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Main.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 25, buildingInfo.Barracks.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Barracks.MinLevel)
|
||||
|
@ -341,12 +341,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 170, buildingInfo.Barracks.Stone)
|
||||
assert.Equal(t, 90, buildingInfo.Barracks.Iron)
|
||||
assert.Equal(t, 7, buildingInfo.Barracks.Pop)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Barracks.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.28, buildingInfo.Barracks.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Barracks.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Barracks.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 1800.0, buildingInfo.Barracks.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Barracks.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Barracks.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.28, buildingInfo.Barracks.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Barracks.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Barracks.PopFactor, 0.01)
|
||||
assert.InDelta(t, 1800.0, buildingInfo.Barracks.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Barracks.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 20, buildingInfo.Stable.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Stable.MinLevel)
|
||||
|
@ -354,12 +354,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 240, buildingInfo.Stable.Stone)
|
||||
assert.Equal(t, 260, buildingInfo.Stable.Iron)
|
||||
assert.Equal(t, 8, buildingInfo.Stable.Pop)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Stable.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.28, buildingInfo.Stable.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Stable.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Stable.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 6000.0, buildingInfo.Stable.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Stable.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Stable.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.28, buildingInfo.Stable.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Stable.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Stable.PopFactor, 0.01)
|
||||
assert.InDelta(t, 6000.0, buildingInfo.Stable.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Stable.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 15, buildingInfo.Garage.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Garage.MinLevel)
|
||||
|
@ -367,12 +367,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 240, buildingInfo.Garage.Stone)
|
||||
assert.Equal(t, 260, buildingInfo.Garage.Iron)
|
||||
assert.Equal(t, 8, buildingInfo.Garage.Pop)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Garage.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.28, buildingInfo.Garage.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Garage.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Garage.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 6000.0, buildingInfo.Garage.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Garage.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Garage.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.28, buildingInfo.Garage.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Garage.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Garage.PopFactor, 0.01)
|
||||
assert.InDelta(t, 6000.0, buildingInfo.Garage.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Garage.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 20, buildingInfo.Watchtower.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Watchtower.MinLevel)
|
||||
|
@ -380,12 +380,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 14000, buildingInfo.Watchtower.Stone)
|
||||
assert.Equal(t, 10000, buildingInfo.Watchtower.Iron)
|
||||
assert.Equal(t, 500, buildingInfo.Watchtower.Pop)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Watchtower.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Watchtower.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.18, buildingInfo.Watchtower.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.18, buildingInfo.Watchtower.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 13200.0, buildingInfo.Watchtower.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Watchtower.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Watchtower.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Watchtower.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.18, buildingInfo.Watchtower.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.18, buildingInfo.Watchtower.PopFactor, 0.01)
|
||||
assert.InDelta(t, 13200.0, buildingInfo.Watchtower.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Watchtower.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 1, buildingInfo.Snob.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Snob.MinLevel)
|
||||
|
@ -393,12 +393,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 25000, buildingInfo.Snob.Stone)
|
||||
assert.Equal(t, 10000, buildingInfo.Snob.Iron)
|
||||
assert.Equal(t, 80, buildingInfo.Snob.Pop)
|
||||
assert.InEpsilon(t, 2.0, buildingInfo.Snob.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 2.0, buildingInfo.Snob.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 2.0, buildingInfo.Snob.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Snob.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 586800.0, buildingInfo.Snob.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Snob.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 2.0, buildingInfo.Snob.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 2.0, buildingInfo.Snob.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 2.0, buildingInfo.Snob.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Snob.PopFactor, 0.01)
|
||||
assert.InDelta(t, 586800.0, buildingInfo.Snob.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Snob.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 20, buildingInfo.Smith.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Smith.MinLevel)
|
||||
|
@ -406,12 +406,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 180, buildingInfo.Smith.Stone)
|
||||
assert.Equal(t, 240, buildingInfo.Smith.Iron)
|
||||
assert.Equal(t, 20, buildingInfo.Smith.Pop)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Smith.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.275, buildingInfo.Smith.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Smith.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Smith.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 6000.0, buildingInfo.Smith.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Smith.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Smith.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.275, buildingInfo.Smith.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Smith.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Smith.PopFactor, 0.01)
|
||||
assert.InDelta(t, 6000.0, buildingInfo.Smith.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Smith.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 1, buildingInfo.Place.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Place.MinLevel)
|
||||
|
@ -419,12 +419,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 40, buildingInfo.Place.Stone)
|
||||
assert.Equal(t, 30, buildingInfo.Place.Iron)
|
||||
assert.Equal(t, 0, buildingInfo.Place.Pop)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Place.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.275, buildingInfo.Place.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Place.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Place.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 10860.0, buildingInfo.Place.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Place.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Place.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.275, buildingInfo.Place.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Place.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Place.PopFactor, 0.01)
|
||||
assert.InDelta(t, 10860.0, buildingInfo.Place.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Place.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 1, buildingInfo.Statue.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Statue.MinLevel)
|
||||
|
@ -432,12 +432,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 220, buildingInfo.Statue.Stone)
|
||||
assert.Equal(t, 220, buildingInfo.Statue.Iron)
|
||||
assert.Equal(t, 10, buildingInfo.Statue.Pop)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Statue.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.275, buildingInfo.Statue.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Statue.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Statue.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 1500.0, buildingInfo.Statue.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Statue.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Statue.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.275, buildingInfo.Statue.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Statue.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Statue.PopFactor, 0.01)
|
||||
assert.InDelta(t, 1500.0, buildingInfo.Statue.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Statue.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 25, buildingInfo.Market.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Market.MinLevel)
|
||||
|
@ -445,12 +445,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 100, buildingInfo.Market.Stone)
|
||||
assert.Equal(t, 100, buildingInfo.Market.Iron)
|
||||
assert.Equal(t, 20, buildingInfo.Market.Pop)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Market.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.275, buildingInfo.Market.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Market.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Market.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 2700.0, buildingInfo.Market.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Market.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Market.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.275, buildingInfo.Market.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Market.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Market.PopFactor, 0.01)
|
||||
assert.InDelta(t, 2700.0, buildingInfo.Market.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Market.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 30, buildingInfo.Wood.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Wood.MinLevel)
|
||||
|
@ -458,12 +458,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 60, buildingInfo.Wood.Stone)
|
||||
assert.Equal(t, 40, buildingInfo.Wood.Iron)
|
||||
assert.Equal(t, 5, buildingInfo.Wood.Pop)
|
||||
assert.InEpsilon(t, 1.25, buildingInfo.Wood.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.275, buildingInfo.Wood.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.245, buildingInfo.Wood.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.155, buildingInfo.Wood.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 900.0, buildingInfo.Wood.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Wood.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.25, buildingInfo.Wood.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.275, buildingInfo.Wood.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.245, buildingInfo.Wood.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.155, buildingInfo.Wood.PopFactor, 0.01)
|
||||
assert.InDelta(t, 900.0, buildingInfo.Wood.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Wood.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 30, buildingInfo.Stone.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Stone.MinLevel)
|
||||
|
@ -471,12 +471,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 50, buildingInfo.Stone.Stone)
|
||||
assert.Equal(t, 40, buildingInfo.Stone.Iron)
|
||||
assert.Equal(t, 10, buildingInfo.Stone.Pop)
|
||||
assert.InEpsilon(t, 1.27, buildingInfo.Stone.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.265, buildingInfo.Stone.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.24, buildingInfo.Stone.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.14, buildingInfo.Stone.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 900.0, buildingInfo.Stone.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Stone.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.27, buildingInfo.Stone.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.265, buildingInfo.Stone.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.24, buildingInfo.Stone.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.14, buildingInfo.Stone.PopFactor, 0.01)
|
||||
assert.InDelta(t, 900.0, buildingInfo.Stone.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Stone.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 30, buildingInfo.Iron.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Iron.MinLevel)
|
||||
|
@ -484,12 +484,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 65, buildingInfo.Iron.Stone)
|
||||
assert.Equal(t, 70, buildingInfo.Iron.Iron)
|
||||
assert.Equal(t, 10, buildingInfo.Iron.Pop)
|
||||
assert.InEpsilon(t, 1.252, buildingInfo.Iron.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.275, buildingInfo.Iron.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.24, buildingInfo.Iron.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Iron.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 1080.0, buildingInfo.Iron.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Iron.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.252, buildingInfo.Iron.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.275, buildingInfo.Iron.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.24, buildingInfo.Iron.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Iron.PopFactor, 0.01)
|
||||
assert.InDelta(t, 1080.0, buildingInfo.Iron.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Iron.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 30, buildingInfo.Farm.MaxLevel)
|
||||
assert.Equal(t, 1, buildingInfo.Farm.MinLevel)
|
||||
|
@ -497,12 +497,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 40, buildingInfo.Farm.Stone)
|
||||
assert.Equal(t, 30, buildingInfo.Farm.Iron)
|
||||
assert.Equal(t, 0, buildingInfo.Farm.Pop)
|
||||
assert.InEpsilon(t, 1.3, buildingInfo.Farm.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.32, buildingInfo.Farm.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.29, buildingInfo.Farm.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.0, buildingInfo.Farm.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 1200.0, buildingInfo.Farm.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Farm.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.3, buildingInfo.Farm.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.32, buildingInfo.Farm.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.29, buildingInfo.Farm.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.0, buildingInfo.Farm.PopFactor, 0.01)
|
||||
assert.InDelta(t, 1200.0, buildingInfo.Farm.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Farm.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 30, buildingInfo.Storage.MaxLevel)
|
||||
assert.Equal(t, 1, buildingInfo.Storage.MinLevel)
|
||||
|
@ -510,12 +510,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 50, buildingInfo.Storage.Stone)
|
||||
assert.Equal(t, 40, buildingInfo.Storage.Iron)
|
||||
assert.Equal(t, 0, buildingInfo.Storage.Pop)
|
||||
assert.InEpsilon(t, 1.265, buildingInfo.Storage.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.27, buildingInfo.Storage.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.245, buildingInfo.Storage.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.15, buildingInfo.Storage.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 1020.0, buildingInfo.Storage.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Storage.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.265, buildingInfo.Storage.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.27, buildingInfo.Storage.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.245, buildingInfo.Storage.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.15, buildingInfo.Storage.PopFactor, 0.01)
|
||||
assert.InDelta(t, 1020.0, buildingInfo.Storage.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Storage.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 10, buildingInfo.Hide.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Hide.MinLevel)
|
||||
|
@ -523,12 +523,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 60, buildingInfo.Hide.Stone)
|
||||
assert.Equal(t, 50, buildingInfo.Hide.Iron)
|
||||
assert.Equal(t, 2, buildingInfo.Hide.Pop)
|
||||
assert.InEpsilon(t, 1.25, buildingInfo.Hide.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.25, buildingInfo.Hide.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.25, buildingInfo.Hide.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Hide.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 1800.0, buildingInfo.Hide.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Hide.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.25, buildingInfo.Hide.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.25, buildingInfo.Hide.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.25, buildingInfo.Hide.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Hide.PopFactor, 0.01)
|
||||
assert.InDelta(t, 1800.0, buildingInfo.Hide.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Hide.BuildTimeFactor, 0.01)
|
||||
|
||||
assert.Equal(t, 20, buildingInfo.Wall.MaxLevel)
|
||||
assert.Equal(t, 0, buildingInfo.Wall.MinLevel)
|
||||
|
@ -536,12 +536,12 @@ func TestClient_GetBuildingInfo(t *testing.T) {
|
|||
assert.Equal(t, 100, buildingInfo.Wall.Stone)
|
||||
assert.Equal(t, 20, buildingInfo.Wall.Iron)
|
||||
assert.Equal(t, 5, buildingInfo.Wall.Pop)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Wall.WoodFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.275, buildingInfo.Wall.StoneFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.26, buildingInfo.Wall.IronFactor, 0.01)
|
||||
assert.InEpsilon(t, 1.17, buildingInfo.Wall.PopFactor, 0.01)
|
||||
assert.InEpsilon(t, 3600.0, buildingInfo.Wall.BuildTime, 0.01)
|
||||
assert.InEpsilon(t, 1.2, buildingInfo.Wall.BuildTimeFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Wall.WoodFactor, 0.01)
|
||||
assert.InDelta(t, 1.275, buildingInfo.Wall.StoneFactor, 0.01)
|
||||
assert.InDelta(t, 1.26, buildingInfo.Wall.IronFactor, 0.01)
|
||||
assert.InDelta(t, 1.17, buildingInfo.Wall.PopFactor, 0.01)
|
||||
assert.InDelta(t, 3600.0, buildingInfo.Wall.BuildTime, 0.01)
|
||||
assert.InDelta(t, 1.2, buildingInfo.Wall.BuildTimeFactor, 0.01)
|
||||
}
|
||||
|
||||
func TestClient_GetTribes(t *testing.T) {
|
||||
|
|
Loading…
Reference in New Issue