From e2961032fd1896899f688cdcdf41f23ed71e3e82 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 29 May 2021 01:11:44 +0300 Subject: namespace pdb -> namespace winapi --- test/unit_tests/call_stack.cpp | 17 +++++++++-------- test/unit_tests/dbghelp.cpp | 2 +- test/unit_tests/fixtures.hpp | 14 +++++++------- 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'test/unit_tests') 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> symbols; + std::vector> 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 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 join(Set&& xs, Set&& 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 SymbolList; - typedef Set AddressList; + typedef Set AddressList; static AddressList expected_function_addresses() { return cast({reinterpret_cast(&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&& fs) { AddressList addresses; for (auto&& f : fs) { - addresses.emplace(reinterpret_cast(f)); + addresses.emplace(reinterpret_cast(f)); } return addresses; } -- cgit v1.2.3