Some of Trick's unit conversions have too many significant digits #557

Hard coded values in unit conversion test program.
This commit is contained in:
Alex Lin 2018-02-09 08:49:15 -06:00
parent bc8d1a3796
commit 049c9a3207
2 changed files with 9 additions and 9 deletions

View File

@ -2,7 +2,7 @@
#include <gtest/gtest.h>
#include "trick/units_conv.h"
#define TOL 1e-13
#define TOL 1e-7
/*
double tolerance(int exp)
{
@ -65,7 +65,7 @@ TEST(UnitsInterface, Newton_to_Pound)
pounds = convert_units(1.0, &Newton_to_Pound);
ASSERT_NEAR((1.0/(0.4535923697760192*0.3048)), pounds, TOL);
ASSERT_NEAR((1.0/(0.45359237*0.3048)), pounds, TOL);
clean_up_Units_t(&Newton);
clean_up_Units_t(&Pound);

View File

@ -41,7 +41,7 @@
* **********************************************************************************************************/
#define TOL 1e-13
#define TOL 1e-7
#define PI 3.14159265358979323846
namespace Trick {
@ -364,12 +364,12 @@ TEST_F(UnitConversion, KilogramToKilogram)
TEST_F(UnitConversion, KilogramToSlug)
{
test_conversion_no_throw("kg", "sl", 0.0, (1.0/14.5939029372064), TOL);
test_conversion_no_throw("kg", "sl", 0.0, (1.0/14.59390), TOL);
}
TEST_F(UnitConversion, KilogramToPoundMass)
{
test_conversion_no_throw("kg", "lbm", 0.0, (1.0/0.4535923697760192), TOL);
test_conversion_no_throw("kg", "lbm", 0.0, (1.0/0.45359237), TOL);
}
TEST_F(UnitConversion, KilogramToGram)
@ -634,12 +634,12 @@ TEST_F(UnitConversion, FahrenheitPerSecondToCelsiusPerMinute)
TEST_F(UnitConversion, CompositeNewtonToCompositePoundForce)
{
test_conversion_no_throw("kg*m/s2", "lbm*ft/s*s", 0.0, (1/(0.4535923697760192*0.3048)) , TOL);
test_conversion_no_throw("kg*m/s2", "lbm*ft/s*s", 0.0, (1/(0.45359237*0.3048)) , TOL);
}
TEST_F(UnitConversion, CompositePoundForceToCompositeNewton)
{
test_conversion_no_throw("lbm*ft/s2", "kg*m/s*s", 0.0, (0.4535923697760192*0.3048), TOL);
test_conversion_no_throw("lbm*ft/s2", "kg*m/s*s", 0.0, (0.45359237*0.3048), TOL);
}
TEST_F(UnitConversion, FootPoundsToNewtonMeters)
@ -662,12 +662,12 @@ TEST_F(UnitConversion, FootPoundsToNewtonMetersWithConvertTo)
TEST_F(UnitConversion, CompositePoundForceToCompositeNewtonCommutative)
{
test_conversion_no_throw("lbm*ft/s*s", "m*kg/s2", 0.0, (0.4535923697760192*0.3048), TOL);
test_conversion_no_throw("lbm*ft/s*s", "m*kg/s2", 0.0, (0.45359237*0.3048), TOL);
}
TEST_F(UnitConversion, CompositeNewtonToCompositePoundForceCommutative)
{
test_conversion_no_throw("m*kg/s2", "lbm*ft/s*s", 0.0, (1/(0.4535923697760192*0.3048)), TOL);
test_conversion_no_throw("m*kg/s2", "lbm*ft/s*s", 0.0, (1/(0.45359237*0.3048)), TOL);
}
//Collection of Denominators