package main

import "fmt"

// section: func
func Add(a, b int) int {
	return a + b
}

// section: func

func main() {
	// section: main
	// Anonymous structs are ideal for table-driven tests
	tests := []struct {
		name     string
		a, b     int
		expected int
	}{
		{"positive numbers", 2, 3, 5},
		{"negative numbers", -1, -2, -3},
		{"zero", 0, 0, 0},
		{"mixed", -5, 10, 5},
	}

	for _, tt := range tests {
		result := Add(tt.a, tt.b)
		if result != tt.expected {
			fmt.Printf("FAIL %s: got %d, want %d\n", tt.name, result, tt.expected)
		} else {
			fmt.Printf("PASS %s\n", tt.name)
		}
	}
	// section: main
}

/*
// section: output
$ go run main.go
PASS positive numbers
PASS negative numbers
PASS zero
PASS mixed
// section: output
*/
