How to pass parameters to the gtest

前端 未结 1 1103
栀梦
栀梦 2020-12-25 12:19

How can I pass parameter to my test suites?

gtest --number-of-input=5

I have the following main gtest code. And --number-of-input=5

相关标签:
1条回答
  • 2020-12-25 12:55

    Google Test only recognizes its own command-line options. Each time it finds one, it removes it from argv and updates argc accordingly, so after InitGoogleTest returns, anything left over in argv is available for you to process yourself. Use your favorite command-line-parsing technique, store the results in some global variable, and refer to it during your tests.

    If a command-line options looks like a Google Test option but really isn't, then the program will print its help message and exit without running any tests. Google Test options start with gtest_.

    0 讨论(0)
提交回复
热议问题