From ab0fd9a01adc37d996775a5492b905684921b669 Mon Sep 17 00:00:00 2001 From: "a.pivkin" Date: Sat, 21 Jun 2025 20:38:21 +0300 Subject: [PATCH] divide gprs pfo to several clusters --- calculator/calculator.go | 7 ++++++- calculator/calculator_test.go | 24 ++++++++++++++++-------- calculator/go.mod | 0 test-vs-code/main.go | 7 +++++++ 4 files changed, 29 insertions(+), 9 deletions(-) mode change 100644 => 100755 calculator/calculator.go mode change 100644 => 100755 calculator/calculator_test.go mode change 100644 => 100755 calculator/go.mod create mode 100644 test-vs-code/main.go diff --git a/calculator/calculator.go b/calculator/calculator.go old mode 100644 new mode 100755 index 28d9f52..55fe9df --- a/calculator/calculator.go +++ b/calculator/calculator.go @@ -1,5 +1,10 @@ // 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 + return a + b +} + +func Subtract(a, b float64) float64 { + return b - a } diff --git a/calculator/calculator_test.go b/calculator/calculator_test.go old mode 100644 new mode 100755 index 4ac282c..20c6f88 --- a/calculator/calculator_test.go +++ b/calculator/calculator_test.go @@ -1,16 +1,24 @@ package calculator_test import ( - "calculator" - "testing" + "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) - } + t.Parallel() + var want float64 = 4 + got := calculator.Add(2, 2) + if want != got { + t.Errorf("want %f, got %f", want, got) + } } +func TestSubtract(t *testing.T) { + t.Parallel() + var want float64 = 2 + got := calculator.Subtract(4, 2) + if want != got { + t.Errorf("want %f, got %f", want, got) + } +} diff --git a/calculator/go.mod b/calculator/go.mod old mode 100644 new mode 100755 diff --git a/test-vs-code/main.go b/test-vs-code/main.go new file mode 100644 index 0000000..0f3d19c --- /dev/null +++ b/test-vs-code/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("hello World") +}