相关疑难解决方法(0)

如何将参数传递给gtest

如何将参数传递给我的测试套件?

gtest --number-of-input=5
Run Code Online (Sandbox Code Playgroud)

我有以下主要的gtest代码.并且--number-of-input=5应该传递给InitGoogleTest().

#include <iostream>
#include <gtest/gtest.h>

int main(int argc, char **argv) {
  std::cout << "Running main() from gtest_main.cc\n";
  ::testing::GTEST_FLAG(output) = "xml:hello.xml";
  testing::InitGoogleTest(&argc, argv);

  return RUN_ALL_TESTS();
}
Run Code Online (Sandbox Code Playgroud)

我不知道如何将我的参数传递给测试套件/案例如下?

class TestTwo : public QuickTest {
 protected:
  virtual void SetUp() {
      QuickTest::SetUp();
      square = new Square(10);
      circle = new Circle(10);

  }

  virtual void TearDown() {
      delete square;
      delete circle;
      QuickTest::TearDown();
  }

  Square* square;
  Circle* circle;
};


// Now, let's write tests using the QueueTest fixture.

// Tests the default …
Run Code Online (Sandbox Code Playgroud)

c++ unit-testing googletest

32
推荐指数
1
解决办法
3万
查看次数

标签 统计

c++ ×1

googletest ×1

unit-testing ×1