Jan 29, 2011 at 6:01am UTC
my error here
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
#include "file1.h"
CPPUNIT_TEST_SUITE_REGISTRATION (FileTest);
void FileTest::setUp()
{
}
void FileTest::tearDown()
{
}
void FileTest::testEquals()
{
string cd1 = "1234abcde" ;
string cd2 = "123456789" ;
CPPUNIT_ASSERT(cd1.test(cd2));
}
FileTest.cpp:26: error: ‘struct std::string’ has no member named ‘test’
does anyone knows where went wrong? why i kept getting that error?
TIA
Last edited on Jan 29, 2011 at 6:09am UTC
Jan 29, 2011 at 6:51am UTC
cd1.test(cd2)
There is no string::test. What is that supposed to do?
Jan 29, 2011 at 7:09am UTC
hmm,
i want to create it in such a way i can test with a eg,
temp ("test this sentence", "temp", "temp")
temp2 ("test this sentence", "temp", "temp")
and compare those and determine if my unit testing is accurate.
Jan 29, 2011 at 7:24am UTC
cpp:22: error: no matching function for call to ‘Data::login(Data&)’
what does the above means?
Jan 29, 2011 at 7:42am UTC
To test for equality in string use operator== cd1==cd2;
That error could be that you don't have a method login (or that is not the prototype)
Jan 29, 2011 at 8:28pm UTC
void CppUnitTestClass::testValidatePassword() {
string p0 = "Password1";
cashierData _cashierData;
// check length of output
bool result = _cashierData.validatePassword(p0);
// if password length is correct, proceed below to test for other stuffs
if(true /*check result*/)
{
// what should i insert here to get complier to check for alphanumeric as per with my codings.
}
}