aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJoris2017-04-05 17:04:33 +0200
committerJoris2017-04-05 17:04:33 +0200
commit9a95a674fbbf1e64d3ad07922d569c3a1c751cf2 (patch)
tree2f99889040b0af406df1c403b9d930fe77e706cf /test
parentf6a73e5bd6a5e2d7d4eb9c8a14bdf1a0c8a4ac4c (diff)
Show aliments, glycemic index, carbohydrates and glycemic charge
Diffstat (limited to 'test')
-rw-r--r--test/Main.purs27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Main.purs b/test/Main.purs
new file mode 100644
index 0000000..5ebbb03
--- /dev/null
+++ b/test/Main.purs
@@ -0,0 +1,27 @@
+module Test.Main where
+
+import Prelude
+import Control.Monad.Aff (later')
+import Control.Monad.Eff (Eff)
+import Test.Spec (describe, it)
+import Test.Spec.Assertions (shouldEqual)
+import Test.Spec.Reporter.Console (consoleReporter)
+import Test.Spec.Runner (RunnerEffects, run)
+
+import Format as Format
+
+main :: Eff (RunnerEffects ()) Unit
+main = run [consoleReporter] do
+
+ describe "Format" do
+ it "format numbers" $ do
+ (Format.number 0 0.0) `shouldEqual` "0"
+ (Format.number 0 (-0.0)) `shouldEqual` "0"
+ (Format.number 0 8.0) `shouldEqual` "8"
+ (Format.number 0 (-4.0)) `shouldEqual` "-4"
+ (Format.number 2 25.0) `shouldEqual` "25,00"
+ (Format.number 5 25.0) `shouldEqual` "25,00000"
+ (Format.number 5 25.13) `shouldEqual` "25,13000"
+ (Format.number 1 25.13) `shouldEqual` "25,1"
+ (Format.number 1 25.15) `shouldEqual` "25,1"
+ (Format.number 1 25.19) `shouldEqual` "25,2"