| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- package main
- import (
- "f1-game/tool/client-cli/cli"
- "fmt"
- "math/rand"
- "sync"
- "testing"
- "time"
- cherryTime "github.com/cherry-game/cherry/extend/time"
- cherryLogger "github.com/cherry-game/cherry/logger"
- )
- func TestSU1RegisterDevAccount(t *testing.T) {
- var (
- url = "http://192.168.1.232:18080"
- )
- accountList := make(map[string]string)
- for i := 1; i <= 10000; i++ {
- key := fmt.Sprintf("susu%d", i)
- accountList[key] = key
- }
- cli.RegisterDevAccounts(url, accountList)
- }
- func TestSU_1_10000_EnterServer(t *testing.T) {
- var (
- url = "http://dev.f1.chun-pu.com"
- addr = "192.168.1.232:30001"
- gameNodeID = "3"
- testAccounts = make(map[string]string)
- pid = "2188001"
- maxAccountNum = 1
- )
- for i := 1; i <= maxAccountNum; i++ {
- key := fmt.Sprintf("susu%d", i)
- testAccounts[key] = key
- cli.RegisterDevAccount(url, key, key)
- }
- now := cherryTime.Now()
- wg := &sync.WaitGroup{}
- wg.Add(1)
- for userName, password := range testAccounts {
- go func(userName, password string) {
- time.Sleep(time.Duration(rand.Int31n(2)) * time.Millisecond)
- cli.EnterServer(url, pid, userName, password, addr, gameNodeID, false)
- wg.Done()
- }(userName, password)
- }
- wg.Wait()
- cherryLogger.Infof("elapsedTime = %dms", now.NowDiffMillisecond())
- }
- func Test_Local_SU_3(t *testing.T) {
- var (
- url = "http://dev.f1.chun-pu.com/"
- addr = "127.0.0.1:30001"
- gameNodeID = "3"
- userAndPwd = "susux3"
- pid = "2188001"
- )
- cli.RegisterDevAccount(url, userAndPwd, userAndPwd)
- //wg := &sync.WaitGroup{}
- //wg.Add(1)
- robot := cli.EnterServer(url, pid, userAndPwd, userAndPwd, addr, gameNodeID, true)
- if robot != nil {
- //robot.ChargeCreate()
- robot.Time()
- }
- time.Sleep(30 * time.Second)
- //wg.Wait()
- }
|