divide gprs pfo to several clusters
This commit is contained in:
parent
2fecd78ff3
commit
ab0fd9a01a
5
calculator/calculator.go
Normal file → Executable file
5
calculator/calculator.go
Normal file → Executable file
|
|
@ -1,5 +1,10 @@
|
||||||
// Package calculator does simple calculations.
|
// Package calculator does simple calculations.
|
||||||
package calculator // Add takes two numbers and returns the result of adding them together.
|
package calculator // Add takes two numbers and returns the result of adding them together.
|
||||||
|
|
||||||
func Add(a, b float64) float64 {
|
func Add(a, b float64) float64 {
|
||||||
return a + b
|
return a + b
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Subtract(a, b float64) float64 {
|
||||||
|
return b - a
|
||||||
|
}
|
||||||
|
|
|
||||||
8
calculator/calculator_test.go
Normal file → Executable file
8
calculator/calculator_test.go
Normal file → Executable file
|
|
@ -14,3 +14,11 @@ func TestAdd(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
0
calculator/go.mod
Normal file → Executable file
0
calculator/go.mod
Normal file → Executable file
7
test-vs-code/main.go
Normal file
7
test-vs-code/main.go
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
fmt.Println("hello World")
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user