Test: construct from floating point. More...
Public Member Functions | |
Int64x64DoubleTestCase () | |
void | Check (const int64_t intPart) |
Check the int64x64 for correctness. More... | |
void | Check (const long double dec, const long double frac, const int64_t intPart, const uint64_t lo) |
Check the int64x64 for correctness. More... | |
void | DoRun () override |
Implementation to actually run this TestCase. More... | |
Public Member Functions inherited from ns3::TestCase | |
TestCase (const TestCase &)=delete | |
virtual | ~TestCase () |
Destructor. More... | |
std::string | GetName () const |
TestCase & | operator= (const TestCase &)=delete |
Private Attributes | |
int | m_deltaCount |
The number of times a delta was recorded. More... | |
int64x64_t | m_deltaMax |
The maximum observed difference between expected and computed values. More... | |
long double | m_last |
The last value tested. More... | |
Static Private Attributes | |
static constexpr long double | MIN_LOW = 1 << MISS_MANT_DIG |
The smallest low word we expect to get from a conversion. More... | |
static const long double | MIN_MANT |
Smallest mantissa we expect to convert to a non-zero low word. More... | |
static constexpr int | MISS_MANT_DIG = std::max(0, 64 - LDBL_MANT_DIG) |
Compute a multiplier to match the mantissa size on this platform. More... | |
Additional Inherited Members | |
Public Types inherited from ns3::TestCase | |
enum | TestDuration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 } |
How long the test takes to execute. More... | |
Protected Member Functions inherited from ns3::TestCase | |
TestCase (std::string name) | |
Constructor. More... | |
void | AddTestCase (TestCase *testCase, TestDuration duration=QUICK) |
Add an individual child TestCase to this test suite. More... | |
TestCase * | GetParent () const |
Get the parent of this TestCase. More... | |
bool | IsStatusFailure () const |
Check if any tests failed. More... | |
bool | IsStatusSuccess () const |
Check if all tests passed. More... | |
void | SetDataDir (std::string directory) |
Set the data directory where reference trace files can be found. More... | |
void | ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line) |
Log the failure of this TestCase. More... | |
bool | MustAssertOnFailure () const |
Check if this run should assert on failure. More... | |
bool | MustContinueOnFailure () const |
Check if this run should continue on failure. More... | |
std::string | CreateDataDirFilename (std::string filename) |
Construct the full path to a file in the data directory. More... | |
std::string | CreateTempDirFilename (std::string filename) |
Construct the full path to a file in a temporary directory. More... | |
Test: construct from floating point.
Definition at line 1096 of file int64x64-test-suite.cc.
ns3::int64x64::test::Int64x64DoubleTestCase::Int64x64DoubleTestCase | ( | ) |
Definition at line 1175 of file int64x64-test-suite.cc.
void ns3::int64x64::test::Int64x64DoubleTestCase::Check | ( | const int64_t | intPart | ) |
Check the int64x64 for correctness.
intPart | The expected integer part value of the int64x64. |
Definition at line 1332 of file int64x64-test-suite.cc.
References ns3::TestCase::GetName(), ns3::TestCase::GetParent(), m_deltaCount, m_deltaMax, m_last, and ns3::Max().
Referenced by DoRun().
void ns3::int64x64::test::Int64x64DoubleTestCase::Check | ( | const long double | dec, |
const long double | frac, | ||
const int64_t | intPart, | ||
const uint64_t | lo | ||
) |
Check the int64x64 for correctness.
dec | The integer part of the value to test. |
frac | The fractional part of the value to test.x |
intPart | The expected integer part value of the int64x64. |
lo | The expected low part value of the int64x64. |
Definition at line 1184 of file int64x64-test-suite.cc.
References ns3::Abs(), two-ray-to-three-gpp-ch-calibration::delta, epsilon, ns3::TestCase::GetName(), ns3::TestCase::GetParent(), ns3::int64x64_t::implementation, ns3::int64x64_t::ld_impl, m_deltaCount, m_deltaMax, m_last, max, MIN_LOW, MIN_MANT, NS_TEST_ASSERT_MSG_EQ_TOL, and RUNNING_WITH_LIMITED_PRECISION.
|
overridevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 1453 of file int64x64-test-suite.cc.
References Check(), ns3::TestCase::GetName(), ns3::TestCase::GetParent(), m_deltaCount, m_deltaMax, MIN_LOW, MIN_MANT, and MISS_MANT_DIG.
|
private |
The number of times a delta was recorded.
Definition at line 1168 of file int64x64-test-suite.cc.
|
private |
The maximum observed difference between expected and computed values.
Definition at line 1167 of file int64x64-test-suite.cc.
|
private |
The last value tested.
Definition at line 1165 of file int64x64-test-suite.cc.
Referenced by Check().
|
staticconstexprprivate |
The smallest low word we expect to get from a conversion.
MIN_LOW = 2^MISS_MANT_DIG
which will be in [1, 2^64].
Definition at line 1146 of file int64x64-test-suite.cc.
|
staticprivate |
Smallest mantissa we expect to convert to a non-zero low word.
MIN_MANT = MIN_LOW / 2^64 = 2^(MISS_MANT_DIG - 64) = 2^(-EFF_MANT_DIG)
We scale and round this value to match the hard-coded fractional values in Check(intPart) which have 22 decimal digits.
Since we use std::round() which isn't constexpr, just declare this const and initialize below.
Definition at line 1162 of file int64x64-test-suite.cc.
|
staticconstexprprivate |
Compute a multiplier to match the mantissa size on this platform.
Since we will store the fractional part of a double in the low word (64 bits) of our Q64.64 the most mantissa bits we can take advantage of is
EFF_MANT_DIG = std::min (64, LDBL_MANT_DIG)
We have to bound this for platforms with LDBL_MANT_DIG > 64.
The number of "missing" bits in the mantissa is
MISS_MANT_DIG = 64 - EFF_MANT_DIG = std::max (0, 64 - LDBL_MANT_DIG)
This will lie in the closed interval [0, 64]
Definition at line 1137 of file int64x64-test-suite.cc.
Referenced by DoRun().