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
go | |
func CheckAnswer(string, string) int { | |
return 1 | |
} |
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
06:35 $ go test | |
# github.com/adilw3nomad/GopherQuiz [github.com/adilw3nomad/GopherQuiz.test] | |
./main_test.go:6:20: CheckAnswer("3", "3") used as value | |
./main_test.go:13:20: CheckAnswer("3", "2") used as value | |
FAIL github.com/adilw3nomad/GopherQuiz [build failed] |
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
go | |
func CheckAnswer(string, string) { | |
return | |
} |
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
go | |
func CheckAnswer() { | |
} |
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
shell | |
06:29 $ go test | |
# github.com/adilw3nomad/GopherQuiz [github.com/adilw3nomad/GopherQuiz.test] | |
./main_test.go:6:20: too many arguments in call to CheckAnswer | |
have (string, string) | |
want () | |
./main_test.go:6:20: CheckAnswer("3", "3") used as value | |
./main_test.go:13:20: too many arguments in call to CheckAnswer | |
have (string, string) | |
want () |
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
shell | |
06:24 $ go test | |
# github.com/adilw3nomad/GopherQuiz [github.com/adilw3nomad/GopherQuiz.test] | |
./main_test.go:6:9: undefined: CheckAnswer | |
./main_test.go:13:9: undefined: CheckAnswer | |
FAIL github.com/adilw3nomad/GopherQuiz [build failed] |
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
go | |
package main | |
import “testing” | |
func TestCheckCorrectAnswer(t *testing.T) { | |
got := CheckAnswer(“3”, “3”) | |
if got != “Correct! Well done” { | |
t.Errorf(“CheckCorrectAnswer = %v; want ‘Correct! Well Done’”, got) | |
} |
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
go | |
func TestCheckAnswer(t *testing.T) { | |
gotCorrect := CheckAnswer(“3”, “3”) | |
if gotCorrect != “Correct! Well done” { | |
t.Errorf(“CheckAnswer = %v; want ‘Correct! Well Done’”, gotCorrect) | |
} | |
gotIncorrect := CheckAnswer(“3”, “2”) | |
if gotIncorrect != “WRONG! Answer is: 2” { | |
t.Errorf(“CheckAnswer = %v; want ‘WRONG! Answer is: 2’”, gotIncorrect) | |
} |
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
go | |
func TestCheckAnswer(t *testing.T) { | |
got := CheckAnswer(“3”, “3”) | |
if got != true { | |
t.Errorf(“CheckAnswer = %v; want true”, got) | |
} | |
} |
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
go | |
package main | |
import “testing” | |
func TestCompareAnswer(t *testing.T) { | |
got := CompareAnswer(“3”, “3”) | |
if got != true { | |
t.Errorf(“CompareAnswer = %v; want true”, got) | |
} |