Sha256: 0ba7fe1937e5709fd32ab7da107fad9bfef74b41aa860aba5cd042beb9de2968

Contents?: true

Size: 1.26 KB

Versions: 111

Compression:

Stored size: 1.26 KB

Contents

module Test.Main where

import Prelude
import Control.Monad.Eff (Eff)
import Data.Maybe (Maybe(..))
import Test.Unit.Assert as Assert
import Test.Unit (suite, test)
import Test.Unit.Main (runTest)
import DifferenceOfSquares (differenceOfSquares, squareOfSum, sumOfSquares)

main :: Eff _ Unit
main = runTest do
  suite "Square the sum of the numbers up to the given number" do

    test "square of sum 5" $
      Assert.equal 225 (squareOfSum 5)

    test "square of sum 10" $
      Assert.equal 3025 (squareOfSum 10)

    test "square of sum 100" $
      Assert.equal 25502500 (squareOfSum 100)

  suite "Sum the squares of the numbers up to the given number" do

    test "sum of squares 5" $
      Assert.equal 55 (sumOfSquares 5)

    test "sum of squares 10" $
      Assert.equal 385 (sumOfSquares 10)

    test "sum of squares 100" $
      Assert.equal 338350 (sumOfSquares 100)

  suite "Subtract sum of squares from square of sums" do

    test "difference of squares 0" $
      Assert.equal 0 (differenceOfSquares 0)

    test "difference of squares 5" $
      Assert.equal 170 (differenceOfSquares 5)

    test "difference of squares 10" $
      Assert.equal 2640 (differenceOfSquares 10)

    test "difference of squares 100" $
      Assert.equal 25164150 (differenceOfSquares 100)

Version data entries

111 entries across 111 versions & 1 rubygems

Version Path
trackler-2.2.0.4 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.0.3 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.0.2 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.0.1 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.0.0 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.55 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.54 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.53 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.52 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.51 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.50 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.49 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.48 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.47 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.46 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.45 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.44 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.43 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.42 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.41 tracks/purescript/exercises/difference-of-squares/test/Main.purs