0. 杂问杂记
1. Sample 3
* Fixture
// The tests share the test fixture in the sense of code sharing, not
// data sharing. Each test is given its own fresh copy of the
// fixture. You cannot expect the data modified by one test to be
// passed on to another test, which is a bad idea.
test-independency!
* SetUp() / TearDown()
All "virtual"
Q: Why ?
* Questions
// The macros for indicating the success/failure of a test
// (EXPECT_TRUE, FAIL, etc) need to know what the current test is
// (when Google Test prints the test result, it tells you which test
// each failure belongs to). Technically, these macros invoke a
// member function of the Test class. Therefore, you cannot use them
// in a global function. That's why you should put test sub-routines
// in a test fixture.
What does this mean ?
2. Sample 4
3. Sample 5
fixtues for multiple test cases: super Fixture !
make错误如下:
[root@localhost make]# make -f Makefile-4 clean
rm -f sample4_unittest *.o
[root@localhost make]# make -f Makefile-4
g++ -I../include -g -Wall -Wextra -c ../samples/sample4_unittest.cc ../samples/sample1.h ../samples/sample3-inl.h
g++ -I../include -I.. -g -Wall -Wextra -c /
../src/gtest-all.cc
在包含自 ../src/gtest-all.cc:42 的文件中:
../src/gtest.cc:34:25: 错误:calling fdopen:错误的文件描述符
在包含自 ../src/gtest.cc:132 的文件中,
从 ../src/gtest-all.cc:42:
../src/gtest-internal-inl.h:65:36: 错误:calling fdopen:错误的文件描述符
在包含自 ../src/gtest-all.cc:48 的文件中:
../src/gtest-typed-test.cc:33:25: 错误:calling fdopen:错误的文件描述符
make: *** [gtest-all.o] 错误 1