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.1.0.40 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.39 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.38 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.37 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.36 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.34 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.33 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.32 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.31 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.30 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.29 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.28 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.27 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.26 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.25 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.24 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.23 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.22 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.21 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.20 tracks/purescript/exercises/difference-of-squares/test/Main.purs