???????????
????gtest??Google?????????????C++???????????????????????????????????????????death???????????????????????????????????????????в????????XML???????棬?????????ο????????????ο?????
???????????
???????????????gtest??????μ?????汾??gtest-1.7.0???????????gtest??
????#unzip gtest-1.7.0.zip
????#cd gtest-1.7.0
????#./configure
????#make
???????lib/.libs??????????libgtest.a??libgtest_main.a??????????????????????????
????????????
???????潫?????????????gtest????????????
????1???????????
??????д???????????foo.h?б?д????max???????????е??????
#ifndef __FOO_H__
#define __FOO_H__
int max(int a?? int b)
{
return a>b?a:b;
}
#endif
????2?????????
??????д???????test_foo.cpp????foo.h???в????
#include "gtest/gtest.h"
#include "foo.h"
TEST(foo?? max)
{
EXPECT_EQ(2?? max(2?? 1));
EXPECT_EQ(3?? max(2?? 3));
}
int main(int argc?? char **argv)
{
::testing::InitGoogleTest(&argc?? argv);
return RUN_ALL_TESTS();
}