cppUnit

closed account (STR9GNh0)
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
cd1.test(cd2) There is no string::test. What is that supposed to do?
closed account (STR9GNh0)
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.
closed account (STR9GNh0)
cpp:22: error: no matching function for call to ‘Data::login(Data&)’

what does the above means?
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)
closed account (STR9GNh0)
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.
}
}
Topic archived. No new replies allowed.