Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional tests for the Go program - Generated by Roost GPT (from roost.ai) #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Add_28d8c9c450_test.go
Original file line number Diff line number Diff line change
@@ -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
}
11 changes: 11 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -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
)
8 changes: 8 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=