12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package sentio
- import "testing"
- func TestParseTimeInForce(t *testing.T) {
- tests := []struct {
- name string
- arg string
- want TimeInForce
- wantErr bool
- }{
- {
- name: "DAY",
- arg: "day",
- want: TIFDay,
- wantErr: false,
- },
- {
- name: "DAY",
- arg: "Day",
- want: TIFDay,
- wantErr: false,
- },
- {
- name: "DAY",
- arg: " day",
- want: TIFDay,
- wantErr: false,
- },
- {
- name: "Unknown",
- arg: "D ay",
- want: -1,
- wantErr: true,
- },
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- got, err := ParseTimeInForce(tt.arg)
- if (err != nil) != tt.wantErr {
- t.Errorf("ParseTimeInForce() error = %v, wantErr %v", err, tt.wantErr)
- return
- }
- if got != tt.want {
- t.Errorf("ParseTimeInForce() got = %v, want %v", got, tt.want)
- }
- })
- }
- }
|