diff --git a/Add_28d8c9c450_test.go b/Add_28d8c9c450_test.go new file mode 100644 index 0000000..053d3f4 --- /dev/null +++ b/Add_28d8c9c450_test.go @@ -0,0 +1,47 @@ +package main + +import ( + "testing" +) + +func TestAdd_28d8c9c450(t *testing.T) { + t.Run("positive numbers", func(t *testing.T) { + result := Add_28d8c9c450(2, 3) + if result != 5 { + t.Errorf("Expected 5, but got %d", result) + } else { + t.Log("Success: TestAdd_28d8c9c450 for positive numbers passed.") + } + }) + + t.Run("negative numbers", func(t *testing.T) { + result := Add_28d8c9c450(-2, -3) + if result != -5 { + t.Errorf("Expected -5, but got %d", result) + } else { + t.Log("Success: TestAdd_28d8c9c450 for negative numbers passed.") + } + }) + + t.Run("zero", func(t *testing.T) { + result := Add_28d8c9c450(0, 0) + if result != 0 { + t.Errorf("Expected 0, but got %d", result) + } else { + t.Log("Success: TestAdd_28d8c9c450 for zero passed.") + } + }) + + t.Run("positive and negative", func(t *testing.T) { + result := Add_28d8c9c450(2, -3) + if result != -1 { + t.Errorf("Expected -1, but got %d", result) + } else { + t.Log("Success: TestAdd_28d8c9c450 for positive and negative passed.") + } + }) +} + +func Add_28d8c9c450(a, b int) int { + return a + b +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..40ec89a --- /dev/null +++ b/go.mod @@ -0,0 +1,11 @@ +module learning-golang + +go 1.19 + +require github.com/smartystreets/goconvey v1.8.1 + +require ( + github.com/gopherjs/gopherjs v1.17.2 // indirect + github.com/jtolds/gls v4.20.0+incompatible // indirect + github.com/smarty/assertions v1.15.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..7fea79b --- /dev/null +++ b/go.sum @@ -0,0 +1,8 @@ +github.com/gopherjs/gopherjs v1.17.2 h1:fQnZVsXk8uxXIStYb0N4bGk7jeyTalG/wsZjQ25dO0g= +github.com/gopherjs/gopherjs v1.17.2/go.mod h1:pRRIvn/QzFLrKfvEz3qUuEhtE/zLCWfreZ6J5gM2i+k= +github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= +github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= +github.com/smarty/assertions v1.15.0 h1:cR//PqUBUiQRakZWqBiFFQ9wb8emQGDb0HeGdqGByCY= +github.com/smarty/assertions v1.15.0/go.mod h1:yABtdzeQs6l1brC900WlRNwj6ZR55d7B+E8C6HtKdec= +github.com/smartystreets/goconvey v1.8.1 h1:qGjIddxOk4grTu9JPOU31tVfq3cNdBlNa5sSznIX1xY= +github.com/smartystreets/goconvey v1.8.1/go.mod h1:+/u4qLyY6x1jReYOp7GOM2FSt8aP9CzCZL03bI28W60=