From 270702820858b861783a6999d0535698753e7824 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Thu, 30 Mar 2017 20:35:50 +0200 Subject: [PATCH] Improved simplification of units, closes #37 --- bower.json | 2 +- package.json | 2 +- test/Main.purs | 13 +++++++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/bower.json b/bower.json index 2ff6e34..c82d080 100644 --- a/bower.json +++ b/bower.json @@ -14,7 +14,7 @@ ], "dependencies": { "purescript-prelude": "^2.4.0", - "purescript-quantities": "^3.6.0", + "purescript-quantities": "^4.0.0", "purescript-parsing": "^3.2.1", "purescript-maps": "^2.1.2", "jquery.terminal": "=1.0.15", diff --git a/package.json b/package.json index 84a6b3c..db71a34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "insect", - "version": "3.0.0", + "version": "4.0.0", "description": "REPL-style scientific calculator with full support for physical units", "author": "David Peter ", "license": "MIT", diff --git a/test/Main.purs b/test/Main.purs index d00ae96..dac4c1e 100644 --- a/test/Main.purs +++ b/test/Main.purs @@ -654,8 +654,8 @@ main = runTest do let expectOutput' = expectOutput initialEnvironment - suite "Integration" do - test "Simple" do + suite "Integration tests" do + test "Simple input" do expectOutput' "3m" "3m" expectOutput' "3m" " 3.0 meter " @@ -701,7 +701,12 @@ main = runTest do expectOutput' "4" "round(3.9)" expectOutput' "3" "round(3.1)" - test "Simple" do + test "Unit simplification" do + expectOutput' "36000Mbit" "5Mbit/s * 2h" + expectOutput' "2500cm²" "5cm · 5m" + expectOutput' "0.2km" "120km/h*6s" + + test "Examples" do expectOutput' "1080" "1920/16*9" expectOutput' "4294967296" "2^32" expectOutput' "0.512957" "sqrt(1.4^2 + 1.5^2) * cos(pi/3)^2" @@ -709,7 +714,7 @@ main = runTest do expectOutput' "2.5min" "2min + 30s" expectOutput' "150s" "2min + 30s -> sec" expectOutput' "904779000000km³" "4/3 * pi * (6000km)³" - expectOutput' "58800kg·m·cm/s²" "40kg * 9.8m/s² * 150cm" + expectOutput' "588m²·kg/s²" "40kg * 9.8m/s² * 150cm" expectOutput' "0.5" "sin(30°)" expectOutput' "26.8224m/s" "60mph -> m/s"