我有多个单元测试,每个测试都在一个单独的文件中。
我的标准单元测试之一如下所示:
#include "gmock/gmock.h"
#include "gtest/gtest.h"
class ClassAUnitTest : public ::testing::Test {
protected:
// Per-test-case set-up.
// Called before the first test in this test case.
// Can be omitted if not needed.
static void SetUpTestCase() {
//..
}
// Per-test-case tear-down.
// Called after the last test in this test case.
// Can be omitted if not needed.
static void TearDownTestCase() {
//..
}
// You can define per-test set-up and tear-down logic as usual.
virtual void SetUp() { …Run Code Online (Sandbox Code Playgroud)