Add integers module
This commit is contained in:
22
integers/adder_test.go
Normal file
22
integers/adder_test.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package integers
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAdder(t *testing.T) {
|
||||
sum := Add(2, 2)
|
||||
// Output: 9
|
||||
expected := 4
|
||||
|
||||
if sum != expected {
|
||||
t.Errorf("expected '%d' but got '%d'", expected, sum)
|
||||
}
|
||||
}
|
||||
|
||||
// Runnable example testing
|
||||
func ExampleAdd() {
|
||||
fmt.Println(Add(2, 4))
|
||||
// Output: 6
|
||||
}
|
||||
Reference in New Issue
Block a user