Created
August 26, 2019 09:56
-
-
Save arindamroynitw/abe662359e4611d12705a3ebd33efa44 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ( | |
"testing" | |
) | |
func Test_keyOp_Degenerate(t *testing.T) { | |
type args struct { | |
s string | |
} | |
tests := []struct { | |
name string | |
args args | |
wantX int | |
wantY int | |
wantErr bool | |
}{ | |
{ | |
name: "success", | |
args: args{ | |
s: "40_99", | |
}, | |
wantX: 40, | |
wantY: 99, | |
}, | |
{ | |
name: "failure", | |
args: args{ | |
s: "4099", | |
}, | |
wantErr: true, | |
}, | |
} | |
for _, tt := range tests { | |
t.Run(tt.name, func(t *testing.T) { | |
kp := GetKeyOperator() | |
gotX, gotY, gotErr := kp.Degenerate(tt.args.s) | |
if (gotErr != nil) != tt.wantErr { | |
t.Errorf("keyOp.Degenerate() error = %v, wantErr %v", gotErr, tt.wantErr) | |
return | |
} | |
if gotX != tt.wantX { | |
t.Errorf("keyOp.Degenerate() gotX = %v, wantX %v", gotX, tt.wantX) | |
} | |
if gotY != tt.wantY { | |
t.Errorf("keyOp.Degenerate() gotY = %v, wantX %v", gotY, tt.wantY) | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment