27 lines
514 B
Go
27 lines
514 B
Go
package math
|
|
|
|
import "testing"
|
|
|
|
func TestAdd(t *testing.T) {
|
|
result := Add(2, 3)
|
|
expected := 5
|
|
if result != expected {
|
|
t.Errorf("Add(2,3) = %d; want %d", result, expected)
|
|
}
|
|
}
|
|
|
|
func TestSubtract(t *testing.T) {
|
|
result := Subtract(5, 2)
|
|
expected := 3
|
|
if result != expected {
|
|
t.Errorf("Subtract(5,2) = %d; want %d", result, expected)
|
|
}
|
|
}
|
|
|
|
func TestMultiply(t *testing.T) {
|
|
result := Multiply(4, 3)
|
|
expected := 12
|
|
if result != expected {
|
|
t.Errorf("Multiply(4,3) = %d; want %d", result, expected)
|
|
}
|
|
} |