Created
March 22, 2022 02:45
-
-
Save mitchallen/fd6a5dec9b981f9e58f40c77cc063236 to your computer and use it in GitHub Desktop.
go-lib test file
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
| /** | |
| * Author: Mitch Allen | |
| * File: go-lib_test.go | |
| */ | |
| package lib | |
| import ( | |
| "testing" | |
| ) | |
| func TestAdd(t *testing.T) { | |
| a := 1 | |
| b := 2 | |
| expected := a + b | |
| if got := Add(a, b); got != expected { | |
| t.Errorf("Add(%d, %d) = %d, didn't return %d", a, b, got, expected) | |
| } | |
| } | |
| func TestSubtract(t *testing.T) { | |
| a := 1 | |
| b := 2 | |
| expected := a - b | |
| if got := Subtract(a, b); got != expected { | |
| t.Errorf("Subtract(%d, %d) = %d, didn't return %d", a, b, got, expected) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment