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.1.37 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.36 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.35 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.34 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.33 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.32 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.31 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.30 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.29 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.28 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.27 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.26 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.25 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.24 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.23 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.22 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.21 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.20 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.19 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.2.1.18 tracks/purescript/exercises/difference-of-squares/test/Main.purs