I'm writing a few CXX unit tests for a class I have written. I have never written CXX tests before (also this is the only framework I can use). I am trying to call a function contained within my class so that I can test the output is what is expected, but I am unsure if you can do this, and if so, how.
Test.h:
class Test..... {
public:
std::string GenerateHash(const std::string& user, const std::string& url) const;
...
}
Test.cpp:
string
Test::GenerateHash(const string& user, const string& urrl) const {
...
}
I have included the header file in the CXX test, but cannot access the GenerateHash function.
Test.cxx_h:
void testCheckHashGeneration( void ) {
TS_ASSERT_EQUALS (GenerateHash("testuser", "http://www.stackoverflow.com"), "DFEGEC.....");
}
Error: error: âGenerateHashâ was not declared in this scope
I also tried:
Test.cxx_h:
void testCheckHashGeneration( void ) {
Test test;
TS_ASSERT_EQUALS (test->GenerateHash("testuser", "http://www.stackoverflow.com"), "DFEGEC.....");
}
Error: error: âTestâ has not been declared
Any help will be greatly appreciated.