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.19 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.18 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.17 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.16 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.15 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.14 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.13 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.12 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.11 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.10 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.9 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.8 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.7 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.6 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.5 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.4 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.3 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.2 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.1 tracks/purescript/exercises/difference-of-squares/test/Main.purs
trackler-2.1.0.0 tracks/purescript/exercises/difference-of-squares/test/Main.purs