|
| 1 | +package main |
| 2 | + |
| 3 | +import ( |
| 4 | + "github.com/initialcapacity/atomic-arithmetic/internal/go_support" |
| 5 | + "log" |
| 6 | +) |
| 7 | + |
| 8 | +func main() { |
| 9 | + operationsDir, err := go_support.CreatePackageDirectory("operations") |
| 10 | + if err != nil { |
| 11 | + log.Fatalf("Unable to create pkg/operations directory: %v\n", err) |
| 12 | + } |
| 13 | + |
| 14 | + maximumNumber := 10_000 |
| 15 | + |
| 16 | + go_support.CreateAtomicFile(operationsDir, "operations", "add.go", "Add", "+", maximumNumber) |
| 17 | + go_support.CreateAtomicTest(operationsDir, "operations", "add_test.go", "Add", func(i, j int) int { return i + j }, maximumNumber) |
| 18 | + |
| 19 | + go_support.CreateAtomicFile(operationsDir, "operations", "subtract.go", "Subtract", "-", maximumNumber) |
| 20 | + go_support.CreateAtomicTest(operationsDir, "operations", "subtract_test.go", "Subtract", func(i, j int) int { return i - j }, maximumNumber) |
| 21 | + |
| 22 | + go_support.CreateAtomicFile(operationsDir, "operations", "multiply.go", "MultiplyBy", "*", maximumNumber) |
| 23 | + go_support.CreateAtomicTest(operationsDir, "operations", "multiply_test.go", "MultiplyBy", func(i, j int) int { return i * j }, maximumNumber) |
| 24 | + |
| 25 | + go_support.CreateAtomicFile(operationsDir, "operations", "divide.go", "DivideBy", "/", maximumNumber) |
| 26 | + go_support.CreateAtomicTest(operationsDir, "operations", "divide_test.go", "DivideBy", func(i, j int) int { return i / j }, maximumNumber) |
| 27 | + |
| 28 | + go_support.CreateAtomicFile(operationsDir, "operations", "modulo.go", "Mod", "%", maximumNumber) |
| 29 | + go_support.CreateAtomicTest(operationsDir, "operations", "modulo_test.go", "Mod", func(i, j int) int { return i % j }, maximumNumber) |
| 30 | + |
| 31 | + log.Println("Success!") |
| 32 | +} |
0 commit comments