File tree Expand file tree Collapse file tree 6 files changed +99
-7
lines changed Expand file tree Collapse file tree 6 files changed +99
-7
lines changed Original file line number Diff line number Diff line change 1+ /build /
2+ /cmake-build-debug /
3+ /server /
4+ /test /cmake-build-debug /
5+ /include /osmformat.pb.o
6+ /include /osmformat.pb.h
7+ /include /vector_tile.pb.h
Original file line number Diff line number Diff line change @@ -11,3 +11,7 @@ tilemaker
1111# protocol buffers generated headers
1212include /osmformat.pb.h
1313include /vector_tile.pb.h
14+
15+ # cmake directories
16+ cmake-build-debug /
17+ test /cmake-build-debug /
Original file line number Diff line number Diff line change @@ -105,13 +105,49 @@ file(GLOB tilemaker_src_files
105105 src/shp_mem_tiles.cpp
106106 src/tilemaker.cpp
107107 src/write_geometry.cpp
108- )
108+ )
109109add_executable (tilemaker vector_tile.pb.cc osmformat.pb.cc ${tilemaker_src_files} )
110- target_link_libraries (tilemaker ${PROTOBUF_LIBRARY} ${LIBSHP_LIBRARIES} ${SQLITE3_LIBRARIES} ${LUAJIT_LIBRARY} ${LUA_LIBRARIES} ${ZLIB_LIBRARY} ${THREAD_LIB} ${CMAKE_DL_LIBS}
111- Boost::system Boost::filesystem Boost::program_options Boost::iostreams)
110+ target_link_libraries (tilemaker
111+ ${PROTOBUF_LIBRARY}
112+ ${LIBSHP_LIBRARIES}
113+ ${SQLITE3_LIBRARIES}
114+ ${LUAJIT_LIBRARY}
115+ ${LUA_LIBRARIES}
116+ ${ZLIB_LIBRARY}
117+ ${THREAD_LIB}
118+ ${CMAKE_DL_LIBS}
119+ Boost::system
120+ Boost::filesystem
121+ Boost::program_options
122+ Boost::iostreams
123+ )
112124
113125if (MSVC )
114126 target_link_libraries (tilemaker unofficial::sqlite3::sqlite3)
115127endif ()
116128
117129install (TARGETS tilemaker RUNTIME DESTINATION bin)
130+
131+ # Unit tests
132+ add_library (libtilemaker SHARED STATIC
133+ src/helpers.cpp
134+ include /helpers.h
135+ vector_tile.pb.cc
136+ osmformat.pb.cc
137+ )
138+ target_link_libraries (libtilemaker
139+ ${PROTOBUF_LIBRARY}
140+ ${LIBSHP_LIBRARIES}
141+ ${SQLITE3_LIBRARIES}
142+ ${LUAJIT_LIBRARY}
143+ ${LUA_LIBRARIES}
144+ ${ZLIB_LIBRARY}
145+ ${THREAD_LIB}
146+ ${CMAKE_DL_LIBS}
147+ Boost::system
148+ Boost::filesystem
149+ Boost::program_options
150+ Boost::iostreams
151+ )
152+
153+ add_subdirectory (test )
Original file line number Diff line number Diff line change @@ -19,22 +19,30 @@ RUN apt-get update && \
1919 libboost-system-dev \
2020 libboost-iostreams-dev \
2121 rapidjson-dev \
22- cmake
22+ cmake \
23+ libboost-test-dev
2324
2425COPY CMakeLists.txt /
2526COPY cmake /cmake
2627COPY src /src
2728COPY include /include
29+ COPY test /test
2830
2931WORKDIR /build
3032
31- RUN cmake -DTILEMAKER_BUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=g++ ..
32- RUN cmake --build .
33+ FROM src as test
34+ RUN cmake ..
35+ RUN cmake --build . --target tilemaker_test
36+ RUN cd test && ctest
37+
38+ FROM src as static
39+ RUN cmake -DTILEMAKER_BUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release ..
40+ RUN cmake --build . --target tilemaker
3341RUN strip tilemaker
3442
3543FROM debian:bullseye-slim
3644WORKDIR /
37- COPY --from=src /build/tilemaker .
45+ COPY --from=static /build/tilemaker .
3846COPY resources /resources
3947COPY process.lua .
4048COPY config.json .
Original file line number Diff line number Diff line change 1+ cmake_minimum_required (VERSION 3.0)
2+
3+ project (tilemaker_test)
4+
5+ set (CMAKE_CXX_STANDARD 14)
6+
7+ # Project settings
8+ set (CMAKE_RUNTIME_OUTPUT_DIRECTORY "." )
9+
10+ # Dependencies
11+ find_package (Boost COMPONENTS filesystem system unit_test_framework REQUIRED)
12+
13+ # Assign the include directories
14+ include_directories (${Boost_INCLUDE_DIRS} )
15+ include_directories (${UNIT_TESTS_INCLUDES} )
16+
17+ # Build unit tests
18+ add_executable (tilemaker_test test_helpers.cpp)
19+ target_link_libraries (tilemaker_test ${Boost_LIBRARIES} libtilemaker)
20+
21+ enable_testing ()
22+ add_test (tilemaker_test tilemaker_test)
Original file line number Diff line number Diff line change 1+ #define BOOST_TEST_DYN_LINK
2+ #define BOOST_TEST_MAIN
3+ #include < boost/test/unit_test.hpp>
4+
5+ #include " ../include/helpers.h"
6+
7+ BOOST_AUTO_TEST_SUITE (HelpersSuite)
8+
9+ BOOST_AUTO_TEST_CASE(CompressDecompress) {
10+ std::string original = " hello world" ;
11+ std::string compressed = compress_string (original, 9 );
12+ BOOST_REQUIRE_EQUAL (decompress_string (compressed, false ), original);
13+ }
14+
15+ BOOST_AUTO_TEST_SUITE_END ()
You can’t perform that action at this time.
0 commit comments