Last active
August 16, 2016 23:15
-
-
Save schrepfler/e75777b93f1bfc312e7fca431537048f to your computer and use it in GitHub Desktop.
counter test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Test.Main where | |
import Prelude | |
import Control.Monad.Eff (Eff) | |
import Control.Monad.Eff.Console (CONSOLE, logShow) | |
import Data.Maybe (Maybe(Just)) | |
import Data.Map as Map | |
import Data.Monoid.Additive (Additive(Additive)) | |
import Main (GCounter(..), increment, value) | |
import Test.Unit (suite, test, timeout) | |
import Test.Unit.Main (runTest) | |
import Test.Unit.Assert as Assert | |
import Control.Monad.Eff.Class | |
main = runTest do | |
suite "GCounter test suite" do | |
test "GCounter increment" do | |
let c = Just (GCounter "a" (Map.singleton "a" (Additive 0))) | |
>>= increment (Additive 10) | |
>>= increment (Additive 20) | |
Assert.assert "Counter should be 30" $ (value <$> c) == Just (Additive 30) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment