Skip to content

Commit e9b72b8

Browse files
committed
Merge branch 'release/0.1.4'
2 parents c5a5b21 + a2f08b8 commit e9b72b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+14012
-3025
lines changed

.appveyor.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,11 @@ install:
4141
# Install TBB
4242
- conda install -c conda-forge tbb -y
4343
# Install Boost
44-
- conda install -c menpo boost-cpp -y
44+
- conda install -c conda-forge boost -y
4545
# Install MPFR
4646
- conda install -c conda-forge mpfr -y
4747
# Install CGAL
48-
- conda install -c vincentrouvreau cgal_header_only -y
48+
- conda install -c conda-forge cgal -y
4949
# Install curlcpp
5050
# - git clone https://github.com/curl/curl
5151
# - cd curl
@@ -54,15 +54,15 @@ install:
5454
# - cmake --build .
5555
- nuget install rmt_curl -Version 7.51.0
5656
# Install gtest
57-
- conda install -c conda-forge gtest -y
57+
# - conda install -c conda-forge gtest -y
5858

5959
before_build:
6060
- cd C:\projects\CDT-plusplus
6161

6262
build_script:
6363
- mkdir build
6464
- cd build
65-
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DGMOCK_TESTS:BOOL=OFF ..
65+
- cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DTESTS:BOOL=OFF ..
6666
# - cmake --build .
6767

6868
#on_success:

.travis.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
language: cpp
22
sudo: required
33
dist: trusty
4-
osx_image: xcode9.1
4+
osx_image: xcode9.2
5+
#group: deprecated-2017Q4
56

67
addons:
78
coverity_scan:
@@ -33,15 +34,14 @@ env:
3334
- secure: "cjzdlbVhmLO0B0kzMcl5xAXEXIDRbMYFbaa+dEJTa+sG1VbzdtiXRsleZt8idZs2E0DKFN8Fti4+zrLdlqsx2+gU1fKn2TrfHCvRWNjxLFLCJ0fvkXdmEXVetnKyu27XrsXYJfaNbwUT05hpVvDT60GPt5g64XeJD9RQgX/UEug="
3435
- BOOST_VERSION=1.64.0
3536
matrix:
36-
- GMOCK=true
37-
- GMOCK=false
37+
- TESTS=true
38+
- TESTS=false
3839

3940
cache:
4041
apt:
4142
ccache:
4243
directories:
4344
- ${TRAVIS_BUILD_DIR}/boost-${BOOST_VERSION}
44-
- ${TRAVIS_BUILD_DIR}/googletest
4545

4646
os:
4747
- linux
@@ -56,14 +56,14 @@ matrix:
5656
include:
5757
- os: linux
5858
compiler: gcc
59-
env: GMOCK=false VALGRIND=true
59+
env: TESTS=false VALGRIND=true
6060
allow_failures:
6161
- os: linux
6262
compiler: clang
63-
env: GMOCK=true
63+
env: TESTS=true
6464
- os: linux
6565
compiler: clang
66-
env: GMOCK=false
66+
env: TESTS=false
6767

6868
before_install:
6969
# Workaround for https://github.com/travis-ci/travis-ci/issues/6307
@@ -83,13 +83,12 @@ install:
8383
brew install gcc
8484
brew link --overwrite gcc
8585
brew install ninja
86-
brew outdated boost || brew upgrade boost --without-single --c++11
8786
brew install eigen
8887
brew install tbb --c++11
8988
fi
9089
- |
9190
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
92-
CMAKE_URL="https://cmake.org/files/v3.9/cmake-3.9.3-Linux-x86_64.tar.gz"
91+
CMAKE_URL="https://cmake.org/files/v3.10/cmake-3.10.1-Linux-x86_64.tar.gz"
9392
mkdir cmake && travis_retry wget --no-check-certificate --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
9493
export PATH=${TRAVIS_BUILD_DIR}/cmake/bin:${PATH}
9594
if [[ "${BOOST_VERSION}" != "" ]]; then
@@ -123,7 +122,7 @@ install:
123122
- echo $CMAKE_OPTIONS
124123
- cmake -DCMAKE_BUILD_TYPE=Release -DBoost_USE_STATIC_LIBS=ON -DWITH_Eigen3=ON -DBOOST_ROOT=${BOOST_DIR} -G Ninja .
125124
- cmake --build .
126-
- sudo cmake --build . --target install &> install.log
125+
- sudo env "PATH=$PATH" cmake --build . --target install &> install.log
127126
- cd ..
128127

129128
# - ninja
@@ -135,27 +134,29 @@ script:
135134
if [[ "${COVERITY_SCAN_BRANCH}" != 1 ]]; then
136135
mkdir build && cd build
137136
CMAKE_OPTIONS="-DBOOST_ROOT=${BOOST_DIR} -DBUILD_SHARED_LIBS=ON"
138-
if [[ ${GMOCK} == "true" ]]; then
139-
CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release -DGMOCK_TESTS:BOOL=ON"
137+
if [[ ${TESTS} == "true" ]]; then
138+
CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release -DTESTS:BOOL=ON"
140139
else
141-
CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release -DGMOCK_TESTS:BOOL=OFF"
140+
CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Release -DTESTS:BOOL=OFF"
142141
fi
143-
if [[ ${VALGRIND} == "true" ]]; then CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-O0 -DGMOCK_TESTS:BOOL=OFF"; fi
142+
if [[ ${VALGRIND} == "true" ]]; then CMAKE_OPTIONS+=" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CXX_FLAGS=-O0 -DTESTS:BOOL=OFF"; fi
144143
echo $CMAKE_OPTIONS
145144
cmake $CMAKE_OPTIONS -G Ninja ..
146145
cmake --build .
147146
fi
148147
149148
after_success:
150149
- cd build
151-
# GMock with random test order
152-
- if [[ ${GMOCK} == "true" ]]; then ./unittests --gtest_shuffle; fi
150+
# Catch with random test order
151+
- if [[ ${TESTS} == "true" ]]; then ./tests/CDT_test; fi
153152
- if [[ ${VALGRIND} == "true" ]]; then valgrind --leak-check=full --show-leak-kinds=all ./cdt --s -n640 -t4 -a0.6 -k1.1 -l0.1 -p10 -c1; fi
154153
# CTest
155154
- cmake --build . --target test
156155

157156
notifications:
158157
webhooks:
159-
urls: https://webhooks.gitter.im/e/c70e4d2749931f601747
158+
urls:
159+
- https://webhooks.gitter.im/e/c70e4d2749931f601747
160+
- https://www.travisbuddy.com
160161
on_success: change
161162
on_failure: always

CMakeLists.txt

Lines changed: 22 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ add_compile_options(-Wall -Wno-comment)
3434

3535
###############################################################################
3636
#Turn on / off Google Mock Tests
37-
option(GMOCK_TESTS ON)
37+
#option(GMOCK_TESTS OFF)
38+
option(TESTS ON)
3839
#Turn on / off TBB
3940
set(TBB_ON TRUE)
4041
#Set mimumum Boost
@@ -47,15 +48,22 @@ set(EXECUTABLE_NAME "CDT")
4748
find_package(CGAL QUIET COMPONENTS Core )
4849

4950
#Need working version of boost::optional
50-
set(Boost_DEBUG FALSE)
51+
#set(Boost_DEBUG FALSE)
52+
#find_package(Boost ${BOOST_MIN_VERSION} REQUIRED)
53+
##Boost debugging
54+
#message(STATUS "Found Boost include: ${Boost_INCLUDE_DIR}")
55+
#message(STATUS "Boost libraries to link: ${Boost_LIBRARIES}")
56+
#message(STATUS "Found Boost libraries: ${Boost_LIBRARY_DIRS}")
57+
#if(NOT Boost_FOUND)
58+
# message(FATAL_ERROR "Boost >= 1.63.0 required.\n")
59+
#endif()
60+
5161
find_package(Boost ${BOOST_MIN_VERSION} REQUIRED)
52-
#Boost debugging
53-
message(STATUS "Found Boost include: ${Boost_INCLUDE_DIR}")
54-
message(STATUS "Boost libraries to link: ${Boost_LIBRARIES}")
55-
message(STATUS "Found Boost libraries: ${Boost_LIBRARY_DIRS}")
56-
if(NOT Boost_FOUND)
57-
message(FATAL_ERROR "Boost >= 1.63.0 required.\n")
58-
endif()
62+
if (Boost_FOUND)
63+
include_directories(${Boost_INCLUDE_DIR})
64+
else()
65+
message(FATAL_ERROR "Boost >= ${BOOST_MIN_VERSION} required.\n")
66+
endif ()
5967

6068
if(CGAL_FOUND)
6169
#Don't let CGAL override flags
@@ -89,48 +97,18 @@ if(CGAL_FOUND)
8997
target_link_libraries(cdt-opt ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} curl)
9098

9199
else()
92-
message(STATUS "NOTICE: This program requires the Eigen3 library,
100+
message(FATAL_ERROR "NOTICE: This program requires the Eigen3 library,
93101
and will not be compiled.")
94102
endif()
95103
else()
96104

97-
message(STATUS "This program requires the CGAL library,
105+
message(FATAL_ERROR "This program requires the CGAL library,
98106
and will not be compiled.")
99107
endif()
100108

101-
#GMock Tests executable
102-
###############################################################################
103-
if(GMOCK_TESTS)
104-
set(UT_EXECUTABLE_NAME "unittests")
105-
106-
# Download and unpack googletest at configure time
107-
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
108-
execute_process(COMMAND "${CMAKE_COMMAND}" -G "${CMAKE_GENERATOR}" .
109-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download")
110-
execute_process(COMMAND "${CMAKE_COMMAND}" --build .
111-
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/googletest-download")
112-
113-
# Prevent GoogleTest from overriding compiler/linker options in VisualStudio
114-
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
115-
116-
# Add googletest directly to our build. This adds the following targets:
117-
# gtest, gtest_main, gmock, and gmock_main
118-
add_subdirectory("${CMAKE_BINARY_DIR}/googletest-source"
119-
"${CMAKE_BINARY_DIR}/googletest-build")
120-
121-
#Test files
122-
file(GLOB TEST_FILES "unittests/*.cpp")
123-
add_executable("${UT_EXECUTABLE_NAME}" ${TEST_FILES} ${SRC_FILES} src/date/src/tz.cpp)
124-
125-
#Set link libraries(order matters)
126-
target_link_libraries("${UT_EXECUTABLE_NAME}"
127-
${TBB_LIBRARIES} curl gmock gtest pthread)
128-
129-
#Include root directory
130-
include_directories(BEFORE ".")
131-
include_directories(BEFORE "src/")
132-
endif()
133-
109+
# Catch
110+
enable_testing()
111+
add_subdirectory(tests)
134112
#CTest basic testing
135113
include(CTest)
136114

@@ -172,13 +150,3 @@ add_test(CDT-S3Runs cdt --s -n640 -t4 -a0.6 -k1.1 -l0.1 -p10 -c1)
172150
set_tests_properties(CDT-S3Runs
173151
PROPERTIES
174152
PASS_REGULAR_EXPRESSION "Writing to file S3")
175-
#cdt - gv
176-
#This program takes a file to load into GemoView for visualization
177-
#add_test(CDT - GeomView cdt - gv)
178-
#set_tests_properties(CDT - GeomView
179-
#PROPERTIES
180-
#PASS_REGULAR_EXPRESSION "Usage:./cdt-gv --file FILE")
181-
182-
#This takes a long time now so cancel
183-
#cdt - opt
184-
#add_test(CDT - Optimizer cdt - opt)

CMakeLists.txt.in

Lines changed: 0 additions & 15 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,42 @@ First, thank you!
44

55
Writing esoteric scientific software can be it's own reward, but it's not for the faint of heart.
66

7-
If you want a general overview as to why this software package exists, please look at my talk [Causal Dynamical Triangulations with CGAL][slides], or the [Wiki][2].
7+
If you want a general overview as to why this software package exists, please look at my talk [Causal Dynamical Triangulations with CGAL][slides], or the [Wiki].
88

99
Second, here are some simple guidelines that will make it easier on me to process and accept your contributions.
1010

1111
1. Fork the repository.
12-
2. Install GMock/GTest. See [.travis.yml][1] for details.
13-
3. Write a unit test for your proposed contribution. Unit tests go in the `unittests` directory and are named \{YourContribution\}Test.cpp, so that they can be automatically built. All proposed features of your contribution should have a corresponding test in \{YourContribution\}Test.cpp. Consult the [GMock][3] and [GTest][4] documentation if you are unsure, or consult existing tests for examples. Prefer [predicate assertions][5] because their output is much easier to understand and useful for debugging.
14-
4. I highly recommend writing your tests first, before your contribution, as this helps to think about how the rest of the program will use your functions and/or classes. This [Test-Driven Development][6] has saved me quite a lot from various mistakes.
12+
2. Familiarize yourself with [Catch] and in particular, the [Gherkin] syntax.
13+
3. Write a unit test for your proposed contribution. Unit tests go in the `tests` directory and are named \{YourContribution\}Test.cpp, so that they can be automatically built. All proposed features of your contribution should have a corresponding test in \{YourContribution\}Test.cpp. Consult the [Catch Test cases and sections] if you are unsure, or consult existing tests for examples.
14+
4. I highly recommend writing your tests first, before your contribution, as this helps to think about how the rest of the program will use your functions and/or classes. This [Test-Driven Development] has saved me quite a lot from various mistakes.
1515
5. Project source code goes into the `src` directory, generally as header files named \{YourContribution\}.h. This makes inclusion into tests and the main program easy and modular.
16-
6. Don't forget documentation! It's helpful if you state explicitly what your functions and/or classes do. I use [Doxygen][7] to automatically build documentation, so using `/// @brief` and `/// @param[]` is helpful and easy. Consult existing code for examples.
17-
7. Commit your changes with a clear, [well-written commit message][8]. _I am guilty of not always writing the clearest commit messages in this project, and will do better. For the longest time, however, no one but me actually read them. When I contribute to other projects, I definitely try to have useful, clear commit messages and you should, too._
16+
6. Don't forget documentation! It's helpful if you state explicitly what your functions and/or classes do. I use [Doxygen] to automatically build documentation, so using `/// @brief` and `/// @param[]` is helpful and easy. Consult existing code for examples.
17+
7. Commit your changes with a clear, [well-written commit message]. _I am guilty of not always writing the clearest commit messages in this project, and will do better. For the longest time, however, no one but me actually read them. When I contribute to other projects, I definitely try to have useful, clear commit messages and you should, too._
1818
8. Run `clang-format` using `.clang-format` included with the project.
19-
9. Open a pull request against the main repository. [Travis-CI][9] will test it against combinations of Linux (Ubuntu 14.04), MacOS, clang, and gcc, so ensure that your code compiles on both platforms with both compilers.
20-
10. Look at the results from the [Valgrind][14] tests on [Travis-CI][9], which will tell you about any memory leaks or other subtle issues.
19+
9. Open a pull request against the main repository. [Travis-CI] will test it against combinations of Linux (Ubuntu 14.04), MacOS, clang, and gcc, so ensure that your code compiles on both platforms with both compilers.
20+
10. Look at the results from the [Valgrind] tests on [Travis-CI], which will tell you about any memory leaks or other subtle issues.
2121
11. I will get to your change as soon as I can. You will receive proper credit for your contributions both in the code and any resulting scientific papers using the output of `git log --format='%aN | sort -u`.
2222

2323
### Style Guide ###
2424

25-
This project generally follows [Stroustrup formatting with Allman brackets][10], enforced by [`clang-format`][13] using the [.clang-format][11] configuration. We also test against the [C++ Core Guidelines][cpp-core] using [clang-tidy][clang-tidy-sh] with an appropriate configuration. Clang-tidy changes the code when run, so comparing results and running unit tests is recommended before you commit, especially since some of clang-tidy's fixes break the codebase (the script runs just the tests that don't).
25+
This project generally follows [Stroustrup formatting with Allman brackets][1], enforced by [`clang-format`][2] using the [.clang-format][3] configuration. We also test against the [C++ Core Guidelines][cpp-core] using [clang-tidy][clang-tidy-sh] with an appropriate configuration. Clang-tidy changes the code when run, so comparing results and running unit tests is recommended before you commit, especially since some of clang-tidy's fixes break the codebase (the script runs just the tests that don't).
2626

2727
Most editors/IDEs have plugins for `clang-format` and `clang-tidy`.
2828

29-
[1]: https://github.com/acgetchell/CDT-plusplus/blob/master/.travis.yml
30-
[2]: https://github.com/acgetchell/CDT-plusplus/wiki
31-
[3]: https://github.com/google/googletest/blob/master/googlemock/README.md
32-
[4]: https://github.com/google/googletest/blob/master/googletest/docs/Primer.md
33-
[5]: https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#predicate-assertions-for-better-error-messages
34-
[6]: http://alexott.net/en/cpp/CppTestingIntro.html
35-
[7]: http://doxygen.org
36-
[8]: http://chris.beams.io/posts/git-commit/
37-
[9]: https://travis-ci.org/acgetchell/CDT-plusplus
38-
[10]: https://isocpp.org/wiki/faq/coding-standards
39-
[11]: https://github.com/acgetchell/CDT-plusplus/blob/master/.clang-format
29+
[Wiki]: https://github.com/acgetchell/CDT-plusplus/wiki
30+
[Test-Driven Development]: http://alexott.net/en/cpp/CppTestingIntro.html
31+
[Doxygen]: http://doxygen.org
32+
[well-written commit message]: http://chris.beams.io/posts/git-commit/
33+
[Travis-CI]: https://travis-ci.org/acgetchell/CDT-plusplus
34+
[1]: https://isocpp.org/wiki/faq/coding-standards
35+
[2]: http://llvm.org/releases/4.0.0/tools/clang/docs/ClangFormatStyleOptions.html
36+
[3]: https://github.com/acgetchell/CDT-plusplus/blob/master/.clang-format
4037
[slides]: http://slides.com/acgetchell/causal-dynamical-triangulations-3
41-
[13]: http://llvm.org/releases/4.0.0/tools/clang/docs/ClangFormatStyleOptions.html
42-
[14]: http://valgrind.org/docs/manual/quick-start.html#quick-start.mcrun
38+
[Valgrind]: http://valgrind.org/docs/manual/quick-start.html#quick-start.mcrun
4339
[cpp-core]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md
4440
[clang-tidy-sh]: https://github.com/acgetchell/CDT-plusplus/blob/master/clang-tidy.sh
41+
42+
[Catch]: https://github.com/catchorg/Catch2/blob/master/docs/Readme.md
43+
[Gherkin]: https://www.tutorialspoint.com/behavior_driven_development/behavior_driven_development_gherkin.htm
44+
45+
[Catch Test cases and sections]: https://github.com/catchorg/Catch2/blob/master/docs/test-cases-and-sections.md

0 commit comments

Comments
 (0)