Commit f2b19a9

mo khan <mo.khan@gmail.com>
2019-10-20 01:30:03
add adder
https://github.com/quii/learn-go-with-tests/blob/master/integers.md
1 parent c95fd3f
Changed files (2)
adder.go
@@ -0,0 +1,5 @@
+package main
+
+func Add(x, y int) int {
+  return 4
+}
adder_test.go
@@ -0,0 +1,13 @@
+package main
+
+import "testing"
+
+func TestAdder(t *testing.T) {
+  sum := Add(2, 2)
+  expected := 4
+
+  if sum != expected {
+    t.Errorf("expected '%d' but got '%d'", expected, sum)
+  }
+}
+