Sha256: a534922dfb0fe0b24e954835e6d784357acf9522fdc1b7c5b860c8d4eff27f7a
Contents?: true
Size: 1.13 KB
Versions: 47
Compression:
Stored size: 1.13 KB
Contents
module Test.Main where import Prelude import Control.Monad.Eff (Eff) import Test.Unit (suite, test) import Test.Unit.Main (runTest) import Test.Unit.Assert as Assert import Data.List (List(Nil), fromFoldable) import Data.String as String import Accumulate (accumulate) main :: Eff _ Unit main = runTest do suite "Accumulate.accumulate" do test "empty accumulation" $ let emptyList = (Nil :: List Int) in Assert.equal emptyList $ accumulate square emptyList test "accumulate single square" $ Assert.equal (fromFoldable [4]) $ accumulate square (fromFoldable [2]) test "accumulate squares" $ Assert.equal (fromFoldable [1, 4, 9]) $ accumulate square (fromFoldable [1, 2, 3]) test "accumulate upcases" $ Assert.equal (fromFoldable ["HELLO", "WORLD"]) $ accumulate String.toUpper (fromFoldable ["hello", "world"]) test "accumulate length of strings" $ Assert.equal (fromFoldable [3, 5, 5, 3, 3]) $ accumulate String.length (fromFoldable ["the", "quick", "brown", "fox", "etc"]) square :: forall a. (Semiring a) => a -> a square x = x * x
Version data entries
47 entries across 47 versions & 1 rubygems