cppunit testing

I have no idea on what is cppunit testing. How do i start doing it?

I have this code here. How can i do cppunit testing?

#include <cstdlib>
#include <iostream>
#include <fstream>
#include <cstring>
#include "Login.h"


using namespace std;
Login::Login(){
}

string Login::cryptoShift(string enterPass)
{
for (int i = 0; i < enterPass.size(); i++)
{
enterPass[i]++;
}
return enterPass;
}

bool Login::validateLogin(string userId, string password)
{

bool validated;

//declare input file stream variable
fstream file;

//opening the file stream
file.open("loginDetails.txt", ios::in);

string output;

if (file.is_open())
{
while (file.good())
{
getline(file, output);

//check if userid matches record
if (output == userId +":"+password)
{
validated = true;
break;
}
else
validated = false;
}
file.close();
}

return validated;
}

bool Login::loginMenu()
{
string userId, password, shiftedPwd;
bool validate;

cout << "========================" << endl;
cout << "Welcome to PCFM System" << endl;
cout << "========================" << endl;
cout << "Enter your UserID: ";
cin >> userId;
cout << "Enter your password: ";
cin >> password;

shiftedPwd = cryptoShift(password);

validate = validateLogin(userId, shiftedPwd);
return validate;
}
Topic archived. No new replies allowed.