Cpputest

From Yefu's notes
Jump to: navigation, search

Main:

#include "stdafx.h"

#ifdef _DEBUG
#pragma comment(lib, "CppUTestd")
#else
#pragma comment(lib, "CppUTest")
#endif
#pragma comment(lib, "winmm")

#pragma warning(push)
#pragma warning(disable:4290)
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/MockSupport.h"
#pragma warning(pop)

 
int _tmain(int argc, char* argv[])
{
	return CommandLineTestRunner::RunAllTests(argc, argv);
}

Test:

#include "stdafx.h"

#pragma warning(push)
#pragma warning(disable:4290)
#include "CppUTest/CommandLineTestRunner.h"
#include "CppUTest/TestPlugin.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTestExt/MockSupport.h"
#pragma warning(pop)



TEST_GROUP(MessageTest)
{
	void setup()
	{   
		MemoryLeakWarningPlugin::turnOffNewDeleteOverloads();
 
	}   
 
	void teardown()
	{   
		MemoryLeakWarningPlugin::turnOnNewDeleteOverloads();
	}
};
 
 
TEST(MessageTest, exampleTest)
{
	CHECK(true);
}