Add basic test in main_test and check it passes with 'go test'

This commit is contained in:
Eli Bendersky 2019-09-12 09:29:38 -07:00
parent 8d0a0e06d2
commit e5af060488

View File

@ -0,0 +1,20 @@
package main
import (
"testing"
)
func IntMin(a, b int) int {
if a < b {
return a
} else {
return b
}
}
func TestIntMinBasic(t *testing.T) {
result := IntMin(2, -2)
if result != -2 {
t.Errorf("IntMin(2, -2) = %d; want -2", result)
}
}