the first one

This commit is contained in:
a.pivkin 2024-06-19 09:11:01 +03:00
commit 2fecd78ff3
3 changed files with 25 additions and 0 deletions

5
calculator/calculator.go Normal file
View File

@ -0,0 +1,5 @@
// Package calculator does simple calculations.
package calculator // Add takes two numbers and returns the result of adding them together.
func Add(a, b float64) float64 {
return a + b
}

View File

@ -0,0 +1,16 @@
package calculator_test
import (
"calculator"
"testing"
)
func TestAdd(t *testing.T) {
t.Parallel()
var want float64 = 4
got := calculator.Add(2, 2)
if want != got {
t.Errorf("want %f, got %f", want, got)
}
}

4
calculator/go.mod Normal file
View File

@ -0,0 +1,4 @@
module calculator
go 1.22.4