aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/unit_tests
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit_tests')
-rw-r--r--test/unit_tests/call_stack.cpp17
-rw-r--r--test/unit_tests/dbghelp.cpp2
-rw-r--r--test/unit_tests/fixtures.hpp14
3 files changed, 17 insertions, 16 deletions
diff --git a/test/unit_tests/call_stack.cpp b/test/unit_tests/call_stack.cpp
index 968555a..2f022c6 100644
--- a/test/unit_tests/call_stack.cpp
+++ b/test/unit_tests/call_stack.cpp
@@ -21,7 +21,7 @@ BOOST_FIXTURE_TEST_SUITE(call_stack_tests, CurrentProcess)
BOOST_AUTO_TEST_CASE(call_stack) {
try {
test_ns::throw_call_stack();
- } catch (const pdb::CallStack& call_stack) {
+ } catch (const winapi::CallStack& call_stack) {
// First, check that the call stack has been caught.
BOOST_TEST(true, "Caught the call stack");
@@ -32,23 +32,23 @@ BOOST_AUTO_TEST_CASE(call_stack) {
BOOST_TEST_MESSAGE("Call stack:");
for (const auto& addr : call_stack) {
pretty.emplace_back(call_stack.pretty_print_address(dbghelp, addr));
- BOOST_TEST_MESSAGE('\t' << pdb::format_address(addr) << ' ' << pretty.back());
+ BOOST_TEST_MESSAGE('\t' << winapi::format_address(addr) << ' ' << pretty.back());
}
// Second, resolve the symbols:
- std::vector<boost::optional<pdb::SymbolInfo>> symbols;
+ std::vector<boost::optional<winapi::SymbolInfo>> symbols;
symbols.reserve(call_stack.length);
BOOST_TEST_MESSAGE("Resolved symbols:");
for (const auto& addr : call_stack) {
try {
auto symbol = dbghelp.resolve_symbol(addr);
- BOOST_TEST_MESSAGE('\t' << pdb::format_address(symbol.get_offline_address()) << ' '
- << symbol.get_name());
+ BOOST_TEST_MESSAGE('\t' << winapi::format_address(symbol.get_offline_address())
+ << ' ' << symbol.get_name());
symbols.emplace_back(std::move(symbol));
} catch (const std::system_error& e) {
symbols.emplace_back(boost::none);
- BOOST_TEST_MESSAGE('\t' << pdb::format_address(addr)
+ BOOST_TEST_MESSAGE('\t' << winapi::format_address(addr)
<< " Couldn't resolve symbol: " << e.what());
}
}
@@ -57,14 +57,15 @@ BOOST_AUTO_TEST_CASE(call_stack) {
// Third, check that the expected function addresses are in the call stack.
const auto expected = expected_function_addresses();
- const auto check = [&](pdb::Address addr) {
+ const auto check = [&](winapi::Address addr) {
for (const auto& symbol : symbols)
if (symbol && symbol->get_offline_address() == addr)
return true;
return false;
};
for (const auto& addr : expected) {
- BOOST_TEST(check(addr), "Function frame captured: " << pdb::format_address(addr));
+ BOOST_TEST(check(addr),
+ "Function frame captured: " << winapi::format_address(addr));
}
}
diff --git a/test/unit_tests/dbghelp.cpp b/test/unit_tests/dbghelp.cpp
index 293c8b1..24beda1 100644
--- a/test/unit_tests/dbghelp.cpp
+++ b/test/unit_tests/dbghelp.cpp
@@ -21,7 +21,7 @@ BOOST_AUTO_TEST_CASE(enum_symbols) {
// First, enumerate all the symbols:
std::vector<std::string> all_symbols;
{
- const auto callback = [&all_symbols](const pdb::SymbolInfo& symbol) {
+ const auto callback = [&all_symbols](const winapi::SymbolInfo& symbol) {
all_symbols.emplace_back(symbol.get_name());
};
dbghelp.enum_symbols(callback);
diff --git a/test/unit_tests/fixtures.hpp b/test/unit_tests/fixtures.hpp
index 3da2b3b..f9f9872 100644
--- a/test/unit_tests/fixtures.hpp
+++ b/test/unit_tests/fixtures.hpp
@@ -30,11 +30,11 @@ Set<T> join(Set<T>&& xs, Set<T>&& ys) {
class DbgHelp {
public:
- DbgHelp(pdb::DbgHelp&& dbghelp) : dbghelp{std::move(dbghelp)} {}
+ DbgHelp(winapi::DbgHelp&& dbghelp) : dbghelp{std::move(dbghelp)} {}
~DbgHelp() { BOOST_TEST_MESSAGE("Cleaning up DbgHelp"); }
- const pdb::DbgHelp dbghelp;
+ const winapi::DbgHelp dbghelp;
static const std::string& get_module_name() {
static const std::string name{"test_lib"};
@@ -47,7 +47,7 @@ public:
}
typedef Set<std::string> SymbolList;
- typedef Set<pdb::Address> AddressList;
+ typedef Set<winapi::Address> AddressList;
static AddressList expected_function_addresses() {
return cast({reinterpret_cast<void*>(&test_ns::foo),
@@ -66,12 +66,12 @@ public:
}
protected:
- static pdb::DbgHelp init_dbghelp(bool current_process) {
+ static winapi::DbgHelp init_dbghelp(bool current_process) {
BOOST_TEST_MESSAGE("Initializing DbgHelp");
if (current_process) {
- return pdb::DbgHelp::current_process();
+ return winapi::DbgHelp::current_process();
} else {
- return pdb::DbgHelp::post_mortem();
+ return winapi::DbgHelp::post_mortem();
}
}
@@ -79,7 +79,7 @@ private:
static AddressList cast(Set<void*>&& fs) {
AddressList addresses;
for (auto&& f : fs) {
- addresses.emplace(reinterpret_cast<pdb::Address>(f));
+ addresses.emplace(reinterpret_cast<winapi::Address>(f));
}
return addresses;
}