Created
February 8, 2020 16:12
-
-
Save cyantarek/9c3deaddabd8776c2e517659a7702438 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
package reversestring | |
import ( | |
"testing" | |
) | |
func TestReverseString1(t *testing.T) { | |
type args struct { | |
s string | |
} | |
tests := []struct { | |
name string | |
args args | |
want string | |
}{ | |
{ | |
name: "testing empty", | |
args: args{ | |
s:"", | |
}, | |
want: "", | |
}, | |
{ | |
name: "testing hello", | |
args: args{ | |
s:"hello", | |
}, | |
want: "olleh", | |
}, | |
{ | |
name: "testing question", | |
args: args{ | |
s:"why am I?", | |
}, | |
want: "?I ma yhw", | |
}, | |
} | |
for _, tt := range tests { | |
t.Run(tt.name, func(t *testing.T) { | |
if got := ReverseString(tt.args.s); got != tt.want { | |
t.Errorf("ReverseString() = %v, want %v", got, tt.want) | |
} | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment