package data import ( "context" "fmt" "github.com/go-kratos/kratos/v2/log" "github.com/shopspring/decimal" "matchmaking-system/internal/biz/structure" "matchmaking-system/internal/pkg/flags" "matchmaking-system/internal/pkg/logging/applogger" models "matchmaking-system/internal/pkg/model" "reflect" "strconv" "strings" "testing" "time" ) func TestCheckShareSystemTime(t *testing.T) { var makeType int var err error symbol := "moneySubscribe-19" if strings.Contains(symbol, "-") { splitStr := strings.Split(symbol, "-") applogger.Debug("Subscribe type:%v", symbol) if len(splitStr) == 2 { symbol = splitStr[0] makeType, err = strconv.Atoi(splitStr[1]) if err != nil { makeType = 0 } } applogger.Debug("Subscribe type:%v", symbol) } else { makeType = 0 } applogger.Error("Subscribe type:%v---%v", makeType, symbol) return // 市场开闭盘时间 timeValue, checkWeekday := MarketCheckOpenAndCloseTime(3) dateTime, _ := time.Parse(flags.LayoutOne, time.Now().Format(flags.LayoutOne)) fmt.Println("当前时间:", dateTime) fmt.Println("上午开盘时间:", timeValue.AmOpenTime) fmt.Println("上午闭盘时间:", timeValue.AmCloseTime) fmt.Println("下午开盘时间:", timeValue.PmOpenTime) fmt.Println("下午闭盘时间:", timeValue.PmCloseTime) fmt.Println("不是节假日:", checkWeekday) // 判定上午盘 checkAmTime := dateTime.Equal(timeValue.AmOpenTime) || dateTime.Equal(timeValue.AmCloseTime) if timeValue.AmOpenTime.Before(timeValue.AmCloseTime) { fmt.Println("上午同天盘判定。。。。。") // 同一天 if dateTime.After(timeValue.AmOpenTime) && dateTime.Before(timeValue.AmCloseTime) || checkAmTime { fmt.Println("上午正常的开盘时间。。。。。") } } else { fmt.Println("上午跨天盘判定。。。。。") // 跨天 if dateTime.After(timeValue.AmOpenTime) || dateTime.Before(timeValue.AmCloseTime) || checkAmTime { fmt.Println("上午正常的开盘时间。。。。。") } } // 判定下午盘 checkPmTime := dateTime.Equal(timeValue.PmOpenTime) || dateTime.Equal(timeValue.PmCloseTime) if timeValue.PmOpenTime.Before(timeValue.PmCloseTime) { fmt.Println("下午同天盘判定。。。。。") // 同一天 if dateTime.After(timeValue.PmOpenTime) && dateTime.Before(timeValue.PmCloseTime) || checkPmTime { fmt.Println("下午正常的开盘时间。。。。。") } } else { fmt.Println("下午跨天盘判定。。。。。") // 跨天 if dateTime.After(timeValue.PmOpenTime) || dateTime.Before(timeValue.PmCloseTime) || checkPmTime { fmt.Println("下午正常的开盘时间。。。。。") } } return type args struct { timeStr time.Time } tests := []struct { name string args args want bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := CheckShareSystemTime(tt.args.timeStr); got != tt.want { t.Errorf("CheckShareSystemTime() = %v, want %v", got, tt.want) } }) } } func TestCheckTypeStatus(t *testing.T) { type args struct { status int64 } tests := []struct { name string args args want bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := CheckTypeStatus(tt.args.status); got != tt.want { t.Errorf("CheckTypeStatus() = %v, want %v", got, tt.want) } }) } } func TestGetBotContractList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotContractList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotContractList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotContractList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotDigitalList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotDigitalList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotDigitalList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotDigitalList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockBlockList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want map[int64][]string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockBlockList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockBlockList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockBlockList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockBlockListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want map[int64][]string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockBlockListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockBlockListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockBlockListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockBrlListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockBrlListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockBrlListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockBrlListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockEurListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockEurListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockEurListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockEurListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockFurListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockFurListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockFurListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockFurListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockGbxListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockGbxListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockGbxListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockGbxListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockHkdList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockHkdList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockHkdList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockHkdList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockHkdListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockHkdListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockHkdListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockHkdListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockIdnList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockIdnList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockIdnList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockIdnList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockIdnListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockIdnListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockIdnListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockIdnListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockInList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockInList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockInList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockInList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockInListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockInListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockInListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockInListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockMysList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockMysList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockMysList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockMysList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockMysListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockMysListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockMysListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockMysListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockOptionInrList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockOptionInrList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockOptionInrList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockOptionInrList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockOptionInrListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockOptionInrListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockOptionInrListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockOptionInrListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockSgdList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockSgdList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockSgdList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockSgdList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockSgdListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockSgdListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockSgdListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockSgdListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockThaList(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockThaList(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockThaList() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockThaList() got = %v, want %v", got, tt.want) } }) } } func TestGetBotStockThaListByStockId(t *testing.T) { type args struct { ctx context.Context uo *Data } tests := []struct { name string args args want []string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotStockThaListByStockId(tt.args.ctx, tt.args.uo) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockThaListByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotStockThaListByStockId() got = %v, want %v", got, tt.want) } }) } } func TestGetBotUserArrears(t *testing.T) { type args struct { ctx context.Context } tests := []struct { name string args args want map[int64]int64 wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetBotUserArrears(tt.args.ctx) if (err != nil) != tt.wantErr { t.Errorf("GetBotUserArrears() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotUserArrears() got = %v, want %v", got, tt.want) } }) } } func TestGetCacheForcedClosure(t *testing.T) { type args struct { steUpKey string symbol string } tests := []struct { name string args args want decimal.Decimal }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := GetCacheForcedClosure(tt.args.steUpKey, tt.args.symbol); !reflect.DeepEqual(got, tt.want) { t.Errorf("GetCacheForcedClosure() = %v, want %v", got, tt.want) } }) } } func TestGetCacheLimitOrDown(t *testing.T) { type args struct { steUpKey string symbol string } tests := []struct { name string args args want decimal.Decimal }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := GetCacheLimitOrDown(tt.args.steUpKey, tt.args.symbol); !reflect.DeepEqual(got, tt.want) { t.Errorf("GetCacheLimitOrDown() = %v, want %v", got, tt.want) } }) } } func TestGetCacheNumericCode(t *testing.T) { type args struct { keys string } tests := []struct { name string args args want string }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := GetCacheNumericCode(tt.args.keys); got != tt.want { t.Errorf("GetCacheNumericCode() = %v, want %v", got, tt.want) } }) } } func TestGetCacheStockBlockStatus(t *testing.T) { type args struct { steUpKey string symbol string } tests := []struct { name string args args want bool want1 string want2 int want3 time.Time }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, got1, got2, got3 := GetCacheStockBlockStatus(tt.args.steUpKey, tt.args.symbol) if got != tt.want { t.Errorf("GetCacheStockBlockStatus() got = %v, want %v", got, tt.want) } if got1 != tt.want1 { t.Errorf("GetCacheStockBlockStatus() got1 = %v, want %v", got1, tt.want1) } if got2 != tt.want2 { t.Errorf("GetCacheStockBlockStatus() got2 = %v, want %v", got2, tt.want2) } if !reflect.DeepEqual(got3, tt.want3) { t.Errorf("GetCacheStockBlockStatus() got3 = %v, want %v", got3, tt.want3) } }) } } func TestGetCacheStockMarketLeverStatus(t *testing.T) { type args struct { key string code string } tests := []struct { name string args args want *structure.ShareSystem }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := GetCacheStockMarketLeverStatus(tt.args.key, tt.args.code); !reflect.DeepEqual(got, tt.want) { t.Errorf("GetCacheStockMarketLeverStatus() = %v, want %v", got, tt.want) } }) } } func TestGetCacheStockMarketStatus(t *testing.T) { type args struct { steUpKey string symbol string } tests := []struct { name string args args want bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := GetCacheStockMarketStatus(tt.args.steUpKey, tt.args.symbol); got != tt.want { t.Errorf("GetCacheStockMarketStatus() = %v, want %v", got, tt.want) } }) } } func TestGetCacheStockMarketStatusT(t *testing.T) { type args struct { steUpKey string symbol string } tests := []struct { name string args args want int }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := GetCacheStockMarketStatusT(tt.args.steUpKey, tt.args.symbol); got != tt.want { t.Errorf("GetCacheStockMarketStatusT() = %v, want %v", got, tt.want) } }) } } func TestGetContractSystemSecond(t *testing.T) { tests := []struct { name string want map[int64]structure.ProportionSystem wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetContractSystemSecond() if (err != nil) != tt.wantErr { t.Errorf("GetContractSystemSecond() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetContractSystemSecond() got = %v, want %v", got, tt.want) } }) } } func TestGetContractSystemSetUp(t *testing.T) { type args struct { symbol string } tests := []struct { name string args args want *structure.ContractSystem wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got, err := GetContractSystemSetUp(tt.args.symbol) if (err != nil) != tt.wantErr { t.Errorf("GetContractSystemSetUp() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetContractSystemSetUp() got = %v, want %v", got, tt.want) } }) } } func TestGetKeepDecimal(t *testing.T) { type args struct { steUpKey string symbol string } tests := []struct { name string args args want int }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := GetKeepDecimal(tt.args.steUpKey, tt.args.symbol); got != tt.want { t.Errorf("GetKeepDecimal() = %v, want %v", got, tt.want) } }) } } func TestGetOptionInrForcedClosure(t *testing.T) { type args struct { steUpKey string symbol string } tests := []struct { name string args args want decimal.Decimal }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := GetOptionInrForcedClosure(tt.args.steUpKey, tt.args.symbol); !reflect.DeepEqual(got, tt.want) { t.Errorf("GetOptionInrForcedClosure() = %v, want %v", got, tt.want) } }) } } func TestGetStockName(t *testing.T) { type args struct { steUpKey string symbol string } tests := []struct { name string args args want string }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := GetStockName(tt.args.steUpKey, tt.args.symbol); got != tt.want { t.Errorf("GetStockName() = %v, want %v", got, tt.want) } }) } } func TestGetStrongFlatteningThreshold(t *testing.T) { type args struct { userId int64 } tests := []struct { name string args args want bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := GetStrongFlatteningThreshold(tt.args.userId); got != tt.want { t.Errorf("GetStrongFlatteningThreshold() = %v, want %v", got, tt.want) } }) } } func TestMarketCheckOpenAndCloseTime(t *testing.T) { type args struct { marketType int } tests := []struct { name string args args wantTimeValue flags.TimeValue wantCheckWeekday bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { gotTimeValue, gotCheckWeekday := MarketCheckOpenAndCloseTime(tt.args.marketType) if !reflect.DeepEqual(gotTimeValue, tt.wantTimeValue) { t.Errorf("MarketCheckOpenAndCloseTime() gotTimeValue = %v, want %v", gotTimeValue, tt.wantTimeValue) } if gotCheckWeekday != tt.wantCheckWeekday { t.Errorf("MarketCheckOpenAndCloseTime() gotCheckWeekday = %v, want %v", gotCheckWeekday, tt.wantCheckWeekday) } }) } } func TestNegativeValue(t *testing.T) { type args struct { value string } tests := []struct { name string args args want string }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := NegativeValue(tt.args.value); got != tt.want { t.Errorf("NegativeValue() = %v, want %v", got, tt.want) } }) } } func TestPryNumInit(t *testing.T) { type args struct { order structure.ShareOrder } tests := []struct { name string args args want structure.ShareOrder }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := PryNumInit(tt.args.order); !reflect.DeepEqual(got, tt.want) { t.Errorf("PryNumInit() = %v, want %v", got, tt.want) } }) } } func TestQuerySystemCache(t *testing.T) { type args struct { marketType int } tests := []struct { name string args args wantTimeValue flags.TimeValue }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if gotTimeValue := QuerySystemCache(tt.args.marketType); !reflect.DeepEqual(gotTimeValue, tt.wantTimeValue) { t.Errorf("QuerySystemCache() = %v, want %v", gotTimeValue, tt.wantTimeValue) } }) } } func TestSystemDealWithLever(t *testing.T) { type args struct { order structure.ShareOrder } tests := []struct { name string args args want decimal.Decimal }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := SystemDealWithLever(tt.args.order); !reflect.DeepEqual(got, tt.want) { t.Errorf("SystemDealWithLever() = %v, want %v", got, tt.want) } }) } } func TestSystemShareMarketLeverStatus(t *testing.T) { type args struct { market string code string userId int64 } tests := []struct { name string args args want *structure.ShareSystem }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := SystemShareMarketLeverStatus(tt.args.market, tt.args.code, tt.args.userId); !reflect.DeepEqual(got, tt.want) { t.Errorf("SystemShareMarketLeverStatus() = %v, want %v", got, tt.want) } }) } } func TestSystemTimeGenerate(t *testing.T) { type args struct { market string share string orderTime time.Time } tests := []struct { name string args args want time.Time }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := SystemTimeGenerate(tt.args.market, tt.args.share, tt.args.orderTime); !reflect.DeepEqual(got, tt.want) { t.Errorf("SystemTimeGenerate() = %v, want %v", got, tt.want) } }) } } func TestTimeResult(t *testing.T) { type args struct { marketType int } tests := []struct { name string args args want flags.TimeValue }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if got := TimeResult(tt.args.marketType); !reflect.DeepEqual(got, tt.want) { t.Errorf("TimeResult() = %v, want %v", got, tt.want) } }) } } func TestUpdateContractSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string closePrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateContractSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.closePrice); (err != nil) != tt.wantErr { t.Errorf("UpdateContractSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateOptionInrSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateOptionInrSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateOptionInrSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareBrlSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareBrlSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareBrlSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareEurSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareEurSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareEurSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareFurSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareFurSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareFurSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareGbxSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareGbxSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareGbxSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareHkdSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareHkdSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareHkdSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareIdnSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareIdnSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareIdnSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareInrSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareInrSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareInrSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareMysSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareMysSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareMysSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareSgdSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareSgdSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareSgdSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareThaSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareThaSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareThaSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateShareUsSubscribeHashStatusByOrderId(t *testing.T) { type args struct { orderId string updateKey string status string openPrice string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateShareUsSubscribeHashStatusByOrderId(tt.args.orderId, tt.args.updateKey, tt.args.status, tt.args.openPrice); (err != nil) != tt.wantErr { t.Errorf("UpdateShareUsSubscribeHashStatusByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func TestUpdateSpotsSubscribeStatusHashByOrderId(t *testing.T) { type args struct { userId int64 orderId string updateKey string status string } tests := []struct { name string args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { if err := UpdateSpotsSubscribeStatusHashByOrderId(tt.args.userId, tt.args.orderId, tt.args.updateKey, tt.args.status); (err != nil) != tt.wantErr { t.Errorf("UpdateSpotsSubscribeStatusHashByOrderId() error = %v, wantErr %v", err, tt.wantErr) } }) } } func Test_userOrderRepo_CheckToken(t *testing.T) { type fields struct { data *Data log *log.Helper } type args struct { ctx context.Context } tests := []struct { name string fields fields args args want int wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { uo := &userOrderRepo{ data: tt.fields.data, log: tt.fields.log, } got, err := uo.CheckToken(tt.args.ctx) if (err != nil) != tt.wantErr { t.Errorf("CheckToken() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("CheckToken() got = %v, want %v", got, tt.want) } }) } } func Test_userOrderRepo_GetBotContractListByContractName(t *testing.T) { type fields struct { data *Data log *log.Helper } type args struct { ctx context.Context contractId string } tests := []struct { name string fields fields args args want string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { uo := &userOrderRepo{ data: tt.fields.data, log: tt.fields.log, } got, err := uo.GetBotContractListByContractName(tt.args.ctx, tt.args.contractId) if (err != nil) != tt.wantErr { t.Errorf("GetBotContractListByContractName() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("GetBotContractListByContractName() got = %v, want %v", got, tt.want) } }) } } func Test_userOrderRepo_GetBotDigitalListByDigitalName(t *testing.T) { type fields struct { data *Data log *log.Helper } type args struct { ctx context.Context digitalId string } tests := []struct { name string fields fields args args want string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { uo := &userOrderRepo{ data: tt.fields.data, log: tt.fields.log, } got, err := uo.GetBotDigitalListByDigitalName(tt.args.ctx, tt.args.digitalId) if (err != nil) != tt.wantErr { t.Errorf("GetBotDigitalListByDigitalName() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("GetBotDigitalListByDigitalName() got = %v, want %v", got, tt.want) } }) } } func Test_userOrderRepo_GetBotStockListByStockName(t *testing.T) { type fields struct { data *Data log *log.Helper } type args struct { ctx context.Context stockId string } tests := []struct { name string fields fields args args want string wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { uo := &userOrderRepo{ data: tt.fields.data, log: tt.fields.log, } got, err := uo.GetBotStockListByStockName(tt.args.ctx, tt.args.stockId) if (err != nil) != tt.wantErr { t.Errorf("GetBotStockListByStockName() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("GetBotStockListByStockName() got = %v, want %v", got, tt.want) } }) } } func Test_userOrderRepo_GetBotUser(t *testing.T) { type fields struct { data *Data log *log.Helper } type args struct { token string } tests := []struct { name string fields fields args args want int wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { uo := &userOrderRepo{ data: tt.fields.data, log: tt.fields.log, } got, err := uo.GetBotUser(tt.args.token) if (err != nil) != tt.wantErr { t.Errorf("GetBotUser() error = %v, wantErr %v", err, tt.wantErr) return } if got != tt.want { t.Errorf("GetBotUser() got = %v, want %v", got, tt.want) } }) } } func Test_userOrderRepo_GetBotUserContractByContractId(t *testing.T) { type fields struct { data *Data log *log.Helper } type args struct { ctx context.Context userId int64 stockId int64 } tests := []struct { name string fields fields args args want *models.BotUserContract wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { uo := &userOrderRepo{ data: tt.fields.data, log: tt.fields.log, } got, err := uo.GetBotUserContractByContractId(tt.args.ctx, tt.args.userId, tt.args.stockId) if (err != nil) != tt.wantErr { t.Errorf("GetBotUserContractByContractId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotUserContractByContractId() got = %v, want %v", got, tt.want) } }) } } func Test_userOrderRepo_GetBotUserDigitalByDigitalId(t *testing.T) { type fields struct { data *Data log *log.Helper } type args struct { ctx context.Context userId int64 stockId int64 } tests := []struct { name string fields fields args args want *models.BotUserDigital wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { uo := &userOrderRepo{ data: tt.fields.data, log: tt.fields.log, } got, err := uo.GetBotUserDigitalByDigitalId(tt.args.ctx, tt.args.userId, tt.args.stockId) if (err != nil) != tt.wantErr { t.Errorf("GetBotUserDigitalByDigitalId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotUserDigitalByDigitalId() got = %v, want %v", got, tt.want) } }) } } func Test_userOrderRepo_GetBotUserIsRealByUserId(t *testing.T) { type fields struct { data *Data log *log.Helper } type args struct { ctx context.Context userId int } tests := []struct { name string fields fields args args want bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { uo := &userOrderRepo{ data: tt.fields.data, log: tt.fields.log, } if got := uo.GetBotUserIsRealByUserId(tt.args.ctx, tt.args.userId); got != tt.want { t.Errorf("GetBotUserIsRealByUserId() = %v, want %v", got, tt.want) } }) } } func Test_userOrderRepo_GetBotUserStockByStockId(t *testing.T) { type fields struct { data *Data log *log.Helper } type args struct { ctx context.Context userId int64 stockId int64 } tests := []struct { name string fields fields args args want *models.BotUserStock wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { uo := &userOrderRepo{ data: tt.fields.data, log: tt.fields.log, } got, err := uo.GetBotUserStockByStockId(tt.args.ctx, tt.args.userId, tt.args.stockId) if (err != nil) != tt.wantErr { t.Errorf("GetBotUserStockByStockId() error = %v, wantErr %v", err, tt.wantErr) return } if !reflect.DeepEqual(got, tt.want) { t.Errorf("GetBotUserStockByStockId() got = %v, want %v", got, tt.want) } }) } } func Test_userOrderRepo_HSetRedisKey(t *testing.T) { type fields struct { data *Data log *log.Helper } type args struct { ctx context.Context key string value string } tests := []struct { name string fields fields args args wantErr bool }{ // TODO: Add test cases. } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { uo := &userOrderRepo{ data: tt.fields.data, log: tt.fields.log, } if err := uo.HSetRedisKey(tt.args.ctx, tt.args.key, tt.args.value); (err != nil) != tt.wantErr { t.Errorf("HSetRedisKey() error = %v, wantErr %v", err, tt.wantErr) } }) } }