Skip to content

Commit

Permalink
gtest-all-guard modified to allow delegation of main
Browse files Browse the repository at this point in the history
  • Loading branch information
codemercenary committed Aug 2, 2014
1 parent 206ddce commit f960703
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
6 changes: 6 additions & 0 deletions autowiring/gtest-all-guard.h
@@ -0,0 +1,6 @@
#pragma once

/// <summary>
/// Delegating main routine, installs an enclosure filter and begins running the tests
/// </summary>
int autotesting_main(int argc, const char* argv []);
1 change: 1 addition & 0 deletions src/autotesting/CMakeLists.txt
@@ -1,6 +1,7 @@
set(AutoTesting_SOURCES
AutowiringEnclosure.h
AutowiringEnclosure.cpp
gtest-all-guard.h
gtest-all-guard.cpp
)

Expand Down
4 changes: 2 additions & 2 deletions src/autotesting/gtest-all-guard.cpp
Expand Up @@ -5,10 +5,10 @@

using namespace std;

int main(int argc, char* argv[])
int autotesting_main(int argc, const char* argv[])
{
auto& listeners = testing::UnitTest::GetInstance()->listeners();
listeners.Append(new AutowiringEnclosure);
testing::InitGoogleTest(&argc, argv);
testing::InitGoogleTest(&argc, (char**)argv);
return RUN_ALL_TESTS();
}
5 changes: 5 additions & 0 deletions src/autowiring/benchmark/AutowiringBenchmarkTest.cpp
@@ -1,9 +1,14 @@
// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved.
#include "stdafx.h"
#include "AutowiringBenchmarkTest.hpp"
#include "gtest-all-guard.h"

class Foo {};

int main(int argc, const char* argv[]) {
return autotesting_main(argc, argv);
}

TEST_F(AutowiringBenchmarkTest, VerifySimplePerformance) {
const size_t n = 10000;

Expand Down
5 changes: 5 additions & 0 deletions src/autowiring/test/AutowiringTest.cpp
@@ -1,11 +1,16 @@
// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved.
#include "stdafx.h"
#include "AutowiringTest.hpp"
#include "gtest-all-guard.h"
#include "TestFixtures/SimpleObject.hpp"
#include "TestFixtures/SimpleReceiver.hpp"
#include <autowiring/Autowired.h>
#include <autowiring/CoreThread.h>

int main(int argc, const char* argv []) {
return autotesting_main(argc, argv);
}

TEST_F(AutowiringTest, VerifyAutowiredFast) {
// Add an object:
AutoCurrentContext()->Inject<SimpleObject>();
Expand Down

0 comments on commit f960703

Please sign in to comment.