I'm trying to do some CppUnit testing on my program using Ubuntu NetBeans but I keep encountering similar errors (invalid use of void expression). I'm not sure what went wrong. Any help will be greatly appreciated.
The error goes like this:
g++ -c -O2 -I/usr/include/cppunit -MMD -MP -MF build/Release/GNU-Linux-x86/AssignmentTest.o.d -o build/Release/GNU-Linux-x86/AssignmentTest.o AssignmentTest.cpp
AssignmentTest.cpp: In member function ‘void AssignmentTest::testTitle()’:
AssignmentTest.cpp:10: error: invalid use of void expression
My AssignmentTest.cpp:
#include "AssignmentTest.h"
#include "GetInfo.h"
CPPUNIT_TEST_SUITE_REGISTRATION (AssignmentTest);
void AssignmentTest::testTitle()
{
//info2 = "";
//CPPUNIT_ASSERT(info2.testTitle(info2));
CPPUNIT_ASSERT_EQUAL(info2, info2.GetTitle());
}
My AssignmentTest.h:
#ifndef _ASSIGNMENTTEST_H
#define _ASSIGNMENTTEST_H
#include <cppunit/TestCase.h>
#include <cppunit/extensions/HelperMacros.h>
#include <vector>
#include "GetInfo.h"
class AssignmentTest : public CppUnit::TestFixture
{
CPPUNIT_TEST_SUITE (AssignmentTest);
CPPUNIT_TEST (testTitle);
CPPUNIT_TEST (testDirector);
CPPUNIT_TEST (testReleaseDate);
CPPUNIT_TEST (testPlot);
CPPUNIT_TEST (testRunTime);
CPPUNIT_TEST_SUITE_END ();
private:
GetInfo info1;
GetInfo info2;
GetInfo info3;
GetInfo info4;
GetInfo info5;
GetInfo info6;
public:
protected:
void testTitle();
void testDirector();
void testReleaseDate();
void testPlot();
void testRunTime();
};
#endif
My GetInfo.h:
#include <string>
#ifndef _GETINFO_H
#define _GETINFO_H
using namespace std;
class GetInfo
{
public:
GetInfo();
void GrabMovie(void);
void GetTitle(void);
void GetDirector(void);
void GetReleaseDate(void);
void GetPlot(void);
void GetRunTime(void);
private:
};
#endif