From 0ce8744897b9aa13ea568a6985da9570e4aca90b Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 2 Feb 2020 13:53:54 +0100 Subject: Use zola generator - Use CSS instead of Haskell with Clay - Use TypeScript instead of PureScript --- js/test/Main.purs | 61 ------------------------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 js/test/Main.purs (limited to 'js/test') diff --git a/js/test/Main.purs b/js/test/Main.purs deleted file mode 100644 index 3a4f03c..0000000 --- a/js/test/Main.purs +++ /dev/null @@ -1,61 +0,0 @@ -module Test.Main - ( main - ) where - -import Data.Maybe (Maybe(Just, Nothing)) -import Effect (Effect) -import Prelude -import Test.Spec (describe, it) -import Test.Spec.Assertions (shouldEqual) -import Test.Spec.Reporter.Console (consoleReporter) -import Test.Spec.Runner (run) - -import Number (roundAt, format) as Number -import Parser (TextWithNumber) -import Parser (textWithNumber, number) as Parser - -main :: Effect Unit -main = run [consoleReporter] do - - describe "Number" do - it "rounds numbers" $ do - (Number.roundAt 0 0.0) `shouldEqual` (0.0) - (Number.roundAt 5 0.0) `shouldEqual` (0.0) - (Number.roundAt 0 12.3456) `shouldEqual` (12.0) - (Number.roundAt 1 12.3456) `shouldEqual` (12.3) - (Number.roundAt 2 12.3456) `shouldEqual` (12.35) - (Number.roundAt 3 12.3456) `shouldEqual` (12.346) - (Number.roundAt 4 12.3456) `shouldEqual` (12.3456) - (Number.roundAt 5 12.3456) `shouldEqual` (12.3456) - - it "formats numbers" $ do - (Number.format 0.0) `shouldEqual` "0" - (Number.format 0.1) `shouldEqual` "0,1" - (Number.format 12.3456) `shouldEqual` "12,3" - (Number.format 12.9) `shouldEqual` "12,9" - (Number.format 12.99) `shouldEqual` "13,0" - (Number.format 123456.0) `shouldEqual` "123456" - (Number.format 1234.5678) `shouldEqual` "1234,6" - - describe "Parser" do - it "parses number" $ do - (Parser.number "") `shouldEqual` Nothing - (Parser.number "auie") `shouldEqual` Nothing - (Parser.number "13.8auie") `shouldEqual` Nothing - (Parser.number "13.") `shouldEqual` Nothing - (Parser.number ".8") `shouldEqual` Nothing - (Parser.number "13") `shouldEqual` (Just 13.0) - (Parser.number "13,8") `shouldEqual` (Just 13.8) - (Parser.number "13.8") `shouldEqual` (Just 13.8) - (Parser.number "123 456") `shouldEqual` Nothing - - it "parses textWithNumber" $ do - map showTwn (Parser.textWithNumber "") `shouldEqual` Nothing - map showTwn (Parser.textWithNumber "0") `shouldEqual` Just (showTwn { begin: "", number: 0.0, end: "" }) - map showTwn (Parser.textWithNumber "13,8") `shouldEqual` Just (showTwn { begin: "", number: 13.8, end: "" }) - map showTwn (Parser.textWithNumber "begin 0 end") `shouldEqual` Just (showTwn { begin: "begin ", number: 0.0, end: " end" }) - map showTwn (Parser.textWithNumber "14end") `shouldEqual` Just (showTwn { begin: "", number: 14.0, end: "end" }) - map showTwn (Parser.textWithNumber "begin14") `shouldEqual` Just (showTwn { begin: "begin", number: 14.0, end: "" }) - -showTwn :: TextWithNumber -> String -showTwn { begin, number, end } = begin <> show number <> end -- cgit v1.2.3