тесты с coverage
This commit is contained in:
27
math/math_test.go
Normal file
27
math/math_test.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user