summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/base/SConscript1
-rw-r--r--src/base/addr_range_map_test.cc (renamed from src/unittest/rangemaptest.cc)37
-rw-r--r--src/unittest/SConscript1
3 files changed, 13 insertions, 26 deletions
diff --git a/src/base/SConscript b/src/base/SConscript
index 3570d1574..d84eba14c 100644
--- a/src/base/SConscript
+++ b/src/base/SConscript
@@ -83,6 +83,7 @@ Source('loader/symtab.cc')
Source('stats/text.cc')
GTest('addr_range_test', 'addr_range_test.cc')
+GTest('AddrRangeMapTest', 'addr_range_map_test.cc')
GTest('bituniontest', 'bituniontest.cc')
GTest('CircleBufTest', 'circlebuftest.cc')
diff --git a/src/unittest/rangemaptest.cc b/src/base/addr_range_map_test.cc
index 88e1c4d66..397372c06 100644
--- a/src/unittest/rangemaptest.cc
+++ b/src/base/addr_range_map_test.cc
@@ -40,44 +40,31 @@
* Authors: Ali Saidi
*/
-#include <cassert>
-#include <iostream>
+#include <gtest/gtest.h>
#include "base/addr_range_map.hh"
-using namespace std;
-
-int
-main()
+// Converted from legacy unit test framework
+TEST(AddrRangeMapTest, LegacyTests)
{
AddrRangeMap<int> r;
-
AddrRangeMap<int>::const_iterator i;
i = r.insert(RangeIn(10, 40), 5);
- assert(i != r.end());
- i = r.insert(RangeIn(60, 90), 3);
- assert(i != r.end());
+ ASSERT_NE(i, r.end());
- i = r.intersects(RangeIn(20, 30));
- assert(i != r.end());
- cout << i->first.to_string() << " " << i->second << endl;
-
- i = r.contains(RangeIn(55, 55));
- assert(i == r.end());
+ i = r.insert(RangeIn(60, 90), 3);
+ ASSERT_NE(i, r.end());
- i = r.intersects(RangeIn(55, 55));
- assert(i == r.end());
+ EXPECT_NE(r.intersects(RangeIn(20, 30)), r.end());
+ EXPECT_EQ(r.contains(RangeIn(55, 55)), r.end());
+ EXPECT_EQ(r.intersects(RangeIn(55, 55)), r.end());
i = r.insert(RangeIn(0, 12), 1);
- assert(i == r.end());
+ EXPECT_EQ(i, r.end());
i = r.insert(RangeIn(0, 9), 1);
- assert(i != r.end());
-
- i = r.contains(RangeIn(20, 30));
- assert(i != r.end());
- cout << i->first.to_string() << " " << i->second << endl;
+ ASSERT_NE(i, r.end());
- return 0;
+ EXPECT_NE(r.contains(RangeIn(20, 30)), r.end());
}
diff --git a/src/unittest/SConscript b/src/unittest/SConscript
index b104932ba..3f657345f 100644
--- a/src/unittest/SConscript
+++ b/src/unittest/SConscript
@@ -35,7 +35,6 @@ Source('unittest.cc')
UnitTest('cprintftime', 'cprintftime.cc')
UnitTest('initest', 'initest.cc')
UnitTest('nmtest', 'nmtest.cc')
-UnitTest('rangemaptest', 'rangemaptest.cc')
UnitTest('refcnttest', 'refcnttest.cc')
UnitTest('strnumtest', 'strnumtest.cc')