summaryrefslogtreecommitdiffstats
path: root/Tests/GoogleTest/Test/main1.cxx
blob: c353d9146a25ac65927dd29c3e1b336ee6c75044 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <string>

#include <gtest/gtest.h>

namespace {
bool shouldFail = false;
}

TEST(GoogleTest, LinksAndRuns)
{
  ASSERT_TRUE(true);
}

TEST(GoogleTest, ConditionalFail)
{
  ASSERT_FALSE(shouldFail);
}

int main(int argc, char* argv[])
{
  ::testing::InitGoogleTest(&argc, argv);

  if (argc > 1) {
    if (argv[1] != std::string("--forceFail")) {
      throw "Unexpected argument";
    }
    shouldFail = true;
  }
  return RUN_ALL_TESTS();
}