fix small bugs

This commit is contained in:
Mathieu Lacage
2011-04-13 08:35:49 +02:00
parent a2fab881af
commit 8c7070077b
4 changed files with 2 additions and 73 deletions

View File

@@ -80,7 +80,7 @@ INT64X64_OP_CMP(>)
INT64X64_OP_CMP(>=)
std::ostream &operator << (std::ostream &os, const int64x64_t &val);
std::istream &operator << (std::istream &is, int64x64_t &val);
std::istream &operator >> (std::istream &is, int64x64_t &val);
inline int64x64_t Abs (const int64x64_t &value)
{

View File

@@ -33,7 +33,6 @@ Int64x64FracTestCase::DoRun (void)
CheckFrac (1, 1);
CheckFrac (-1, 0);
CheckFrac (-1, 1);
return GetErrorStatus ();
}
@@ -75,8 +74,6 @@ Int64x64InputTestCase::DoRun (void)
CheckString ("1.0000000", 1, 0);
CheckString ("1.08446744073709551615", 1, 8446744073709551615LL);
CheckString ("-1.08446744073709551615", -1, 8446744073709551615LL);
return GetErrorStatus ();
}
class Int64x64InputOutputTestCase : public TestCase
@@ -111,8 +108,6 @@ Int64x64InputOutputTestCase::DoRun (void)
CheckString ("-1.08446744073709551615");
CheckString ("+1.18446744073709551615");
CheckString ("-1.18446744073709551615");
return GetErrorStatus ();
}
#define CHECK_EXPECTED(a,b) \
@@ -174,8 +169,6 @@ Int64x64ArithmeticTestCase::DoRun (void)
// much precision internally: it is almost always the
// final conversion which loses precision.
CHECK_EXPECTED (V (2000000000) / V(3) * V(3), 1999999999);
return GetErrorStatus ();
}
class Int64x64Bug455TestCase : public TestCase
@@ -207,8 +200,6 @@ Int64x64Bug455TestCase::DoRun (void)
a = int64x64_t (0.5);
a *= int64x64_t (-5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), -2.5, "only second operand negative");
return GetErrorStatus ();
}
class Int64x64Bug863TestCase : public TestCase
@@ -241,8 +232,6 @@ Int64x64Bug863TestCase::DoRun (void)
a = int64x64_t (-0.5);
a /= int64x64_t (-0.5);
NS_TEST_ASSERT_MSG_EQ (a.GetDouble (), 1.0, "both arguments negative");
return GetErrorStatus ();
}
class Int64x64CompareTestCase : public TestCase
@@ -265,8 +254,6 @@ Int64x64CompareTestCase::DoRun (void)
NS_TEST_ASSERT_MSG_EQ ((V(1) > V(-1)), true, "a is bigger than b");
NS_TEST_ASSERT_MSG_EQ ((V(1) < V(2)), true, "a is smaller than b");
return GetErrorStatus ();
}
class Int64x64InvertTestCase : public TestCase
@@ -328,7 +315,6 @@ Int64x64InvertTestCase::DoRun (void)
TEST(100000000000000LL);
TEST(1000000000000000LL);
#undef TEST
return GetErrorStatus ();
}

View File

@@ -24,24 +24,6 @@
namespace ns3 {
class Bug863TestCase : public TestCase
{
public:
Bug863TestCase ();
virtual void DoRun (void);
};
Bug863TestCase::Bug863TestCase ()
: TestCase ("Bug 863")
{
}
void Bug863TestCase::DoRun (void)
{
Scalar result = Scalar (0.9) / Scalar (1.0);
NS_TEST_ASSERT_MSG_EQ ((result == Scalar (0.9)), true, "Invalid arithmetic result");
}
class TimeSimpleTestCase : public TestCase
{
public:
@@ -88,52 +70,13 @@ TimeSimpleTestCase::DoTearDown (void)
Time::SetResolution (m_originalResolution);
}
class ArithTestCase : public TestCase
{
public:
ArithTestCase ();
private:
virtual void DoRun (void);
};
ArithTestCase::ArithTestCase ()
: TestCase ("check arithmetic operators")
{
}
void
ArithTestCase::DoRun (void)
{
Time a, b, c;
c = a + b;
c = a * b;
c = a / Seconds (1.0);
c = a - b;
c += a;
c -= a;
c /= Seconds (1.0);
c *= a;
bool x;
x = a < b;
x = a > b;
x = a <= b;
x = a >= b;
x = a == b;
x = a != b;
//a = 1.0;
//a = 1;
}
static class TimeTestSuite : public TestSuite
{
public:
TimeTestSuite ()
: TestSuite ("time", UNIT)
{
AddTestCase (new Bug863TestCase ());
AddTestCase (new TimeSimpleTestCase (Time::US));
AddTestCase (new ArithTestCase ());
}
} g_timeTestSuite;

View File

@@ -151,7 +151,7 @@ def build(bld):
'test/command-line-test-suite.cc',
'test/config-test-suite.cc',
'test/global-value-test-suite.cc',
'test/int64x64-precision-test-suite.cc',
'test/int64x64-test-suite.cc',
'test/names-test-suite.cc',
'test/object-test-suite.cc',
'test/ptr-test-suite.cc',