现在的位置: 首页 > 综合 > 正文

test

2018年04月06日 ⁄ 综合 ⁄ 共 632字 ⁄ 字号 评论关闭

// tester.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <iostream>
using namespace std;

#define EXPECT_EQ(type,expectation,test_value) \
do \
{ \
const type& tmp = test_value;\
if (expectation != tmp)\
{ \
cout << "Error! Expect " << expectation << ", get " << tmp << " at line " << __LINE__ << ", file " << __FILE__ << endl; \
} \
} while (false)

#define ASSERT_EQ(type,expectation,test_value) \
do \
{ \
const type& tmp = test_value;\
if (expectation != tmp)\
{ \
cout << "Fatal error! Expect " << expectation << ", get " << tmp << " at line " << __LINE__ << ", file " << __FILE__ << endl; \
exit(0);\
} \
} while (false)

int main(int argc, const char* argv[])
{
A a = A();
ASSERT_EQ(int,0,1);
EXPECT_EQ(int,0,1);
return 0;
}

抱歉!评论已关闭.