Test generated by RoostGPT for test go-email using AI Type Open AI and AI Model gpt-4

pull/18/head^2
harishagrawal 2023-09-12 09:19:00 +00:00
parent ee0697a3f2
commit 669ae61a6b
1 changed files with 10 additions and 11 deletions

View File

@ -2,47 +2,46 @@ package main
import ( import (
"testing" "testing"
"log"
) )
func TestAdd(t *testing.T) { func TestAdd_28d8c9c450(t *testing.T) {
t.Run("positive numbers", func(t *testing.T) { t.Run("positive numbers", func(t *testing.T) {
result := Add(2, 3) result := Add_28d8c9c450(2, 3)
if result != 5 { if result != 5 {
t.Errorf("Expected 5, but got %d", result) t.Errorf("Expected 5, but got %d", result)
} else { } else {
log.Println("Success: TestAdd for positive numbers passed.") t.Log("Success: TestAdd_28d8c9c450 for positive numbers passed.")
} }
}) })
t.Run("negative numbers", func(t *testing.T) { t.Run("negative numbers", func(t *testing.T) {
result := Add(-2, -3) result := Add_28d8c9c450(-2, -3)
if result != -5 { if result != -5 {
t.Errorf("Expected -5, but got %d", result) t.Errorf("Expected -5, but got %d", result)
} else { } else {
log.Println("Success: TestAdd for negative numbers passed.") t.Log("Success: TestAdd_28d8c9c450 for negative numbers passed.")
} }
}) })
t.Run("zero", func(t *testing.T) { t.Run("zero", func(t *testing.T) {
result := Add(0, 0) result := Add_28d8c9c450(0, 0)
if result != 0 { if result != 0 {
t.Errorf("Expected 0, but got %d", result) t.Errorf("Expected 0, but got %d", result)
} else { } else {
log.Println("Success: TestAdd for zero passed.") t.Log("Success: TestAdd_28d8c9c450 for zero passed.")
} }
}) })
t.Run("positive and negative", func(t *testing.T) { t.Run("positive and negative", func(t *testing.T) {
result := Add(2, -3) result := Add_28d8c9c450(2, -3)
if result != -1 { if result != -1 {
t.Errorf("Expected -1, but got %d", result) t.Errorf("Expected -1, but got %d", result)
} else { } else {
log.Println("Success: TestAdd for positive and negative passed.") t.Log("Success: TestAdd_28d8c9c450 for positive and negative passed.")
} }
}) })
} }
func Add(a, b int) int { func Add_28d8c9c450(a, b int) int {
return a + b return a + b
} }