Skip to content

Commit

Permalink
AutoNetTest builds and runs
Browse files Browse the repository at this point in the history
  • Loading branch information
gtremper committed Jul 29, 2014
1 parent 8a8a87c commit a76d6e4
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 17 deletions.
11 changes: 3 additions & 8 deletions contrib/C++11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
set(
Cpp11_SRCS
set(Cpp11_SRCS
boost_array.h
boost_atomic.h
boost_chrono.h
boost_exception_ptr.h
boost_functional.h
boost_future.h
Expand All @@ -18,9 +19,3 @@ set(
unique_ptr.h
)

if(BUILD_WINDOWS)
# warngs: stdafx.cpp.o has no symbols
# test-compile on Windows, although not necessary there either
add_library(Cpp11 STATIC ${Cpp11_SRCS})
set_property(TARGET Cpp11 PROPERTY FOLDER "Utility")
endif()
4 changes: 3 additions & 1 deletion contrib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
add_subdirectory(json11)
#add_subdirectory(json11)
add_subdirectory(jzon)
add_subdirectory(C++11)
5 changes: 3 additions & 2 deletions src/autonet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
find_package(Boost QUIET)
find_package(Boost QUIET COMPONENTS system)
if(NOT Boost_FOUND)
message("Cannot build Autonet, boost not installed on this system")
return()
Expand All @@ -15,4 +15,5 @@ set(AutoNet_SRCS

ADD_MSVC_PRECOMPILED_HEADER("stdafx.h" "stdafx.cpp" AutoNet_SRCS)
add_library(AutoNet STATIC ${AutoNet_SRCS})
target_link_libraries(AutoNet jzon)
target_link_libraries(AutoNet Autowiring jzon ${Boost_LIBRARIES})
set_property(TARGET AutoNet PROPERTY FOLDER "Autowiring")
4 changes: 3 additions & 1 deletion src/autonet/test/AutoNetServerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ TEST_F(AutoNetServerTest, Breakpoint) {
autonet->Breakpoint("Main");
}

TEST_F(AutoNetServerTest, DISABLED_SimpleTest) {
TEST_F(AutoNetServerTest, SimpleTest) {
AutoGlobalContext global;
auto ctxt = global->Create<ContextA>();
CurrentContextPusher pshr(ctxt);
Expand All @@ -77,6 +77,8 @@ TEST_F(AutoNetServerTest, DISABLED_SimpleTest) {
auto ctxt3 = ctxt->Create<ContextC>();

ctxt2->Initiate();

ctxt->Wait();

std::shared_ptr<CoreContext> newContext;

Expand Down
4 changes: 3 additions & 1 deletion src/autonet/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
include_directories(
#include test helpers form autowiring
${PROJECT_SOURCE_DIR}/src/autowiring/test
)

set(
AutoNetTest_SRCS
AutoNetServerTest.hpp
AutoNetServerTest.cpp
gtest-all-guard.cpp
)

ADD_MSVC_PRECOMPILED_HEADER("stdafx.h" "stdafx.cpp" AutoNetTest_SRCS)
add_executable(AutoNetTest ${AutoNetTest_SRCS})
target_link_libraries(AutoNetTest Autowiring AutowiringFixture)
target_link_libraries(AutoNetTest AutoNet)
set_property(TARGET AutoNetTest PROPERTY FOLDER "Autowiring")

# This is a unit test, let CMake know this
Expand Down
28 changes: 28 additions & 0 deletions src/autonet/test/gtest-all-guard.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (C) 2012-2014 Leap Motion, Inc. All rights reserved.
#include "stdafx.h"
#if __APPLE__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-private-field"
#endif
#include <gtest/gtest-all.cc>
#include <iostream>

using namespace testing::internal;
using namespace std;

// Misc. globals:
int g_argc;
char** g_argv;

template<class T, int n>
const char (&ArraySizer(const T (&vals)[n]))[n];
#define ARYLEN(x) sizeof(ArraySizer(x))

int main(int argc, char* argv[])
{
g_argc = argc;
g_argv = argv;

testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
4 changes: 0 additions & 4 deletions src/autowiring/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
add_googletest(test)

# These source files should all be treated as being local to their corresponding headers, so
# we add the autowiring include path directly
#include_directories(${CMAKE_SOURCE_DIR}/autowiring)

set(Autowiring_SRCS
at_exit.h
AnySharedPointer.h
Expand Down

0 comments on commit a76d6e4

Please sign in to comment.