Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge branch 'master' of https://github.coventry.ac.uk/302CEM-1718JAN…
- Loading branch information
Showing
9 changed files
with
146 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
#include "Maths.h" | ||
|
||
// this is the function we are going to test | ||
// note that there are no API calls in this fucntion | ||
// the function only contains our business logic. | ||
int Maths::add(int a, int b) { | ||
return a + b; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
|
||
|
||
class Maths { | ||
public: | ||
int add(int, int); // this is the function we are going to test | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// TestSuiteCxx.h | ||
// This file contains our Cxx Test Suite which is defining our tests for our code in Maths.cpp | ||
|
||
#include <cxxtest/TestSuite.h> | ||
#include "Maths.h" | ||
|
||
class TestSuiteCxx : public CxxTest::TestSuite | ||
{ | ||
public: | ||
void testAddition1(void) | ||
{ | ||
Maths myObject; | ||
TS_ASSERT(myObject.add(1, 1) > 1); | ||
TS_ASSERT_EQUALS(myObject.add(1, 1), 2); | ||
} | ||
|
||
void testAddition2(void) | ||
{ | ||
Maths myObject; | ||
TS_TRACE("Starting addition2 test"); | ||
TS_ASSERT_EQUALS(myObject.add(2, 2), 5); // this will fail our test because our test has errors | ||
TS_TRACE("Finishing addition2 test"); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* Generated file, do not edit */ | ||
|
||
#ifndef CXXTEST_RUNNING | ||
#define CXXTEST_RUNNING | ||
#endif | ||
|
||
#define _CXXTEST_HAVE_STD | ||
#include <cxxtest/TestListener.h> | ||
#include <cxxtest/TestTracker.h> | ||
#include <cxxtest/TestRunner.h> | ||
#include <cxxtest/RealDescriptions.h> | ||
#include <cxxtest/TestMain.h> | ||
#include <cxxtest/ErrorPrinter.h> | ||
|
||
int main( int argc, char *argv[] ) { | ||
int status; | ||
CxxTest::ErrorPrinter tmp; | ||
CxxTest::RealWorldDescription::_worldName = "cxxtest"; | ||
status = CxxTest::Main< CxxTest::ErrorPrinter >( tmp, argc, argv ); | ||
return status; | ||
} | ||
bool suite_TestSuiteCxx_init = false; | ||
#include "TestSuiteCxx.h" | ||
|
||
static TestSuiteCxx suite_TestSuiteCxx; | ||
|
||
static CxxTest::List Tests_TestSuiteCxx = { 0, 0 }; | ||
CxxTest::StaticSuiteDescription suiteDescription_TestSuiteCxx( "TestSuiteCxx.h", 7, "TestSuiteCxx", suite_TestSuiteCxx, Tests_TestSuiteCxx ); | ||
|
||
static class TestDescription_suite_TestSuiteCxx_testAddition1 : public CxxTest::RealTestDescription { | ||
public: | ||
TestDescription_suite_TestSuiteCxx_testAddition1() : CxxTest::RealTestDescription( Tests_TestSuiteCxx, suiteDescription_TestSuiteCxx, 10, "testAddition1" ) {} | ||
void runTest() { suite_TestSuiteCxx.testAddition1(); } | ||
} testDescription_suite_TestSuiteCxx_testAddition1; | ||
|
||
static class TestDescription_suite_TestSuiteCxx_testAddition2 : public CxxTest::RealTestDescription { | ||
public: | ||
TestDescription_suite_TestSuiteCxx_testAddition2() : CxxTest::RealTestDescription( Tests_TestSuiteCxx, suiteDescription_TestSuiteCxx, 17, "testAddition2" ) {} | ||
void runTest() { suite_TestSuiteCxx.testAddition2(); } | ||
} testDescription_suite_TestSuiteCxx_testAddition2; | ||
|
||
#include <cxxtest/Root.cpp> | ||
const char* CxxTest::RealWorldDescription::_worldName = "cxxtest"; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters