mirror of
https://github.com/nasa/trick.git
synced 2025-06-18 07:08:17 +00:00
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:
@ -2,7 +2,7 @@
|
|||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "trick/units_conv.h"
|
#include "trick/units_conv.h"
|
||||||
|
|
||||||
#define TOL 1e-13
|
#define TOL 1e-7
|
||||||
/*
|
/*
|
||||||
double tolerance(int exp)
|
double tolerance(int exp)
|
||||||
{
|
{
|
||||||
@ -65,7 +65,7 @@ TEST(UnitsInterface, Newton_to_Pound)
|
|||||||
|
|
||||||
pounds = convert_units(1.0, &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(&Newton);
|
||||||
clean_up_Units_t(&Pound);
|
clean_up_Units_t(&Pound);
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
* **********************************************************************************************************/
|
* **********************************************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#define TOL 1e-13
|
#define TOL 1e-7
|
||||||
#define PI 3.14159265358979323846
|
#define PI 3.14159265358979323846
|
||||||
|
|
||||||
namespace Trick {
|
namespace Trick {
|
||||||
@ -364,12 +364,12 @@ TEST_F(UnitConversion, KilogramToKilogram)
|
|||||||
|
|
||||||
TEST_F(UnitConversion, KilogramToSlug)
|
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_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)
|
TEST_F(UnitConversion, KilogramToGram)
|
||||||
@ -634,12 +634,12 @@ TEST_F(UnitConversion, FahrenheitPerSecondToCelsiusPerMinute)
|
|||||||
|
|
||||||
TEST_F(UnitConversion, CompositeNewtonToCompositePoundForce)
|
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_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)
|
TEST_F(UnitConversion, FootPoundsToNewtonMeters)
|
||||||
@ -662,12 +662,12 @@ TEST_F(UnitConversion, FootPoundsToNewtonMetersWithConvertTo)
|
|||||||
|
|
||||||
TEST_F(UnitConversion, CompositePoundForceToCompositeNewtonCommutative)
|
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_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
|
//Collection of Denominators
|
||||||
|
Reference in New Issue
Block a user