12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package sentio
- import "testing"
- func TestParseOrderAction(t *testing.T) {
- tests := []struct {
- arg string
- want OrderAction
- wantErr bool
- }{
- {
- arg: "SELL",
- want: OrderSell,
- wantErr: false,
- },
- {
- arg: "S",
- want: OrderSell,
- wantErr: false,
- },
- {
- arg: "s",
- want: OrderSell,
- wantErr: false,
- },
- {
- arg: "sELL",
- want: OrderSell,
- wantErr: false,
- },
- {
- arg: "b",
- want: OrderBuy,
- wantErr: false,
- },
- {
- arg: "bUy",
- want: OrderBuy,
- wantErr: false,
- },
- {
- arg: "B",
- want: OrderBuy,
- wantErr: false,
- },
- {
- arg: "BUY",
- want: OrderBuy,
- wantErr: false,
- },
- }
- for _, tt := range tests {
- t.Run("TestParseOrderAction", func(t *testing.T) {
- got, err := ParseOrderAction(tt.arg)
- if (err != nil) != tt.wantErr {
- t.Errorf("ParseOrderAction() error = %v, wantErr %v", err, tt.wantErr)
- return
- }
- if got != tt.want {
- t.Errorf("ParseOrderAction() got = %v, want %v", got, tt.want)
- }
- })
- }
- }
|