Last active
June 19, 2018 08:38
-
-
Save cyantarek/d1e56d6f788c4d713c3d2ae96acca9ee 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
//calculator_test.go | |
package main | |
import "testing" | |
func TestAdd(t *testing.T) { | |
if result, _ := AddFunc(1,2); result != 3 { | |
t.Error("Test failed") | |
} | |
} | |
func TestAddWrong(t *testing.T) { | |
if result, _ := AddFunc(1,2); result == 4 { | |
t.Error("1 + 2 should not be 4") | |
} | |
} | |
func TestAddEmptyInput(t *testing.T) { | |
if _, err := AddFunc(); err == nil { | |
t.Error("Empty input can not be accepted") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment