diff --git a/FSharp/Calculator/Calc.fs b/FSharp/Calculator/Calc.fs new file mode 100644 index 0000000..001be20 --- /dev/null +++ b/FSharp/Calculator/Calc.fs @@ -0,0 +1,9 @@ +module Calculator + +let sum a b = a + b + +let subtract a b = a - b + +let multiply a b = a * b + +let divide a b = a / b \ No newline at end of file diff --git a/FSharp/CalculatorTest/TestCalculator.fs b/FSharp/CalculatorTest/TestCalculator.fs new file mode 100644 index 0000000..f975e0c --- /dev/null +++ b/FSharp/CalculatorTest/TestCalculator.fs @@ -0,0 +1,28 @@ +module TestCalculator + +open NUnit.Framework +open FsUnit +open Calculator + +[] +type TestCalculator() = + + [] + member this.Setup() = printfn "Starting Calculator tests" + + [] + member this.TearDown() = printfn "Calculator tests are finished" + + [] + [] + member this.OneCanSumPositiveIntegers() = Calc.sum 5 5 |> should equal 10 + + [] + [] + member this.OneCanSumNegativeIntegers() = Calc.sum -5 -5 |> should equal -10 + + [] + [] + member this.OneCanSubtractPositiveIntegers() = Calc.subtract 5 5 |> should equal 0 + + // Remaining test cases translated similarly \ No newline at end of file