gtest安装使用
//下载gtest-1.0.0.tar.gz并解压 ./configure make sudo make install //foo.h #ifndef FOO_H #define FOO_H int f(); #endif //foo.cpp #include "foo.h" int f() { return 0; } //test_foo.cpp #include <gtest/gtest.h> #include "foo.h" TEST(test_foo, f) { //此处必须是tab 否则会有问题 ASSERT_EQ(0, f()); } //命令使用 g++ test_foo.cpp foo.cpp -o main -lpthread -lgtest