ソースを参照

Move assertions out of prelude

David Peter 2 年 前
コミット
fee8e90fbd

+ 8 - 0
examples/consistency_others.nbt

@@ -26,6 +26,12 @@ assert_eq(1 floz, 2 tablespoon)
 assert_eq(1 hogshead, 63 gallon)
 assert_eq(1 rod, 16.5 foot)
 
+assert_eq(1 foot, 0.3048 meter, 1e-9 m)
+assert_eq(1 yard, 0.9144 meter, 1e-9 m)
+assert_eq(1 mile, 1609.344 meter, 1e-9 m)
+assert_eq(1 pound, 453.6 gram, 1e-9 g)
+assert_eq(1 gallon, 3.785_411_784 L, 1e-6 L)
+
 assert_eq(1 gauss, 100 µT)
 assert_eq(1 furlong, 220 yard)
 
@@ -50,3 +56,5 @@ assert_eq(1 fortnight, 2 week)
 assert_eq(1 mmHg, 133.322387415 Pa, 1e-5 Pa)
 assert_eq(1 PSI, 6.894757 kPa)
 assert_eq(1 atm, 101_325.0 Pa)
+
+assert_eq(1 maxwell, 1e-8 weber)

+ 0 - 1
modules/units/cgs.nbt

@@ -12,7 +12,6 @@ unit gauss: MagneticFluxDensity = 100 µT
 
 @aliases(Mx)
 unit maxwell: MagneticFlux = 1 gauss × cm^2
-assert_eq(1 maxwell, 1e-8 weber)
 
 @metric_prefixes
 @aliases(Oe: short)

+ 0 - 4
modules/units/imperial.nbt

@@ -8,22 +8,18 @@ unit inch: Length = 0.0254 meter
 
 @aliases(feet, ft: short)
 unit foot: Length = 12 inch
-assert_eq(1 foot, 0.3048 meter, 1e-9 m)  # TODO(minor): move those assertions somewhere else
 
 @aliases(yards, yd: short)
 unit yard: Length = 3 feet
-assert_eq(1 yard, 0.9144 meter, 1e-9 m)
 
 @aliases(miles, mi: short)
 unit mile: Length = 1760 yard
-assert_eq(1 mile, 1609.344 meter, 1e-9 m)
 
 @aliases(ounces, oz: short)
 unit ounce: Mass = 28.35 gram
 
 @aliases(pounds, lb: short, lbs)
 unit pound: Mass = 16 ounces
-assert_eq(1 pound, 453.6 gram, 1e-9 g)
 
 @aliases(mils, mil: short)
 unit thou: Length = inch / 1000

+ 1 - 2
modules/units/us_customary.nbt

@@ -3,8 +3,7 @@ use units::imperial
 
 # US liquid gallon
 @aliases(gallons, gal: short)
-unit gallon: Volume = 3.785_411_784 L
-assert_eq(1 gallon, 231 inch^3, 0.001 inch^3)
+unit gallon: Volume = 231 in^3
 
 # US liquid pint
 @aliases(pints)