Can use both main and nomain gtest in same project. Fixes #149.
parent
2c3986796e
commit
39c26d6fe0
3 changed files with 19 additions and 1 deletions
@ -1,6 +1,10 @@ |
||||
project('gtest', 'cpp') |
||||
|
||||
gtest = dependency('gtest', main : true) |
||||
gtest_nomain = dependency('gtest', main : false) |
||||
|
||||
e = executable('testprog', 'test.cc', dependencies : gtest) |
||||
test('gtest test', e) |
||||
|
||||
e = executable('testprog_nomain', 'test_nomain.cc', dependencies : gtest_nomain) |
||||
test('gtest nomain test', e) |
||||
|
@ -0,0 +1,14 @@ |
||||
#include<gtest/gtest.h> |
||||
|
||||
TEST(basic_test, eq_works) { |
||||
ASSERT_EQ(0, 1-1) << "Equality is broken. Mass panic!"; |
||||
} |
||||
|
||||
TEST(basic_test, neq_works) { |
||||
ASSERT_NE(15, 106) << "Inequal is equal. The foundations of space and time are in jeopardy."; |
||||
} |
||||
|
||||
int main(int argc, char **argv) { |
||||
::testing::InitGoogleTest(&argc, argv); |
||||
return RUN_ALL_TESTS(); |
||||
} |
Loading…
Reference in new issue