Skip to content

Instantly share code, notes, and snippets.

@arindamroynitw
Created August 26, 2019 09:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arindamroynitw/abe662359e4611d12705a3ebd33efa44 to your computer and use it in GitHub Desktop.
Save arindamroynitw/abe662359e4611d12705a3ebd33efa44 to your computer and use it in GitHub Desktop.
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