[gnome-calculator/leo.gillot/gnome-calculator-patch-1] Added tests for rack unit conversion



commit 520004e76b10e441b32c14919f3af3ca6db42aba
Author: Robert Roth <robert roth off gmail com>
Date:   Fri Jan 31 00:50:24 2020 +0200

    Added tests for rack unit conversion

 lib/unit.vala            | 2 +-
 tests/test-equation.vala | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/lib/unit.vala b/lib/unit.vala
index 6f75e6ea..edc67a96 100644
--- a/lib/unit.vala
+++ b/lib/unit.vala
@@ -42,7 +42,7 @@ public class UnitManager : Object
         length_category.add_unit (new Unit ("parsec", _("Parsecs"), dpgettext2 (null, "unit-format", "%s 
pc"), "30857000000000000x", "x/30857000000000000", dpgettext2 (null, "unit-symbols", "parsec,parsecs,pc")));
         length_category.add_unit (new Unit ("lightyear", _("Light Years"), dpgettext2 (null, "unit-format", 
"%s ly"), "9460730472580800x", "x/9460730472580800", dpgettext2 (null, "unit-symbols", 
"lightyear,lightyears,ly")));
         length_category.add_unit (new Unit ("astronomical-unit", _("Astronomical Units"), dpgettext2 (null, 
"unit-format", "%s au"), "149597870691x", "x/149597870691", dpgettext2 (null, "unit-symbols", "au")));
-        length_category.add_unit (new Unit ("rack-unit", _("Rack Units"), dpgettext2 (null, "unit-format", 
"%sU"), "x/22.4972", "22.4972x", dpgettext2 (null, "unit-symbols", "U")));
+        length_category.add_unit (new Unit ("rack-unit", _("Rack Units"), dpgettext2 (null, "unit-format", 
"%sU"), "x/22.49718785151856", "22.49718785151856x", dpgettext2 (null, "unit-symbols", "U")));
         length_category.add_unit (new Unit ("nautical-mile", _("Nautical Miles"), dpgettext2 (null, 
"unit-format", "%s nmi"), "1852x", "x/1852", dpgettext2 (null, "unit-symbols", "nmi")));
         length_category.add_unit (new Unit ("mile", _("Miles"), dpgettext2 (null, "unit-format", "%s mi"), 
"1609.344x", "x/1609.344", dpgettext2 (null, "unit-symbols", "mile,miles,mi")));
         length_category.add_unit (new Unit ("kilometer", _("Kilometers"), dpgettext2 (null, "unit-format", 
"%s km"), "1000x", "x/1000", dpgettext2 (null, "unit-symbols", "kilometer,kilometers,km,kms")));
diff --git a/tests/test-equation.vala b/tests/test-equation.vala
index 80a86d87..cc4e6db4 100644
--- a/tests/test-equation.vala
+++ b/tests/test-equation.vala
@@ -136,6 +136,8 @@ private void test_conversions ()
     test ("1 meter in mm", "1000", 0);
     test ("1m in mm", "1000", 0);
     test ("1 inch in cm", "2.54", 0);
+    test ("44.45 mm in U", "1", 0);
+    test ("1 U in inch", "1.75", 0);
 
     /* Area */
     test ("1m² in mm²", "1000000", 0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]