cpp_Unit_Test - 8BitsCoding/RobotMentor GitHub Wiki
빈 프로젝트 -> test_console.cpp를 생성한다.
#include <iostream>
template <typename Type>
Type ReturnSameType(const Type& type)
{
return type;
}
int main()
{
}
테스트 코드를 삽입한다.
#include "stdafx.h"
#include "CppUnitTest.h"
#include "../../UnitTest_Pro1/UnitTest_Pro1/test_console.cpp"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
namespace UnitTest1
{
TEST_CLASS(UnitTest1)
{
public:
TEST_METHOD(TestMethod1)
{
// TODO: 테스트 코드를 여기에 입력합니다.
Assert::AreEqual(ReturnSameType(true), true);
Assert::AreNotEqual(ReturnSameType(true), true);
}
TEST_METHOD(PointerTest)
{
int * pInt = nullptr;
Assert::IsNull(ReturnSameType(pInt));
}
};
}
테스트를 진행해 본다.
테스트 -> 실행 -> 모든 테스트