12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package sentio
- import "testing"
- func TestSideFromString(t *testing.T) {
- tests := []struct {
- arg string
- want Side
- wantErr bool
- }{
- {
- arg: "short",
- want: SHORT,
- wantErr: false,
- },
- {
- arg: "Short",
- want: SHORT,
- wantErr: false,
- },
- {
- arg: " short ",
- want: SHORT,
- wantErr: false,
- },
- {
- arg: "ShOrT",
- want: SHORT,
- wantErr: false,
- },
- {
- arg: "šhort",
- want: -1,
- wantErr: true,
- },
- }
- for _, tt := range tests {
- t.Run("TestSideFromString", func(t *testing.T) {
- got, err := ParseSide(tt.arg)
- if (err != nil) != tt.wantErr {
- t.Errorf("SideFromString() error = %v, wantErr %v", err, tt.wantErr)
- return
- }
- if got != tt.want {
- t.Errorf("SideFromString() got = %v, want %v", got, tt.want)
- }
- })
- }
- }
|