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
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) 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
shell | |
06:36 $ go test | |
# github.com/adilw3nomad/GopherQuiz [github.com/adilw3nomad/GopherQuiz.test] | |
./main_test.go:7:9: cannot convert "Correct! Well done" (type untyped string) to type int | |
./main_test.go:7:9: invalid operation: got != "Correct! Well done" (mismatched types int and string) | |
./main_test.go:14:9: cannot convert "WRONG! Answer is: 2" (type untyped string) to type int | |
./main_test.go:14:9: invalid operation: got != "WRONG! Answer is: 2" (mismatched types int and string) | |
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) 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
shell | |
06:47 $ go test | |
--- FAIL: TestCheckCorrectAnswer (0.00s) | |
main_test.go:8: CheckCorrectAnswer = ; want 'Correct! Well Done' | |
--- FAIL: TestCheckIncorrectAnswer (0.00s) | |
main_test.go:15: CheckIncorrectAnswer = ; want 'WRONG! Answer is: 2' | |
FAIL | |
exit status 1 | |
FAIL github.com/adilw3nomad/GopherQuiz 0.005s |
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) string { | |
return "Correct! Well done" | |
} |
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:51 $ go test | |
--- FAIL: TestCheckIncorrectAnswer (0.00s) | |
main_test.go:15: CheckIncorrectAnswer = Correct! Well done; want 'WRONG! Answer is: 2' | |
FAIL | |
exit status 1 | |
FAIL github.com/adilw3nomad/GopherQuiz 0.005s |
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
func CheckAnswer(answer string, correctAnswer string) string { | |
if answer == correctAnswer { | |
return “Correct! Well done” | |
} else { | |
return (“WRONG! Answer is: “ + correctAnswer) | |
} | |
} |
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:56 $ go test | |
PASS | |
ok github.com/adilw3nomad/GopherQuiz 0.004s |