C++ Library containing a lot of needful things: Stack Trace, Command Line Parser, Resource Handling, Configuration Files, Unix Command Execution, Directories, Regular Expressions, Tokenizer, Function Trace, Standard Extensions.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1006 B

#include <mrw/stacktrace.hpp>
#include <cppunit/TestFixture.h>
#include <cppunit/ui/text/TestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <iostream>
class StackTraceTest: public CppUnit::TestFixture {
public:
/// test if symbols are correctely evaluated
void StackTrace() {
mrw::StackTrace::createSymtable();
mrw::StackTrace s; int l(__LINE__); std::string f(__FILE__);
std::stringstream ss;
ss<<f<<':'<<l;
std::string st(s);
int pos(st.find(ss.str()));
std::cout<<st<<std::endl;
CPPUNIT_ASSERT(pos<st.size());
CPPUNIT_ASSERT(st.find("mrw::StackTrace::StackTrace()", pos)<st.size());
}
CPPUNIT_TEST_SUITE(StackTraceTest);
CPPUNIT_TEST(StackTrace);
CPPUNIT_TEST_SUITE_END();
};
CPPUNIT_TEST_SUITE_REGISTRATION(StackTraceTest);
int main() {
CppUnit::TextUi::TestRunner runner;
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1;
}