├── .gitignore ├── .ignore ├── .travis.yml ├── 3rdparty ├── CMakeLists.txt └── linenoise-ng │ ├── CMakeLists.txt │ ├── LICENSE │ ├── README.md │ ├── include │ └── linenoise-ng │ │ ├── ConvertUTF.h │ │ └── linenoise.h │ └── source │ ├── ConvertUTF.cpp │ ├── linenoise.cpp │ └── wcwidth.cpp ├── AUTHORS ├── CMakeLists.txt ├── Dockerfile ├── LICENSE ├── README.md ├── appveyor.yml ├── cmake ├── CheckTemplate.cmake ├── ClangTidy.cmake ├── CompileOptions.cmake ├── ComponentInstall.cmake ├── Cppcheck.cmake ├── Custom.cmake ├── Findclang_tidy.cmake ├── Findcppcheck.cmake ├── GenerateTemplateExportHeader.cmake ├── GetGitRevisionDescription.cmake ├── GetGitRevisionDescription.cmake.in ├── HealthCheck.cmake └── RuntimeDependencies.cmake ├── configure ├── cppassist-config.cmake ├── cppassist-logo.png ├── cppassist-logo.svg ├── deploy ├── CMakeLists.txt ├── packages │ └── pack-cppassist.cmake └── ubuntu-ppa │ ├── debian │ ├── changelog │ ├── compat │ ├── control │ ├── copyright │ ├── rules │ └── source │ │ └── format │ └── recipe.txt ├── docs ├── CMakeLists.txt ├── api-docs │ ├── CMakeLists.txt │ └── doxyfile.in └── manual │ ├── CMakeLists.txt │ └── cmake-init.tex └── source ├── CMakeLists.txt ├── codegeneration ├── template_api.h.in └── template_msvc_api.h.in ├── cppassist ├── CMakeLists.txt ├── include │ └── cppassist │ │ ├── cmdline │ │ ├── ArgumentParser.h │ │ ├── ArgumentParser.inl │ │ ├── CommandLineAction.h │ │ ├── CommandLineCommand.h │ │ ├── CommandLineOption.h │ │ ├── CommandLineParameter.h │ │ ├── CommandLineProgram.h │ │ └── CommandLineSwitch.h │ │ ├── error │ │ ├── Error.h │ │ ├── Error.inl │ │ ├── Result.h │ │ └── Result.inl │ │ ├── flags │ │ ├── Flags.h │ │ └── Flags.inl │ │ ├── fs │ │ ├── DescriptiveRawFile.h │ │ ├── RawFile.h │ │ └── readfile.h │ │ ├── logging │ │ ├── AbstractLogHandler.h │ │ ├── ConsoleLogHandler.h │ │ ├── FileLogHandler.h │ │ ├── LogMessage.h │ │ ├── LogMessageBuilder.h │ │ ├── LogMessageBuilder.inl │ │ └── logging.h │ │ ├── memory │ │ ├── make_unique.h │ │ ├── make_unique.inl │ │ ├── offsetof.h │ │ └── offsetof.inl │ │ ├── simd │ │ ├── algorithm.h │ │ ├── algorithm.inl │ │ ├── allocator.h │ │ ├── allocator.inl │ │ ├── simd.h │ │ ├── value.h │ │ ├── value1.h │ │ ├── value1.inl │ │ ├── value16f.h │ │ ├── value16f.inl │ │ ├── value4f.h │ │ ├── value4f.inl │ │ ├── value8f.h │ │ ├── value8f.inl │ │ ├── vector.h │ │ └── vector.inl │ │ ├── string │ │ ├── conversion.h │ │ ├── conversion.inl │ │ ├── manipulation.h │ │ ├── manipulation.inl │ │ ├── processing.h │ │ └── regex.h │ │ ├── threading │ │ ├── parallelfor.h │ │ └── parallelfor.inl │ │ ├── tokenizer │ │ └── Tokenizer.h │ │ └── typelist │ │ ├── TypeList.h │ │ └── TypeList.inl └── source │ ├── cmdline │ ├── ArgumentParser.cpp │ ├── CommandLineAction.cpp │ ├── CommandLineCommand.cpp │ ├── CommandLineOption.cpp │ ├── CommandLineParameter.cpp │ ├── CommandLineProgram.cpp │ └── CommandLineSwitch.cpp │ ├── error │ └── Error.cpp │ ├── fs │ ├── DescriptiveRawFile.cpp │ ├── RawFile.cpp │ └── readfile.cpp │ ├── logging │ ├── AbstractLogHandler.cpp │ ├── ConsoleLogHandler.cpp │ ├── FileLogHandler.cpp │ ├── LogMessage.cpp │ ├── LogMessageBuilder.cpp │ └── logging.cpp │ ├── string │ ├── conversion.cpp │ ├── manipulation.cpp │ ├── processing.cpp │ └── regex.cpp │ ├── threading │ └── parallelfor.cpp │ └── tokenizer │ └── Tokenizer.cpp ├── examples ├── CMakeLists.txt ├── cmdline │ ├── ActionCopy.cpp │ ├── ActionCopy.h │ ├── ActionCount.cpp │ ├── ActionCount.h │ ├── ActionHelp.cpp │ ├── ActionHelp.h │ ├── CMakeLists.txt │ ├── Program.cpp │ ├── Program.h │ └── main.cpp ├── cmdline2 │ ├── CMakeLists.txt │ └── main.cpp ├── logging │ ├── CMakeLists.txt │ └── main.cpp └── simd │ ├── CMakeLists.txt │ └── main.cpp ├── tests ├── CMakeLists.txt ├── cppassist-test │ ├── CMakeLists.txt │ ├── conversion_test.cpp │ ├── error_test.cpp │ ├── flags_test.cpp │ ├── main.cpp │ ├── make_unique_test.cpp │ ├── manipulation_test.cpp │ ├── parallel_for_test.cpp │ ├── processing_test.cpp │ └── typelist_test.cpp └── googletest │ ├── .gitignore │ ├── .travis.yml │ ├── BUILD.bazel │ ├── CMakeLists.txt │ ├── CONTRIBUTING.md │ ├── LICENSE │ ├── README.md │ ├── WORKSPACE │ ├── appveyor.yml │ ├── ci │ ├── env-linux.sh │ ├── env-osx.sh │ ├── get-nprocessors.sh │ ├── install-linux.sh │ ├── install-osx.sh │ ├── install-platformio.sh │ ├── log-config.sh │ └── travis.sh │ ├── googlemock │ ├── CMakeLists.txt │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── README.md │ ├── cmake │ │ ├── gmock.pc.in │ │ └── gmock_main.pc.in │ ├── docs │ │ ├── cheat_sheet.md │ │ ├── cook_book.md │ │ ├── for_dummies.md │ │ └── gmock_faq.md │ ├── include │ │ └── gmock │ │ │ ├── gmock-actions.h │ │ │ ├── gmock-cardinalities.h │ │ │ ├── gmock-function-mocker.h │ │ │ ├── gmock-generated-actions.h │ │ │ ├── gmock-generated-actions.h.pump │ │ │ ├── gmock-generated-function-mockers.h │ │ │ ├── gmock-generated-function-mockers.h.pump │ │ │ ├── gmock-generated-matchers.h │ │ │ ├── gmock-generated-matchers.h.pump │ │ │ ├── gmock-matchers.h │ │ │ ├── gmock-more-actions.h │ │ │ ├── gmock-more-matchers.h │ │ │ ├── gmock-nice-strict.h │ │ │ ├── gmock-spec-builders.h │ │ │ ├── gmock.h │ │ │ └── internal │ │ │ ├── custom │ │ │ ├── README.md │ │ │ ├── gmock-generated-actions.h │ │ │ ├── gmock-generated-actions.h.pump │ │ │ ├── gmock-matchers.h │ │ │ └── gmock-port.h │ │ │ ├── gmock-internal-utils.h │ │ │ ├── gmock-port.h │ │ │ └── gmock-pp.h │ ├── scripts │ │ ├── fuse_gmock_files.py │ │ ├── generator │ │ │ ├── LICENSE │ │ │ ├── README │ │ │ ├── README.cppclean │ │ │ ├── cpp │ │ │ │ ├── __init__.py │ │ │ │ ├── ast.py │ │ │ │ ├── gmock_class.py │ │ │ │ ├── gmock_class_test.py │ │ │ │ ├── keywords.py │ │ │ │ ├── tokenize.py │ │ │ │ └── utils.py │ │ │ └── gmock_gen.py │ │ ├── gmock-config.in │ │ ├── gmock_doctor.py │ │ ├── upload.py │ │ └── upload_gmock.py │ ├── src │ │ ├── gmock-all.cc │ │ ├── gmock-cardinalities.cc │ │ ├── gmock-internal-utils.cc │ │ ├── gmock-matchers.cc │ │ ├── gmock-spec-builders.cc │ │ ├── gmock.cc │ │ └── gmock_main.cc │ └── test │ │ ├── BUILD.bazel │ │ ├── gmock-actions_test.cc │ │ ├── gmock-cardinalities_test.cc │ │ ├── gmock-function-mocker_nc.cc │ │ ├── gmock-function-mocker_nc_test.py │ │ ├── gmock-function-mocker_test.cc │ │ ├── gmock-generated-actions_test.cc │ │ ├── gmock-generated-function-mockers_test.cc │ │ ├── gmock-generated-matchers_test.cc │ │ ├── gmock-internal-utils_test.cc │ │ ├── gmock-matchers_test.cc │ │ ├── gmock-more-actions_test.cc │ │ ├── gmock-nice-strict_test.cc │ │ ├── gmock-port_test.cc │ │ ├── gmock-pp-string_test.cc │ │ ├── gmock-pp_test.cc │ │ ├── gmock-spec-builders_test.cc │ │ ├── gmock_all_test.cc │ │ ├── gmock_ex_test.cc │ │ ├── gmock_leak_test.py │ │ ├── gmock_leak_test_.cc │ │ ├── gmock_link2_test.cc │ │ ├── gmock_link_test.cc │ │ ├── gmock_link_test.h │ │ ├── gmock_output_test.py │ │ ├── gmock_output_test_.cc │ │ ├── gmock_output_test_golden.txt │ │ ├── gmock_stress_test.cc │ │ ├── gmock_test.cc │ │ └── gmock_test_utils.py │ ├── googletest │ ├── CMakeLists.txt │ ├── CONTRIBUTORS │ ├── LICENSE │ ├── README.md │ ├── cmake │ │ ├── Config.cmake.in │ │ ├── gtest.pc.in │ │ ├── gtest_main.pc.in │ │ ├── internal_utils.cmake │ │ └── libgtest.la.in │ ├── docs │ │ ├── advanced.md │ │ ├── faq.md │ │ ├── pkgconfig.md │ │ ├── primer.md │ │ ├── pump_manual.md │ │ └── samples.md │ ├── include │ │ └── gtest │ │ │ ├── gtest-death-test.h │ │ │ ├── gtest-matchers.h │ │ │ ├── gtest-message.h │ │ │ ├── gtest-param-test.h │ │ │ ├── gtest-printers.h │ │ │ ├── gtest-spi.h │ │ │ ├── gtest-test-part.h │ │ │ ├── gtest-typed-test.h │ │ │ ├── gtest.h │ │ │ ├── gtest_pred_impl.h │ │ │ ├── gtest_prod.h │ │ │ └── internal │ │ │ ├── custom │ │ │ ├── README.md │ │ │ ├── gtest-port.h │ │ │ ├── gtest-printers.h │ │ │ └── gtest.h │ │ │ ├── gtest-death-test-internal.h │ │ │ ├── gtest-filepath.h │ │ │ ├── gtest-internal.h │ │ │ ├── gtest-param-util.h │ │ │ ├── gtest-port-arch.h │ │ │ ├── gtest-port.h │ │ │ ├── gtest-string.h │ │ │ ├── gtest-type-util.h │ │ │ └── gtest-type-util.h.pump │ ├── samples │ │ ├── prime_tables.h │ │ ├── sample1.cc │ │ ├── sample1.h │ │ ├── sample10_unittest.cc │ │ ├── sample1_unittest.cc │ │ ├── sample2.cc │ │ ├── sample2.h │ │ ├── sample2_unittest.cc │ │ ├── sample3-inl.h │ │ ├── sample3_unittest.cc │ │ ├── sample4.cc │ │ ├── sample4.h │ │ ├── sample4_unittest.cc │ │ ├── sample5_unittest.cc │ │ ├── sample6_unittest.cc │ │ ├── sample7_unittest.cc │ │ ├── sample8_unittest.cc │ │ └── sample9_unittest.cc │ ├── scripts │ │ ├── common.py │ │ ├── fuse_gtest_files.py │ │ ├── gen_gtest_pred_impl.py │ │ ├── gtest-config.in │ │ ├── pump.py │ │ ├── release_docs.py │ │ ├── test │ │ │ └── Makefile │ │ ├── upload.py │ │ └── upload_gtest.py │ ├── src │ │ ├── gtest-all.cc │ │ ├── gtest-death-test.cc │ │ ├── gtest-filepath.cc │ │ ├── gtest-internal-inl.h │ │ ├── gtest-matchers.cc │ │ ├── gtest-port.cc │ │ ├── gtest-printers.cc │ │ ├── gtest-test-part.cc │ │ ├── gtest-typed-test.cc │ │ ├── gtest.cc │ │ └── gtest_main.cc │ └── test │ │ ├── BUILD.bazel │ │ ├── googletest-break-on-failure-unittest.py │ │ ├── googletest-break-on-failure-unittest_.cc │ │ ├── googletest-catch-exceptions-test.py │ │ ├── googletest-catch-exceptions-test_.cc │ │ ├── googletest-color-test.py │ │ ├── googletest-color-test_.cc │ │ ├── googletest-death-test-test.cc │ │ ├── googletest-death-test_ex_test.cc │ │ ├── googletest-env-var-test.py │ │ ├── googletest-env-var-test_.cc │ │ ├── googletest-filepath-test.cc │ │ ├── googletest-filter-unittest.py │ │ ├── googletest-filter-unittest_.cc │ │ ├── googletest-json-outfiles-test.py │ │ ├── googletest-json-output-unittest.py │ │ ├── googletest-list-tests-unittest.py │ │ ├── googletest-list-tests-unittest_.cc │ │ ├── googletest-listener-test.cc │ │ ├── googletest-message-test.cc │ │ ├── googletest-options-test.cc │ │ ├── googletest-output-test-golden-lin.txt │ │ ├── googletest-output-test.py │ │ ├── googletest-output-test_.cc │ │ ├── googletest-param-test-invalid-name1-test.py │ │ ├── googletest-param-test-invalid-name1-test_.cc │ │ ├── googletest-param-test-invalid-name2-test.py │ │ ├── googletest-param-test-invalid-name2-test_.cc │ │ ├── googletest-param-test-test.cc │ │ ├── googletest-param-test-test.h │ │ ├── googletest-param-test2-test.cc │ │ ├── googletest-port-test.cc │ │ ├── googletest-printers-test.cc │ │ ├── googletest-shuffle-test.py │ │ ├── googletest-shuffle-test_.cc │ │ ├── googletest-test-part-test.cc │ │ ├── googletest-test2_test.cc │ │ ├── googletest-throw-on-failure-test.py │ │ ├── googletest-throw-on-failure-test_.cc │ │ ├── googletest-uninitialized-test.py │ │ ├── googletest-uninitialized-test_.cc │ │ ├── gtest-typed-test2_test.cc │ │ ├── gtest-typed-test_test.cc │ │ ├── gtest-typed-test_test.h │ │ ├── gtest-unittest-api_test.cc │ │ ├── gtest_all_test.cc │ │ ├── gtest_assert_by_exception_test.cc │ │ ├── gtest_environment_test.cc │ │ ├── gtest_help_test.py │ │ ├── gtest_help_test_.cc │ │ ├── gtest_json_test_utils.py │ │ ├── gtest_list_output_unittest.py │ │ ├── gtest_list_output_unittest_.cc │ │ ├── gtest_main_unittest.cc │ │ ├── gtest_no_test_unittest.cc │ │ ├── gtest_pred_impl_unittest.cc │ │ ├── gtest_premature_exit_test.cc │ │ ├── gtest_prod_test.cc │ │ ├── gtest_repeat_test.cc │ │ ├── gtest_skip_environment_check_output_test.py │ │ ├── gtest_skip_in_environment_setup_test.cc │ │ ├── gtest_skip_test.cc │ │ ├── gtest_sole_header_test.cc │ │ ├── gtest_stress_test.cc │ │ ├── gtest_test_macro_stack_footprint_test.cc │ │ ├── gtest_test_utils.py │ │ ├── gtest_testbridge_test.py │ │ ├── gtest_testbridge_test_.cc │ │ ├── gtest_throw_on_failure_ex_test.cc │ │ ├── gtest_unittest.cc │ │ ├── gtest_xml_outfile1_test_.cc │ │ ├── gtest_xml_outfile2_test_.cc │ │ ├── gtest_xml_outfiles_test.py │ │ ├── gtest_xml_output_unittest.py │ │ ├── gtest_xml_output_unittest_.cc │ │ ├── gtest_xml_test_utils.py │ │ ├── production.cc │ │ └── production.h │ ├── library.json │ └── platformio.ini └── version.h.in /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | 6 | # Compiled Dynamic libraries 7 | *.so 8 | *.dylib 9 | 10 | # Compiled Static libraries 11 | *.lai 12 | *.la 13 | *.a 14 | 15 | # Build dir 16 | *-build* 17 | build* 18 | debug_build 19 | release_build 20 | /bin 21 | /lib 22 | /install 23 | 24 | # Qt cache 25 | CMakeLists.txt.user 26 | CMakeLists.txt.user.* 27 | 28 | # IDE project files 29 | *.sublime-project 30 | *.sublime-workspace 31 | .vscode 32 | 33 | # Local config windows 34 | _configure.bat 35 | _open-project.bat 36 | _start-cmake-gui.bat 37 | _start-cmd.bat 38 | 39 | # Local config unix 40 | .localconfig 41 | -------------------------------------------------------------------------------- /.ignore: -------------------------------------------------------------------------------- 1 | 3rdparty/* 2 | source/tests/googletest/* 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: c++ 2 | 3 | env: 4 | global: 5 | - CMAKE_OPTIONS="-DOPTION_BUILD_EXAMPLES=On" 6 | 7 | matrix: 8 | include: 9 | 10 | - os: osx 11 | osx_image: xcode9.1 12 | env: CMAKE_CONFIGURATION=release BUILD_DIR=build 13 | 14 | - os: osx 15 | osx_image: xcode9.1 16 | env: CMAKE_CONFIGURATION=debug BUILD_DIR=build-debug 17 | 18 | - os: linux 19 | compiler: clang 20 | env: CMAKE_CONFIGURATION=release BUILD_DIR=build 21 | addons: 22 | apt: 23 | packages: 24 | - libboost-regex-dev 25 | - cppcheck 26 | - clang-tidy-3.8 27 | 28 | - os: linux 29 | compiler: clang 30 | env: CMAKE_CONFIGURATION=debug BUILD_DIR=build-debug 31 | addons: 32 | apt: 33 | packages: 34 | - libboost-regex-dev 35 | - cppcheck 36 | - clang-tidy-3.8 37 | 38 | - os: linux 39 | compiler: gcc 40 | env: 41 | - CMAKE_CONFIGURATION=release BUILD_DIR=build 42 | - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" 43 | addons: 44 | apt: 45 | sources: 46 | - ubuntu-toolchain-r-test 47 | packages: 48 | - cmake 49 | - g++-5 50 | - libboost-regex-dev 51 | - cppcheck 52 | - clang-tidy-3.8 53 | 54 | - os: linux 55 | compiler: gcc 56 | env: 57 | - CMAKE_CONFIGURATION=debug BUILD_DIR=build-debug 58 | - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" 59 | addons: 60 | apt: 61 | sources: 62 | - ubuntu-toolchain-r-test 63 | packages: 64 | - cmake 65 | - g++-5 66 | - libboost-regex-dev 67 | - cppcheck 68 | - clang-tidy-3.8 69 | 70 | before_install: 71 | - if [ $TRAVIS_OS_NAME == linux ]; then export CMAKE_OPTIONS="$CMAKE_OPTIONS -DOPTION_BUILD_WITH_STD_REGEX=Off"; fi 72 | - if [ $TRAVIS_OS_NAME == linux ]; then echo "CMAKE_OPTIONS = $CMAKE_OPTIONS"; fi 73 | 74 | before_script: 75 | - eval "${MATRIX_EVAL}" 76 | - chmod +x ./configure 77 | - ./configure 78 | - ./configure $CMAKE_CONFIGURATION 79 | 80 | script: 81 | - cmake --build $BUILD_DIR 82 | - cmake --build $BUILD_DIR --target test 83 | -------------------------------------------------------------------------------- /3rdparty/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # External libraries 3 | set(IDE_FOLDER "3rdparty") 4 | add_subdirectory(linenoise-ng) 5 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | 2 | Stefan Buschmann 3 | Max Jendruk 4 | Willy Scheibel 5 | Leander Neiß 6 | 7 | 8 | Thanks to all Contributors 9 | 10 | ClausSteuer 11 | Daniel Limberger 12 | j-o 13 | Karsten Tausche 14 | Roland Lux 15 | sebastiankaybelle 16 | SebSchmech 17 | simonkrogmann 18 | julkw -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ARG BASE=cginternals/cpp-base:latest 2 | ARG BASE_DEV=cginternals/cpp-base:dev 3 | ARG PROJECT_NAME=cppassist 4 | 5 | # BUILD 6 | 7 | FROM $BASE_DEV AS build 8 | 9 | ARG PROJECT_NAME 10 | ARG COMPILER_FLAGS="-j 4" 11 | 12 | ENV cppassist_DIR="$WORKSPACE/$PROJECT_NAME" 13 | 14 | WORKDIR $WORKSPACE/$PROJECT_NAME 15 | 16 | ADD cmake cmake 17 | ADD docs docs 18 | ADD deploy deploy 19 | ADD source source 20 | ADD 3rdparty 3rdparty 21 | ADD CMakeLists.txt CMakeLists.txt 22 | ADD configure configure 23 | ADD $PROJECT_NAME-config.cmake $PROJECT_NAME-config.cmake 24 | ADD $PROJECT_NAME-logo.png $PROJECT_NAME-logo.png 25 | ADD $PROJECT_NAME-logo.svg $PROJECT_NAME-logo.svg 26 | ADD LICENSE LICENSE 27 | ADD README.md README.md 28 | ADD AUTHORS AUTHORS 29 | 30 | RUN ./configure 31 | RUN CMAKE_OPTIONS="-DOPTION_BUILD_TESTS=Off" ./configure 32 | RUN cmake --build build -- $COMPILER_FLAGS 33 | 34 | # INSTALL 35 | 36 | FROM build as install 37 | 38 | ARG PROJECT_NAME 39 | 40 | WORKDIR $WORKSPACE/$PROJECT_NAME 41 | 42 | RUN CMAKE_OPTIONS="-DCMAKE_INSTALL_PREFIX=$WORKSPACE/$PROJECT_NAME-install" ./configure 43 | RUN cmake --build build --target install 44 | 45 | # DEPLOY 46 | 47 | FROM $BASE AS deploy 48 | 49 | ARG PROJECT_NAME 50 | 51 | ENV cppassist_DIR="$WORKSPACE/$PROJECT_NAME" 52 | 53 | COPY --from=install $WORKSPACE/$PROJECT_NAME-install $WORKSPACE/$PROJECT_NAME 54 | 55 | ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$WORKSPACE/$PROJECT_NAME/lib 56 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: '{build}' 2 | branches: 3 | only: 4 | - master 5 | clone_folder: c:\projects\cppassist 6 | image: 7 | - Visual Studio 2013 8 | - Visual Studio 2015 9 | - Visual Studio 2017 10 | configuration: 11 | - Release 12 | - Debug 13 | platform: 14 | - x64 15 | environment: 16 | matrix: 17 | - arch: Win64 18 | # - arch: #does not work, Release|x64 not a valid target 19 | matrix: 20 | fast_finish: true 21 | 22 | # skip unsupported combinations 23 | init: 24 | - set arch= 25 | - if "%arch%"=="Win64" ( set arch= Win64) 26 | - echo %arch% 27 | - echo %APPVEYOR_BUILD_WORKER_IMAGE% 28 | - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set generator="Visual Studio 15 2017%arch%" ) 29 | - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( set generator="Visual Studio 14 2015%arch%" ) 30 | - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" ( set generator="Visual Studio 12 2013%arch%" ) 31 | - echo %generator% 32 | 33 | before_build: 34 | - cmd: |- 35 | mkdir build 36 | cd build 37 | cmake --version 38 | cmake .. -G %generator% 39 | 40 | build: 41 | project: c:\projects\cppassist\build\cppassist.sln 42 | verbosity: minimal 43 | parallel: true 44 | only_commits: 45 | files: 46 | - CMakeLists.txt 47 | - appveyor.yml 48 | - source/ 49 | - cmake/ 50 | -------------------------------------------------------------------------------- /cmake/CheckTemplate.cmake: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Get cmake-init latest commit SHA on master 4 | # 5 | 6 | file(DOWNLOAD 7 | "https://api.github.com/repos/cginternals/cmake-init/commits/master" 8 | "${PROJECT_BINARY_DIR}/cmake-init.github.data" 9 | ) 10 | file(READ 11 | "${PROJECT_BINARY_DIR}/cmake-init.github.data" 12 | CMAKE_INIT_INFO 13 | ) 14 | 15 | string(REGEX MATCH 16 | "\"sha\": \"([0-9a-f]+)\"," 17 | CMAKE_INIT_SHA 18 | ${CMAKE_INIT_INFO}) 19 | 20 | string(SUBSTRING 21 | ${CMAKE_INIT_SHA} 22 | 8 23 | 40 24 | CMAKE_INIT_SHA 25 | ) 26 | 27 | # 28 | # Get latest cmake-init commit on this repository 29 | # 30 | 31 | # APPLIED_CMAKE_INIT_SHA can be set by parent script 32 | if(NOT APPLIED_CMAKE_INIT_SHA) 33 | # [TODO]: Get from git commit list (see cmake_init/source/scripts/check_template.sh) 34 | set(APPLIED_CMAKE_INIT_SHA "") 35 | endif () 36 | 37 | if("${APPLIED_CMAKE_INIT_SHA}" STREQUAL "") 38 | message(WARNING 39 | "No cmake-init version detected, could not verify up-to-dateness. " 40 | "Set the cmake-init version by defining a META_CMAKE_INIT_SHA for your project." 41 | ) 42 | return() 43 | endif() 44 | 45 | if(${APPLIED_CMAKE_INIT_SHA} STREQUAL ${CMAKE_INIT_SHA}) 46 | message(STATUS "cmake-init template is up-to-date (${CMAKE_INIT_SHA})") 47 | else() 48 | message(STATUS "cmake-init template needs an update https://github.com/cginternals/cmake-init/compare/${APPLIED_CMAKE_INIT_SHA}...master") 49 | endif() 50 | -------------------------------------------------------------------------------- /cmake/ClangTidy.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Function to register a target for clang-tidy 3 | function(perform_clang_tidy check_target target) 4 | set(includes "$") 5 | 6 | add_custom_target( 7 | ${check_target} 8 | COMMAND 9 | ${clang_tidy_EXECUTABLE} 10 | -p\t${PROJECT_BINARY_DIR} 11 | ${ARGN} 12 | -checks=* 13 | "$<$>:--\t$<$:-I$>>" 14 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 15 | ) 16 | 17 | set_target_properties(${check_target} 18 | PROPERTIES 19 | FOLDER "Maintenance" 20 | EXCLUDE_FROM_DEFAULT_BUILD 1 21 | ) 22 | 23 | add_dependencies(${check_target} ${target}) 24 | endfunction() 25 | -------------------------------------------------------------------------------- /cmake/ComponentInstall.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Execute cmake_install.cmake wrapper that allows to pass both DESTDIR and COMPONENT environment variable 3 | 4 | execute_process( 5 | COMMAND ${CMAKE_COMMAND} -DCOMPONENT=$ENV{COMPONENT} -P cmake_install.cmake 6 | ) 7 | -------------------------------------------------------------------------------- /cmake/Cppcheck.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Function to register a target for cppcheck 3 | function(perform_cppcheck check_target target) 4 | set(includes "$") 5 | 6 | add_custom_target( 7 | ${check_target} 8 | COMMAND 9 | ${cppcheck_EXECUTABLE} 10 | "$<$:-I$>" 11 | --enable=all 12 | --std=c++11 13 | --verbose 14 | --suppress=missingIncludeSystem 15 | ${ARGN} 16 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} 17 | ) 18 | 19 | set_target_properties(${check_target} 20 | PROPERTIES 21 | FOLDER "Maintenance" 22 | EXCLUDE_FROM_DEFAULT_BUILD 1 23 | ) 24 | 25 | add_dependencies(${check_target} ${target}) 26 | endfunction() 27 | -------------------------------------------------------------------------------- /cmake/Custom.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Set policy if policy is available 3 | function(set_policy POL VAL) 4 | 5 | if(POLICY ${POL}) 6 | cmake_policy(SET ${POL} ${VAL}) 7 | endif() 8 | 9 | endfunction(set_policy) 10 | 11 | 12 | # Define function "source_group_by_path with three mandatory arguments (PARENT_PATH, REGEX, GROUP, ...) 13 | # to group source files in folders (e.g. for MSVC solutions). 14 | # 15 | # Example: 16 | # source_group_by_path("${CMAKE_CURRENT_SOURCE_DIR}/src" "\\\\.h$|\\\\.inl$|\\\\.cpp$|\\\\.c$|\\\\.ui$|\\\\.qrc$" "Source Files" ${sources}) 17 | function(source_group_by_path PARENT_PATH REGEX GROUP) 18 | 19 | foreach (FILENAME ${ARGN}) 20 | 21 | get_filename_component(FILEPATH "${FILENAME}" REALPATH) 22 | file(RELATIVE_PATH FILEPATH ${PARENT_PATH} ${FILEPATH}) 23 | get_filename_component(FILEPATH "${FILEPATH}" DIRECTORY) 24 | 25 | string(REPLACE "/" "\\" FILEPATH "${FILEPATH}") 26 | 27 | source_group("${GROUP}\\${FILEPATH}" REGULAR_EXPRESSION "${REGEX}" FILES ${FILENAME}) 28 | 29 | endforeach() 30 | 31 | endfunction(source_group_by_path) 32 | 33 | 34 | # Function that extract entries matching a given regex from a list. 35 | # ${OUTPUT} will store the list of matching filenames. 36 | function(list_extract OUTPUT REGEX) 37 | 38 | foreach(FILENAME ${ARGN}) 39 | if(${FILENAME} MATCHES "${REGEX}") 40 | list(APPEND ${OUTPUT} ${FILENAME}) 41 | endif() 42 | endforeach() 43 | 44 | set(${OUTPUT} ${${OUTPUT}} PARENT_SCOPE) 45 | 46 | endfunction(list_extract) 47 | -------------------------------------------------------------------------------- /cmake/Findclang_tidy.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Findclang_tidy results: 3 | # clang_tidy_FOUND 4 | # clang_tidy_EXECUTABLE 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | find_program(clang_tidy_EXECUTABLE 9 | NAMES 10 | clang-tidy-3.5 11 | clang-tidy-3.6 12 | clang-tidy-3.7 13 | clang-tidy-3.8 14 | clang-tidy-3.9 15 | clang-tidy-4.0 16 | clang-tidy 17 | PATHS 18 | "${CLANG_TIDY_DIR}" 19 | ) 20 | 21 | find_package_handle_standard_args(clang_tidy 22 | FOUND_VAR 23 | clang_tidy_FOUND 24 | REQUIRED_VARS 25 | clang_tidy_EXECUTABLE 26 | ) 27 | 28 | mark_as_advanced(clang_tidy_EXECUTABLE) -------------------------------------------------------------------------------- /cmake/Findcppcheck.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Findcppcheck results: 3 | # cppcheck_FOUND 4 | # cppcheck_EXECUTABLE 5 | 6 | include(FindPackageHandleStandardArgs) 7 | 8 | # work around CMP0053, see http://public.kitware.com/pipermail/cmake/2014-November/059117.html 9 | set(PROGRAMFILES_x86_ENV "PROGRAMFILES(x86)") 10 | 11 | find_program(cppcheck_EXECUTABLE 12 | NAMES 13 | cppcheck 14 | PATHS 15 | "${CPPCHECK_DIR}" 16 | "$ENV{CPPCHECK_DIR}" 17 | "$ENV{PROGRAMFILES}/Cppcheck" 18 | "$ENV{${PROGRAMFILES_x86_ENV}}/Cppcheck" 19 | ) 20 | 21 | find_package_handle_standard_args(cppcheck 22 | FOUND_VAR 23 | cppcheck_FOUND 24 | REQUIRED_VARS 25 | cppcheck_EXECUTABLE 26 | ) 27 | 28 | mark_as_advanced(cppcheck_EXECUTABLE) 29 | -------------------------------------------------------------------------------- /cmake/GenerateTemplateExportHeader.cmake: -------------------------------------------------------------------------------- 1 | 2 | # Creates an export header similar to generate_export_header, but for templates. 3 | # The main difference is that for MSVC, templates must not get exported. 4 | # When the file ${export_file} is included in source code, the macro ${target_id}_TEMPLATE_API 5 | # may get used to define public visibility for templates on GCC and Clang platforms. 6 | function(generate_template_export_header target target_id export_file) 7 | if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC") 8 | configure_file(${PROJECT_SOURCE_DIR}/source/codegeneration/template_msvc_api.h.in ${CMAKE_CURRENT_BINARY_DIR}/${export_file}) 9 | else() 10 | configure_file(${PROJECT_SOURCE_DIR}/source/codegeneration/template_api.h.in ${CMAKE_CURRENT_BINARY_DIR}/${export_file}) 11 | endif() 12 | endfunction() 13 | -------------------------------------------------------------------------------- /cmake/GetGitRevisionDescription.cmake.in: -------------------------------------------------------------------------------- 1 | # 2 | # Internal file for GetGitRevisionDescription.cmake 3 | # 4 | # Requires CMake 2.6 or newer (uses the 'function' command) 5 | # 6 | # Original Author: 7 | # 2009-2010 Ryan Pavlik 8 | # http://academic.cleardefinition.com 9 | # Iowa State University HCI Graduate Program/VRAC 10 | # 11 | # Copyright Iowa State University 2009-2010. 12 | # Distributed under the Boost Software License, Version 1.0. 13 | # (See accompanying file LICENSE_1_0.txt or copy at 14 | # http://www.boost.org/LICENSE_1_0.txt) 15 | 16 | set(HEAD_HASH) 17 | set(HEAD_REF) 18 | 19 | if (NOT EXISTS "@HEAD_FILE@") 20 | return() 21 | endif() 22 | 23 | file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) 24 | 25 | string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) 26 | if(HEAD_CONTENTS MATCHES "ref") 27 | # named branch 28 | string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") 29 | if(EXISTS "@GIT_DIR@/${HEAD_REF}") 30 | configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) 31 | elseif(EXISTS "@GIT_DIR@/packed-refs") 32 | configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) 33 | file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) 34 | if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") 35 | set(HEAD_HASH "${CMAKE_MATCH_1}") 36 | endif() 37 | endif() 38 | else() 39 | # detached HEAD 40 | configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) 41 | endif() 42 | 43 | if(NOT HEAD_HASH AND EXISTS "@GIT_DATA@/head-ref") 44 | file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) 45 | string(STRIP "${HEAD_HASH}" HEAD_HASH) 46 | endif() 47 | -------------------------------------------------------------------------------- /cmake/RuntimeDependencies.cmake: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Default dependencies for the runtime-package 4 | # 5 | 6 | # Install 3rd-party runtime dependencies into runtime-component 7 | # install(FILES ... COMPONENT runtime) 8 | 9 | 10 | # 11 | # Full dependencies for self-contained packages 12 | # 13 | 14 | if(OPTION_SELF_CONTAINED) 15 | 16 | # Install 3rd-party runtime dependencies into runtime-component 17 | # install(FILES ... COMPONENT runtime) 18 | 19 | endif() 20 | -------------------------------------------------------------------------------- /cppassist-config.cmake: -------------------------------------------------------------------------------- 1 | 2 | # This config script tries to locate the project either in its source tree 3 | # or from an install location. 4 | # 5 | # Please adjust the list of submodules to search for. 6 | 7 | 8 | # List of modules 9 | set(MODULE_NAMES 10 | cppassist 11 | linenoise-ng 12 | ) 13 | 14 | 15 | # Macro to search for a specific module 16 | macro(find_module FILENAME) 17 | if(EXISTS "${FILENAME}") 18 | set(MODULE_FOUND TRUE) 19 | include("${FILENAME}") 20 | endif() 21 | endmacro() 22 | 23 | # Macro to search for all modules 24 | macro(find_modules PREFIX) 25 | foreach(module_name ${MODULE_NAMES}) 26 | if(TARGET ${module_name}) 27 | set(MODULE_FOUND TRUE) 28 | else() 29 | find_module("${CMAKE_CURRENT_LIST_DIR}/${PREFIX}/${module_name}/${module_name}-export.cmake") 30 | endif() 31 | endforeach(module_name) 32 | endmacro() 33 | 34 | 35 | # Try install location 36 | set(MODULE_FOUND FALSE) 37 | find_modules("cmake") 38 | 39 | if(MODULE_FOUND) 40 | return() 41 | endif() 42 | 43 | # Try common build locations 44 | if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") 45 | find_modules("build-debug/cmake") 46 | find_modules("build/cmake") 47 | else() 48 | find_modules("build/cmake") 49 | find_modules("build-debug/cmake") 50 | endif() 51 | 52 | # Signal success/failure to CMake 53 | set(cppassist_FOUND ${MODULE_FOUND}) 54 | -------------------------------------------------------------------------------- /cppassist-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cginternals/cppassist/a6617bfe869c105eca1aba76b4777773315aa181/cppassist-logo.png -------------------------------------------------------------------------------- /deploy/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Target 'pack' 4 | # 5 | 6 | add_custom_target(pack) 7 | set_target_properties(pack PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1) 8 | 9 | 10 | # Install additional runtime dependencies 11 | include(${PROJECT_SOURCE_DIR}/cmake/RuntimeDependencies.cmake) 12 | 13 | 14 | # 15 | # Packages 16 | # 17 | 18 | include(packages/pack-cppassist.cmake) 19 | 20 | 21 | # 22 | # Target 'component_install' 23 | # 24 | 25 | add_custom_target( 26 | component_install 27 | COMMAND make preinstall 28 | COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/ComponentInstall.cmake 29 | WORKING_DIRECTORY ${PROJECT_BINARY_DIR} 30 | ) 31 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/changelog: -------------------------------------------------------------------------------- 1 | libcppassist (1.0.0-0) UNRELEASED; urgency=low 2 | 3 | * Initial release. 4 | 5 | -- Willy Scheibel Sun, 18 Feb 2018 21:15:00 +0100 6 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/control: -------------------------------------------------------------------------------- 1 | Source: libcppassist 2 | Section: misc 3 | Priority: optional 4 | Maintainer: Willy Scheibel 5 | Build-Depends: build-essential, cmake, doxygen, graphviz 6 | Standards-Version: 3.8.0 7 | 8 | Package: libcppassist 9 | Architecture: any 10 | Homepage: https://cppassist.org/ 11 | Description: C++ sanctuary for small but powerful and frequently required, stand alone features. 12 | 13 | Package: libcppassist-dev 14 | Architecture: any 15 | Depends: libcppassist 16 | Homepage: https://cppassist.org/ 17 | Description: C++ sanctuary for small but powerful and frequently required, stand alone features. 18 | 19 | Package: libcppassist-docs 20 | Architecture: any 21 | Homepage: https://cppassist.org/ 22 | Description: C++ sanctuary for small but powerful and frequently required, stand alone features. 23 | 24 | Package: libcppassist-dbg 25 | Architecture: any 26 | Depends: libcppassist, libcppassist-dev 27 | Homepage: https://cppassist.org/ 28 | Description: C++ sanctuary for small but powerful and frequently required, stand alone features. 29 | 30 | Package: libcppassist-all 31 | Architecture: any 32 | Depends: libcppassist, libcppassist-dev, libcppassist-docs 33 | Homepage: https://cppassist.org/ 34 | Description: C++ sanctuary for small but powerful and frequently required, stand alone features. 35 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianised by Willy Scheibel on 2 | Sun, 18 Feb 2019 21:15:00 +0100 3 | 4 | It was downloaded from: 5 | 6 | https://github.com/cginternals/cppassist 7 | 8 | Upstream Author: 9 | 10 | CG Internals 11 | 12 | Copyright: 13 | 14 | Copyright (c) 2017-2018 CG Internals GmbH and Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany. 15 | 16 | License: 17 | 18 | This software is available to you under the terms of the MIT license, see "https://github.com/cginternals/cppassist/blob/master/LICENSE". 19 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | 3 | BUILDDIR = build 4 | BUILDDEBUGDIR = build-debug 5 | 6 | # firstly called by launchpad 7 | clean: 8 | rm -rf $(BUILDDIR) 9 | rm -rf $(BUILDDEBUGDIR) 10 | 11 | # secondly called by launchpad 12 | build: build-arch 13 | 14 | build-arch: 15 | mkdir $(BUILDDIR) 16 | cd $(BUILDDIR);cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DOPTION_BUILD_DOCS=On .. 17 | make -C $(BUILDDIR) 18 | mkdir $(BUILDDEBUGDIR) 19 | cd $(BUILDDEBUGDIR);cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/usr -DOPTION_BUILD_DOCS=Off .. 20 | make -C $(BUILDDEBUGDIR) 21 | 22 | # thirdly called by launchpad 23 | binary: binary-arch 24 | 25 | binary-arch: libcppassist libcppassist-dev libcppassist-docs libcppassist-dbg libcppassist-all 26 | 27 | libcppassist: 28 | cd $(BUILDDIR); DESTDIR=../debian/tmp COMPONENT=runtime make component_install 29 | mkdir -p debian/tmp/DEBIAN 30 | dpkg-gencontrol -plibcppassist 31 | dpkg --build debian/tmp .. 32 | rm -rf debian/tmp 33 | 34 | libcppassist-dev: 35 | cd $(BUILDDIR); DESTDIR=../debian/tmp COMPONENT=dev make component_install 36 | mkdir -p debian/tmp/DEBIAN 37 | dpkg-gencontrol -plibcppassist-dev 38 | dpkg --build debian/tmp .. 39 | rm -rf debian/tmp 40 | 41 | libcppassist-docs: 42 | cd $(BUILDDIR); DESTDIR=../debian/tmp COMPONENT=docs make component_install 43 | mkdir -p debian/tmp/DEBIAN 44 | dpkg-gencontrol -plibcppassist-docs 45 | dpkg --build debian/tmp .. 46 | rm -rf debian/tmp 47 | 48 | libcppassist-dbg: 49 | cd $(BUILDDEBUGDIR); DESTDIR=../debian/tmp COMPONENT=runtime make component_install 50 | cd $(BUILDDEBUGDIR); DESTDIR=../debian/tmp COMPONENT=dev make component_install 51 | rm -rf debian/tmp/usr/include 52 | rm debian/tmp/usr/share/*/*-config.cmake 53 | rm debian/tmp/usr/share/*/AUTHORS 54 | rm debian/tmp/usr/share/*/LICENSE 55 | rm debian/tmp/usr/share/*/README.md 56 | rm debian/tmp/usr/share/*/VERSION 57 | rm debian/tmp/usr/share/*/cmake/*/*-export.cmake 58 | mkdir -p debian/tmp/DEBIAN 59 | dpkg-gencontrol -plibcppassist-dbg 60 | dpkg --build debian/tmp .. 61 | rm -rf debian/tmp 62 | 63 | libcppassist-all: 64 | mkdir -p debian/tmp/DEBIAN 65 | dpkg-gencontrol -plibcppassist-all 66 | dpkg --build debian/tmp .. 67 | rm -rf debian/tmp 68 | 69 | .PHONY: build build-arch binary binary-arch clean libcppassist libcppassist-dev libcppassist-docs libcppassist-dbg libcppassist-all 70 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /deploy/ubuntu-ppa/recipe.txt: -------------------------------------------------------------------------------- 1 | # git-build-recipe format 0.4 deb-version {debupstream}+{revno} 2 | lp:cppassist v1 3 | nest-part packaging lp:cppassist deploy/ubuntu-ppa/debian debian v1 4 | -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Target 'docs' 4 | # 5 | 6 | if(NOT OPTION_BUILD_DOCS) 7 | return() 8 | endif() 9 | 10 | add_custom_target(docs) 11 | 12 | 13 | # 14 | # Documentation 15 | # 16 | 17 | add_subdirectory(api-docs) 18 | add_subdirectory(manual) 19 | -------------------------------------------------------------------------------- /docs/api-docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Find doxygen 4 | # 5 | 6 | find_package(Doxygen) 7 | if(NOT DOXYGEN_FOUND) 8 | message(STATUS "Disabled generation of doxygen documentation (missing doxygen).") 9 | return() 10 | endif() 11 | 12 | 13 | # 14 | # Target name 15 | # 16 | 17 | set(target api-docs) 18 | message(STATUS "Doc ${target}") 19 | 20 | 21 | # 22 | # Input file 23 | # 24 | 25 | set(doxyfile_in doxyfile.in) 26 | 27 | 28 | # 29 | # Create documentation 30 | # 31 | 32 | # Set project variables 33 | set(doxyfile "${CMAKE_CURRENT_BINARY_DIR}/doxyfile") 34 | set(doxyfile_directory "${CMAKE_CURRENT_BINARY_DIR}/html") 35 | set(doxyfile_html "${doxyfile_directory}/index.html") 36 | 37 | # Get filename and path of doxyfile 38 | get_filename_component(name ${doxyfile_in} NAME) 39 | get_filename_component(path ${doxyfile_in} PATH) 40 | if(NOT path) 41 | set(path ${CMAKE_CURRENT_SOURCE_DIR}) 42 | endif() 43 | 44 | # Configure doxyfile (if it is a real doxyfile already, it should simply copy the file) 45 | set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) 46 | configure_file(${doxyfile_in} ${doxyfile}) 47 | 48 | # Invoke doxygen 49 | add_custom_command( 50 | OUTPUT ${doxyfile_html} 51 | DEPENDS ${doxyfile} ${META_PROJECT_NAME}::cppassist 52 | WORKING_DIRECTORY ${path} 53 | COMMAND ${CMAKE_COMMAND} -E copy_directory ${path} ${doxyfile_directory} # ToDO, configure doxygen to use source as is 54 | COMMAND ${DOXYGEN} \"${doxyfile}\" 55 | COMMENT "Creating doxygen documentation." 56 | ) 57 | 58 | # Declare target 59 | add_custom_target(${target} ALL DEPENDS ${doxyfile_html}) 60 | add_dependencies(docs ${target}) 61 | 62 | 63 | # 64 | # Deployment 65 | # 66 | 67 | install( 68 | DIRECTORY ${doxyfile_directory} 69 | DESTINATION ${INSTALL_DOC} 70 | COMPONENT docs 71 | ) 72 | -------------------------------------------------------------------------------- /docs/manual/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Find LaTeX 4 | # 5 | 6 | find_package(LATEX) 7 | if(NOT LATEX_FOUND) 8 | message(STATUS "Disabled generation of documentation (missing LaTeX).") 9 | return() 10 | endif() 11 | 12 | 13 | # 14 | # Target name 15 | # 16 | 17 | set(target docs-manual) 18 | message(STATUS "Doc ${target}") 19 | 20 | 21 | # 22 | # Input and output files 23 | # 24 | 25 | set(source "${CMAKE_CURRENT_SOURCE_DIR}/cmake-init.tex") 26 | set(pdf "${CMAKE_CURRENT_BINARY_DIR}/cmake-init.pdf") 27 | 28 | 29 | # 30 | # Create documentation 31 | # 32 | 33 | # Invoke LaTeX 34 | add_custom_command( 35 | OUTPUT ${pdf} 36 | DEPENDS ${source} 37 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" 38 | COMMAND ${PDFLATEX_COMPILER} \"${source}\" 39 | COMMAND ${PDFLATEX_COMPILER} \"${source}\" 40 | COMMAND ${PDFLATEX_COMPILER} \"${source}\" 41 | COMMENT "Creating LaTeX documentation." 42 | ) 43 | 44 | # Declare target 45 | add_custom_target(${target} ALL DEPENDS ${pdf}) 46 | add_dependencies(docs ${target}) 47 | 48 | 49 | # 50 | # Deployment 51 | # 52 | 53 | # PDF file 54 | install(FILES ${pdf} 55 | DESTINATION "${INSTALL_DOC}" 56 | COMPONENT docs 57 | ) 58 | -------------------------------------------------------------------------------- /docs/manual/cmake-init.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass{article} 3 | 4 | \usepackage[pdfborder={0 0 0}]{hyperref} 5 | 6 | \begin{document} 7 | 8 | \title{cmake-init: C++ CMake Project Template} 9 | 10 | \maketitle 11 | 12 | \begin{abstract} 13 | \noindent 14 | cmake-init is a copy and paste template, that provides the following features: 15 | 16 | \begin{itemize} 17 | \item Cross Platform 18 | \begin{itemize} 19 | \item Windows 20 | \item Linux 21 | \item Mac 22 | \end{itemize} 23 | \item Libraries, Applications, Testing template 24 | \item Documentation template 25 | \item Installation, Packaging template 26 | \item CMake find script template for defined libraries 27 | \end{itemize} 28 | 29 | \end{abstract} 30 | 31 | \setcounter{tocdepth}{2} 32 | \tableofcontents 33 | 34 | \newpage 35 | 36 | \end{document} 37 | -------------------------------------------------------------------------------- /source/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Configuration for all sub-projects 4 | # 5 | 6 | # Generate version-header 7 | configure_file(version.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/${META_PROJECT_NAME}/${META_PROJECT_NAME}-version.h) 8 | 9 | 10 | # 11 | # Sub-projects 12 | # 13 | 14 | # Libraries 15 | set(IDE_FOLDER "") 16 | add_subdirectory(cppassist) 17 | 18 | # Examples 19 | set(IDE_FOLDER "Examples") 20 | add_subdirectory(examples) 21 | 22 | # Tests 23 | if(OPTION_BUILD_TESTS AND NOT MINGW) 24 | set(IDE_FOLDER "Tests") 25 | add_subdirectory(tests) 26 | endif() 27 | 28 | 29 | # 30 | # Deployment 31 | # 32 | 33 | # Deploy generated headers 34 | install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/${META_PROJECT_NAME} DESTINATION include COMPONENT dev) 35 | -------------------------------------------------------------------------------- /source/codegeneration/template_api.h.in: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ${target_id}_TEMPLATE_API_H 3 | #define ${target_id}_TEMPLATE_API_H 4 | 5 | #include <${target}/${target}_export.h> 6 | 7 | #ifdef ${target_id}_STATIC_DEFINE 8 | # define ${target_id}_TEMPLATE_API 9 | #else 10 | # ifndef ${target_id}_TEMPLATE_API 11 | # ifdef ${target_id}_EXPORTS 12 | /* We are building this library */ 13 | # define ${target_id}_TEMPLATE_API __attribute__((visibility("default"))) 14 | # else 15 | /* We are using this library */ 16 | # define ${target_id}_TEMPLATE_API __attribute__((visibility("default"))) 17 | # endif 18 | # endif 19 | 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /source/codegeneration/template_msvc_api.h.in: -------------------------------------------------------------------------------- 1 | 2 | #ifndef ${target_id}_TEMPLATE_API_H 3 | #define ${target_id}_TEMPLATE_API_H 4 | 5 | #include <${target}/${target}_export.h> 6 | 7 | #ifdef ${target_id}_STATIC_DEFINE 8 | # define ${target_id}_TEMPLATE_API 9 | #else 10 | # ifndef ${target_id}_TEMPLATE_API 11 | # ifdef ${target_id}_EXPORTS 12 | /* We are building this library */ 13 | # define ${target_id}_TEMPLATE_API 14 | # else 15 | /* We are using this library */ 16 | # define ${target_id}_TEMPLATE_API 17 | # endif 18 | # endif 19 | 20 | #endif 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/cmdline/ArgumentParser.inl: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | namespace cppassist 6 | { 7 | 8 | 9 | template 10 | T ArgumentParser::value(const std::string & option, const T & defaultValue) const 11 | { 12 | const auto it = m_options.find(option); 13 | 14 | if (it == m_options.end()) 15 | { 16 | return defaultValue; 17 | } 18 | 19 | return string::fromString(it->second); 20 | } 21 | 22 | 23 | } // namespace cppassist 24 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/cmdline/CommandLineCommand.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | #include 8 | 9 | 10 | namespace cppassist 11 | { 12 | 13 | 14 | /** 15 | * @brief 16 | * Command line command 17 | * 18 | * A command decribes a certain function that can be invoked 19 | * by specifying the command name on the command line. 20 | * 21 | * Example: 22 | * `myapp list` 23 | * 24 | * @code 25 | * CommandLineCommand commandList("list"); 26 | * @endcode 27 | */ 28 | class CPPASSIST_API CommandLineCommand 29 | { 30 | public: 31 | /** 32 | * @brief 33 | * Constructor 34 | * 35 | * @param[in] name 36 | * Command name (e.g., "list") 37 | */ 38 | CommandLineCommand(const std::string & name); 39 | 40 | /** 41 | * @brief 42 | * Destructor 43 | */ 44 | ~CommandLineCommand(); 45 | 46 | /** 47 | * @brief 48 | * Get command name 49 | * 50 | * @return 51 | * Command name (e.g., "list") 52 | */ 53 | const std::string & name() const; 54 | 55 | /** 56 | * @brief 57 | * Set command name 58 | * 59 | * @param[in] name 60 | * Command name (e.g., "list") 61 | */ 62 | void setName(const std::string & name); 63 | 64 | /** 65 | * @brief 66 | * Check if command has been activated 67 | * 68 | * @return 69 | * `true` if activated, else `false` 70 | */ 71 | bool activated() const; 72 | 73 | /** 74 | * @brief 75 | * Set if command has been activated 76 | * 77 | * @param[in] activated 78 | * `true` if activated, else `false` 79 | */ 80 | void setActivated(bool activated); 81 | 82 | 83 | protected: 84 | std::string m_name; ///< Command name (e.g., "list") 85 | bool m_activated; ///< `true` if activated, else `false` 86 | }; 87 | 88 | 89 | } // namespace cppassist 90 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/error/Error.inl: -------------------------------------------------------------------------------- 1 | 2 | namespace cppassist 3 | { 4 | 5 | 6 | template 7 | Error::Error(const std::string & message, const E & reason) 8 | : m_message(message) 9 | , m_reason(new E(reason)) 10 | { 11 | } 12 | 13 | template 14 | Error::Error(std::string && message, const E & reason) 15 | : m_message(std::move(message)) 16 | , m_reason(new E(reason)) 17 | { 18 | } 19 | 20 | template 21 | Error::Error(const std::string & message, E && reason) 22 | : m_message(message) 23 | , m_reason(new E(std::move(reason))) 24 | { 25 | } 26 | 27 | template 28 | Error::Error(std::string && message, E && reason) 29 | : m_message(std::move(message)) 30 | , m_reason(new E(std::move(reason))) 31 | { 32 | } 33 | 34 | 35 | } // namespace cppassist 36 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/fs/readfile.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | #include 8 | 9 | 10 | namespace cppassist 11 | { 12 | namespace fs 13 | { 14 | 15 | 16 | /** 17 | * @brief 18 | * Read entire file into a string 19 | * 20 | * @param[in] filePath 21 | * Path to file 22 | * @param[out] content 23 | * String that receives the contents of the file 24 | * 25 | * @return 26 | * `true` if the file has been read successfully, else `false` 27 | */ 28 | CPPASSIST_API bool readFile(const std::string & filePath, std::string & content); 29 | 30 | /** 31 | * @brief 32 | * Read entire file into a string 33 | * 34 | * @param[in] filePath 35 | * Path to file 36 | * 37 | * @return 38 | * File content as string, "" on error 39 | */ 40 | CPPASSIST_API std::string readFile(const std::string & filePath); 41 | 42 | 43 | } // namespace fs 44 | } // namespace cppassist 45 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/logging/AbstractLogHandler.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | #include 8 | 9 | 10 | namespace cppassist 11 | { 12 | 13 | 14 | class LogMessage; 15 | 16 | 17 | /** 18 | * @brief 19 | * Abstract log message handler 20 | * 21 | * cppassist uses a global logging handler to which all generated log 22 | * messages are dispatched. This is the abstract interface for handling them. 23 | * Subclass this class if you wish to replace the global default logging 24 | * behavior in cppassist, which is to write everything to stdout. 25 | * 26 | * @see setLoggingHandler 27 | * @see logging.h 28 | */ 29 | class CPPASSIST_API AbstractLogHandler 30 | { 31 | public: 32 | /** 33 | * @brief 34 | * Constructor 35 | */ 36 | AbstractLogHandler(); 37 | 38 | /** 39 | * @brief 40 | * Destructor 41 | */ 42 | virtual ~AbstractLogHandler(); 43 | 44 | /** 45 | * @brief 46 | * Handle log message 47 | * 48 | * @param[in] message 49 | * Log message 50 | */ 51 | virtual void handle(const LogMessage & message) = 0; 52 | 53 | 54 | protected: 55 | /** 56 | * @brief 57 | * Construct prefix from message context 58 | * 59 | * @param[in] message 60 | * Log message 61 | * 62 | * @return 63 | * Prefix 64 | */ 65 | static std::string messagePrefix(const LogMessage & message); 66 | 67 | /** 68 | * @brief 69 | * Construct string denoting log level 70 | * 71 | * @param[in] level 72 | * Log level 73 | * 74 | * @return 75 | * String denoting log level 76 | */ 77 | static std::string levelString(int level); 78 | }; 79 | 80 | 81 | } // namespace cppassist 82 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/logging/ConsoleLogHandler.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | 8 | 9 | namespace cppassist 10 | { 11 | 12 | 13 | /** 14 | * @brief 15 | * Log message handler that writes log messages to stdout 16 | * 17 | * This is the default LogMessage handler of cppassist. 18 | * 19 | * @see setLoggingHandler 20 | * @see logging.h 21 | */ 22 | class CPPASSIST_API ConsoleLogHandler : public AbstractLogHandler 23 | { 24 | public: 25 | // Virtual AbstractLogHandler interface 26 | virtual void handle(const LogMessage & message) override; 27 | }; 28 | 29 | 30 | } // namespace cppassist 31 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/logging/FileLogHandler.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | 8 | 9 | namespace cppassist 10 | { 11 | 12 | 13 | /** 14 | * @brief 15 | * Log message handler that writes log messages a file 16 | * 17 | * @see setLoggingHandler 18 | * @see logging.h 19 | */ 20 | class CPPASSIST_API FileLogHandler : public AbstractLogHandler 21 | { 22 | public: 23 | /** 24 | * @brief 25 | * Constructor 26 | * 27 | * @param[in] logfile 28 | * File name 29 | */ 30 | FileLogHandler(const std::string & logfile = "logfile.log"); 31 | 32 | // Virtual AbstractLogHandler interface 33 | virtual void handle(const LogMessage & message) override; 34 | 35 | 36 | protected: 37 | std::string m_logfile; ///< File name of the log file 38 | }; 39 | 40 | 41 | } // namespace cppassist 42 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/logging/LogMessage.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | #include 8 | 9 | 10 | namespace cppassist 11 | { 12 | 13 | 14 | /** 15 | * @brief 16 | * Representation of a log message 17 | * 18 | * LogMessages are handled and dispatched by the global logging handler which 19 | * has to be a subclass of AbstractLogHandler. 20 | * 21 | * @see logging.h 22 | * @see AbstractLogHandler 23 | */ 24 | class CPPASSIST_API LogMessage 25 | { 26 | public: 27 | /** 28 | * @brief 29 | * Log level 30 | */ 31 | enum Level 32 | { 33 | Critical ///< Cricical errors 34 | , Error ///< Errors 35 | , Warning ///< Warnings 36 | , Info ///< Info messages 37 | , Debug ///< Debug messages (Use Debug + x for further debug levels) 38 | }; 39 | 40 | 41 | public: 42 | /** 43 | * @brief 44 | * Constructor 45 | * 46 | * @param[in] level 47 | * Log level 48 | * @param[in] message 49 | * Log message 50 | * @param[in] context 51 | * User defined context string 52 | */ 53 | LogMessage(int level, const std::string & message, const std::string & context); 54 | 55 | /** 56 | * @brief 57 | * Get log level of the message 58 | * 59 | * @return 60 | * Log level 61 | */ 62 | int level() const; 63 | 64 | /** 65 | * @brief 66 | * Get log message 67 | * 68 | * @return 69 | * Log message 70 | */ 71 | const std::string & message() const; 72 | 73 | /** 74 | * @brief 75 | * Get context of the log message 76 | * 77 | * @return 78 | * User defined context string 79 | */ 80 | const std::string & context() const; 81 | 82 | 83 | protected: 84 | int m_level; ///< Log level 85 | std::string m_message; ///< Log message 86 | std::string m_context; ///< User defined context string 87 | }; 88 | 89 | 90 | } // namespace cppassist 91 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/logging/LogMessageBuilder.inl: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | namespace cppassist 6 | { 7 | 8 | 9 | template 10 | LogMessageBuilder& LogMessageBuilder::operator<<(const T * pointer) 11 | { 12 | return *this << static_cast(pointer); 13 | } 14 | 15 | template 16 | LogMessageBuilder& LogMessageBuilder::operator<<(const std::vector & vector) 17 | { 18 | *this << "vector("; 19 | for (size_t i = 0; i < vector.size(); ++i) 20 | { 21 | *this << vector[i]; 22 | if (i < vector.size()-1) 23 | *this << ", "; 24 | } 25 | *this << ")"; 26 | 27 | return *this; 28 | } 29 | 30 | template 31 | LogMessageBuilder& LogMessageBuilder::operator<<(const std::array & array) 32 | { 33 | *this << "array("; 34 | for (size_t i = 0; i < Count; ++i) 35 | { 36 | *this << array[i]; 37 | if (i < Count-1) 38 | *this << ", "; 39 | } 40 | *this << ")"; 41 | 42 | return *this; 43 | } 44 | 45 | 46 | } // namespace cppassist 47 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/memory/make_unique.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | #include 8 | 9 | 10 | namespace cppassist 11 | { 12 | 13 | 14 | // based on the implementation from libc++ (MIT-licensed) 15 | 16 | 17 | namespace detail 18 | { 19 | 20 | 21 | template 22 | struct CPPASSIST_TEMPLATE_API UniqueIf 23 | { 24 | using UniqueSingle = std::unique_ptr; 25 | }; 26 | 27 | template 28 | struct CPPASSIST_TEMPLATE_API UniqueIf 29 | { 30 | using UniqueArrayUnknownBound = std::unique_ptr; 31 | }; 32 | 33 | template 34 | struct CPPASSIST_TEMPLATE_API UniqueIf 35 | { 36 | using UniqueArrayKnownBound = void; 37 | }; 38 | 39 | 40 | } // namespace detail 41 | 42 | 43 | template 44 | typename detail::UniqueIf::UniqueSingle make_unique(Args && ... args); 45 | 46 | template 47 | typename detail::UniqueIf::UniqueArrayUnknownBound make_unique(std::size_t n); 48 | 49 | template 50 | typename detail::UniqueIf::UniqueArrayKnownBound make_unique(Args && ...) = delete; 51 | 52 | 53 | } // namespace cppassist 54 | 55 | 56 | #include 57 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/memory/make_unique.inl: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | namespace cppassist 6 | { 7 | 8 | 9 | template 10 | typename detail::UniqueIf::UniqueSingle make_unique(Args && ... args) 11 | { 12 | return std::unique_ptr(new T(std::forward(args)...)); 13 | } 14 | 15 | template 16 | typename detail::UniqueIf::UniqueArrayUnknownBound make_unique(std::size_t n) 17 | { 18 | using U = typename std::remove_extent::type; 19 | return std::unique_ptr(new U[n]()); 20 | } 21 | 22 | 23 | } // namespace cppassist 24 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/memory/offsetof.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | 8 | namespace cppassist 9 | { 10 | 11 | 12 | /** 13 | * @brief 14 | * Determines the offset of a member within a class 15 | * 16 | * @param[in] member 17 | * Pointer to class member 18 | * 19 | * @return 20 | * Offset of member 21 | */ 22 | template 23 | std::ptrdiff_t offset(Type Class::*member); 24 | 25 | 26 | } // namespace cppassist 27 | 28 | 29 | #include 30 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/memory/offsetof.inl: -------------------------------------------------------------------------------- 1 | 2 | namespace cppassist 3 | { 4 | 5 | 6 | template 7 | std::ptrdiff_t offset(Type Class::*member) 8 | { 9 | return reinterpret_cast(&(((Class*)0)->*member)); 10 | } 11 | 12 | 13 | } // namespace cppassist 14 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/simd/allocator.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | #ifdef _MSC_VER 5 | #pragma warning (push) 6 | #pragma warning (disable: 4100) // 'identifier': unreferenced formal parameter 7 | #endif 8 | 9 | 10 | #include 11 | 12 | #include 13 | 14 | 15 | namespace cppassist 16 | { 17 | 18 | 19 | /** 20 | * @see http://jmabille.github.io/blog/2014/12/06/aligned-memory-allocator/ 21 | */ 22 | template 23 | class CPPASSIST_TEMPLATE_API aligned_allocator 24 | { 25 | public: 26 | typedef T value_type; 27 | typedef T& reference; 28 | typedef const T& const_reference; 29 | typedef T* pointer; 30 | typedef const T* const_pointer; 31 | typedef size_t size_type; 32 | typedef ptrdiff_t difference_type; 33 | 34 | template 35 | struct rebind 36 | { 37 | typedef aligned_allocator other; 38 | }; 39 | 40 | inline aligned_allocator() throw() {} 41 | inline aligned_allocator(const aligned_allocator&) throw() {} 42 | 43 | template 44 | inline aligned_allocator(const aligned_allocator&) throw() {} 45 | 46 | inline ~aligned_allocator() throw() {} 47 | 48 | inline pointer address(reference r) { return &r; } 49 | inline const_pointer address(const_reference r) const { return &r; } 50 | 51 | pointer allocate(size_type n, typename std::allocator::const_pointer hint = 0); 52 | inline void deallocate(pointer p, size_type); 53 | 54 | inline void construct(pointer p, const_reference value) { new (p) value_type(value); } 55 | inline void destroy(pointer p) { p->~value_type(); } 56 | 57 | inline size_type max_size() const throw() { return size_type(-1) / sizeof(T); } 58 | 59 | inline bool operator==(const aligned_allocator&) { return true; } 60 | inline bool operator!=(const aligned_allocator& rhs) { return !operator==(rhs); } 61 | }; 62 | 63 | 64 | } // namespace cppassist 65 | 66 | 67 | #include 68 | 69 | #ifdef _MSC_VER 70 | #pragma warning (pop) 71 | #endif 72 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/simd/simd.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #ifdef AVX512_ENABLED 6 | #include 7 | #define CPPASSIST_SIMD_SIZE 16 8 | #elif defined(AVX2_ENABLED) 9 | #include 10 | #define CPPASSIST_SIMD_SIZE 8 11 | #elif defined(SSE_ENABLED) 12 | #include 13 | #define CPPASSIST_SIMD_SIZE 4 14 | #else 15 | // include nothing 16 | #define CPPASSIST_SIMD_SIZE 1 17 | #endif 18 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/simd/value.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | 8 | 9 | namespace cppassist 10 | { 11 | 12 | 13 | template 14 | class value; 15 | 16 | 17 | } // namespace cppassist 18 | 19 | 20 | #if CPPASSIST_SIMD_SIZE >= 16 21 | #include 22 | #endif 23 | 24 | #if CPPASSIST_SIMD_SIZE >= 8 25 | #include 26 | #endif 27 | 28 | #if CPPASSIST_SIMD_SIZE >= 4 29 | #include 30 | #endif 31 | 32 | #if CPPASSIST_SIMD_SIZE >= 1 33 | #include 34 | #endif 35 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/string/conversion.inl: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | 8 | namespace cppassist 9 | { 10 | namespace string 11 | { 12 | 13 | 14 | template 15 | Type fromString(const std::string & string) 16 | { 17 | std::stringstream stream(string); 18 | auto value = typename std::remove_const::type(); 19 | stream >> value; 20 | return value; 21 | } 22 | 23 | template 24 | std::string toString(const Type & value) 25 | { 26 | std::stringstream stream; 27 | stream << value; 28 | return stream.str(); 29 | } 30 | 31 | 32 | } // namespace string 33 | } // namespace cppassist 34 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/string/manipulation.inl: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | 8 | namespace cppassist 9 | { 10 | namespace string 11 | { 12 | 13 | 14 | template 15 | std::string join(const Iterable & iterable, const std::string & separator) 16 | { 17 | std::stringstream stream; 18 | 19 | for (auto it = iterable.begin(); it != iterable.end(); ++it) 20 | { 21 | stream << *it; 22 | 23 | if (it+1 != iterable.end()) 24 | stream << separator; 25 | } 26 | 27 | return stream.str(); 28 | } 29 | 30 | 31 | } // namespace string 32 | } // namespace cppassist 33 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/string/processing.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | 11 | namespace cppassist 12 | { 13 | namespace string 14 | { 15 | 16 | 17 | /** 18 | * @brief 19 | * Splits the line at delimiter (while regarding the symmetric escapeCharacter) and calls the callback for each part. 20 | * 21 | * @param[in] line 22 | * The line to parse 23 | * @param[in] start_pos 24 | * The start pos within the line for parsing 25 | * @param[in] delimiter 26 | * The delimiter for adjacent parts within the line 27 | * @param[in] escapeCharacter 28 | * The character for inline escaping (while escaped, the delimiter is ignored; symmetric) 29 | * @param[in] callback 30 | * The callback to invoke for each parsed line part 31 | */ 32 | CPPASSIST_API void parseLine(const std::string & line, const std::string::size_type start_pos, const char delimiter, const char escapeCharacter, std::function callback); 33 | 34 | 35 | } // namespace string 36 | } // namespace cppassist 37 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/string/regex.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | 11 | namespace cppassist 12 | { 13 | namespace string 14 | { 15 | 16 | 17 | /** 18 | * @brief 19 | * Check if a regex matches a given string 20 | * 21 | * @param[in] string 22 | * Input string 23 | * @param[in] regex 24 | * Regular expression 25 | * 26 | * @return 27 | * `true` if regex matches the string, else `false` 28 | */ 29 | CPPASSIST_API bool matchesRegex(const std::string & string, const std::string & regex); 30 | 31 | /** 32 | * @brief 33 | * Extract substrings matched by a regex 34 | * 35 | * @param[in] string 36 | * Input string 37 | * @param[in] regex 38 | * Regular expression 39 | * 40 | * @return 41 | * List of results that match the regex 42 | */ 43 | CPPASSIST_API std::vector extract(const std::string & string, const std::string & regex); 44 | 45 | /** 46 | * @brief 47 | * Extract next string matched by a regex 48 | * 49 | * @param[in] begin 50 | * Begin iterator of string range 51 | * @param[in] end 52 | * End iterator of string range 53 | * @param[in] regex 54 | * Regular expression 55 | * @param[out] match 56 | * The resulting match 57 | * 58 | * @return 59 | * The iterator to the character after the match or `begin` if regex does not match 60 | */ 61 | CPPASSIST_API std::string::const_iterator extractNext(std::string::const_iterator begin, std::string::const_iterator end, const std::string & regex, std::string & match); 62 | 63 | /** 64 | * @brief 65 | * Extract next string matched by a regex 66 | * 67 | * @param[in] begin 68 | * Begin pointer of string range 69 | * @param[in] end 70 | * End pointer of string range 71 | * @param[in] regex 72 | * Regular expression 73 | * @param[out] match 74 | * The resulting match 75 | * 76 | * @return 77 | * The pointer to the character after the match or `begin` if regex does not match 78 | */ 79 | CPPASSIST_API const char * extractNext(const char * begin, const char * end, const std::string & regex, std::string & match); 80 | 81 | 82 | } // namespace string 83 | } // namespace cppassist 84 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/typelist/TypeList.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | namespace cppassist 6 | { 7 | 8 | 9 | /** 10 | * @brief 11 | * A compile-time list of types. 12 | * 13 | * This is the default template for template specializations. 14 | */ 15 | template 16 | class TypeList; 17 | 18 | /** 19 | * @brief 20 | * A compile-time list of types. 21 | * 22 | * This is the template specialization for non-zero type lists. 23 | * There is an interface to call a template method invoke() on a Functor for each type in the type list. 24 | */ 25 | template 26 | class TypeList 27 | { 28 | public: 29 | /** 30 | * @brief 31 | * Call the template method invoke() on the Functor for each type. 32 | * 33 | * @param[in] callback 34 | * The functor, supporting a templated method invoke() 35 | */ 36 | template 37 | static void apply(Functor && callback); 38 | }; 39 | 40 | /** 41 | * @brief 42 | * A compile-time list of types. 43 | * 44 | * This is the template specialization for a zero type list. 45 | * It is used as the recursion break condition. 46 | */ 47 | template <> 48 | class TypeList<> 49 | { 50 | public: 51 | /** 52 | * @brief 53 | * Call the template method invoke() on the Functor for each type. 54 | * 55 | * As this is the empty type list, no operator is called. 56 | * 57 | * @param[in] callback 58 | * The functor, supporting a templated method invoke() 59 | */ 60 | template 61 | static void apply(Functor && callback); 62 | }; 63 | 64 | 65 | } // namespace cppassist 66 | 67 | 68 | #include 69 | -------------------------------------------------------------------------------- /source/cppassist/include/cppassist/typelist/TypeList.inl: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | 7 | 8 | namespace cppassist 9 | { 10 | 11 | 12 | template 13 | template 14 | void TypeList::apply(Functor && callback) 15 | { 16 | callback.template invoke(); 17 | 18 | TypeList::apply(std::forward(callback)); 19 | } 20 | 21 | template 22 | void TypeList<>::apply(Functor &&) 23 | { 24 | } 25 | 26 | 27 | } // namespace cppassist 28 | -------------------------------------------------------------------------------- /source/cppassist/source/cmdline/CommandLineCommand.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | namespace cppassist 6 | { 7 | 8 | 9 | CommandLineCommand::CommandLineCommand(const std::string & name) 10 | : m_name(name) 11 | , m_activated(false) 12 | { 13 | } 14 | 15 | CommandLineCommand::~CommandLineCommand() 16 | { 17 | } 18 | 19 | const std::string & CommandLineCommand::name() const 20 | { 21 | return m_name; 22 | } 23 | 24 | void CommandLineCommand::setName(const std::string & name) 25 | { 26 | m_name = name; 27 | } 28 | 29 | bool CommandLineCommand::activated() const 30 | { 31 | return m_activated; 32 | } 33 | 34 | void CommandLineCommand::setActivated(bool activated) 35 | { 36 | m_activated = activated; 37 | } 38 | 39 | 40 | } // namespace cppassist 41 | -------------------------------------------------------------------------------- /source/cppassist/source/cmdline/CommandLineParameter.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | namespace cppassist 6 | { 7 | 8 | 9 | CommandLineParameter::CommandLineParameter(const std::string & name, CommandLineParameter::OptionalState optional) 10 | : m_name(name) 11 | , m_optional(optional) 12 | , m_value("") 13 | { 14 | } 15 | 16 | CommandLineParameter::~CommandLineParameter() 17 | { 18 | } 19 | 20 | const std::string & CommandLineParameter::name() const 21 | { 22 | return m_name; 23 | } 24 | 25 | void CommandLineParameter::setName(const std::string & name) 26 | { 27 | m_name = name; 28 | } 29 | 30 | bool CommandLineParameter::isOptional() const 31 | { 32 | return m_optional == Optional; 33 | } 34 | 35 | CommandLineParameter::OptionalState CommandLineParameter::optional() const 36 | { 37 | return m_optional; 38 | } 39 | 40 | void CommandLineParameter::setOptional(CommandLineParameter::OptionalState optional) 41 | { 42 | m_optional = optional; 43 | } 44 | 45 | const std::string & CommandLineParameter::value() const 46 | { 47 | return m_value; 48 | } 49 | 50 | void CommandLineParameter::setValue(const std::string & value) 51 | { 52 | m_value = value; 53 | } 54 | 55 | 56 | } // namespace cppassist 57 | -------------------------------------------------------------------------------- /source/cppassist/source/fs/RawFile.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | 9 | namespace cppassist 10 | { 11 | 12 | 13 | RawFile::RawFile() 14 | : m_valid(false) 15 | { 16 | } 17 | 18 | RawFile::~RawFile() 19 | { 20 | } 21 | 22 | bool RawFile::load(const std::string & filePath) 23 | { 24 | m_filePath = filePath; 25 | 26 | return reload(); 27 | } 28 | 29 | bool RawFile::reload() 30 | { 31 | m_valid = readFile(); 32 | 33 | return m_valid; 34 | } 35 | 36 | bool RawFile::isValid() const 37 | { 38 | return m_valid; 39 | } 40 | 41 | const std::string & RawFile::filePath() const 42 | { 43 | return m_filePath; 44 | } 45 | 46 | const char * RawFile::data() const 47 | { 48 | if (!m_valid) 49 | { 50 | return nullptr; 51 | } 52 | 53 | return m_data.data(); 54 | } 55 | 56 | size_t RawFile::size() const 57 | { 58 | if (!m_valid) 59 | { 60 | return size_t(0); 61 | } 62 | 63 | return m_data.size(); 64 | } 65 | 66 | bool RawFile::readFile() 67 | { 68 | m_data.clear(); 69 | 70 | if (!fs::readFile(m_filePath, m_data)) 71 | { 72 | std::cerr << "Reading from file \"" << m_filePath << "\" failed." << std::endl; 73 | return false; 74 | } 75 | 76 | return true; 77 | } 78 | 79 | 80 | } // namespace cppassist 81 | -------------------------------------------------------------------------------- /source/cppassist/source/fs/readfile.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace cppassist 8 | { 9 | namespace fs 10 | { 11 | 12 | 13 | bool readFile(const std::string & filePath, std::string & content) 14 | { 15 | // http://insanecoding.blogspot.de/2011/11/how-to-read-in-file-in-c.html 16 | 17 | std::ifstream in(filePath, std::ios::in | std::ios::binary); 18 | 19 | if (!in) 20 | return false; 21 | 22 | content = std::string(std::istreambuf_iterator(in), std::istreambuf_iterator()); 23 | return true; 24 | } 25 | 26 | std::string readFile(const std::string & filePath) 27 | { 28 | std::string content; 29 | readFile(filePath, content); 30 | 31 | return content; 32 | } 33 | 34 | 35 | } // namespace fs 36 | } // namespace cppassist 37 | -------------------------------------------------------------------------------- /source/cppassist/source/logging/AbstractLogHandler.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace cppassist 8 | { 9 | 10 | 11 | AbstractLogHandler::AbstractLogHandler() 12 | { 13 | } 14 | 15 | AbstractLogHandler::~AbstractLogHandler() 16 | { 17 | } 18 | 19 | std::string AbstractLogHandler::messagePrefix(const LogMessage & message) 20 | { 21 | std::string prefix = levelString(message.level()); 22 | 23 | if (!message.context().empty()) 24 | { 25 | if (!prefix.empty()) 26 | prefix = prefix + " "; 27 | 28 | prefix = prefix + "[" + message.context() + "]"; 29 | } 30 | 31 | if (prefix.empty()) 32 | return prefix; 33 | 34 | return prefix + ": "; 35 | } 36 | 37 | std::string AbstractLogHandler::levelString(int level) 38 | { 39 | if (level == LogMessage::Critical) return "#critical"; 40 | else if (level == LogMessage::Error) return "#error"; 41 | else if (level == LogMessage::Warning) return "#warning"; 42 | else if (level >= LogMessage::Debug) return "#debug"; 43 | else return ""; 44 | } 45 | 46 | 47 | } // namespace cppassist 48 | -------------------------------------------------------------------------------- /source/cppassist/source/logging/ConsoleLogHandler.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace cppassist 8 | { 9 | 10 | 11 | void ConsoleLogHandler::handle(const LogMessage & message) 12 | { 13 | // For critical, error, and warning level 14 | if (message.level() < LogMessage::Info) 15 | std::cerr << messagePrefix(message) << message.message() << std::endl; 16 | else 17 | std::cout << messagePrefix(message) << message.message() << std::endl; 18 | } 19 | 20 | 21 | } // namespace cppassist 22 | -------------------------------------------------------------------------------- /source/cppassist/source/logging/FileLogHandler.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | 7 | namespace cppassist 8 | { 9 | 10 | 11 | FileLogHandler::FileLogHandler(const std::string & logfile) 12 | : m_logfile(logfile) 13 | { 14 | } 15 | 16 | void FileLogHandler::handle(const LogMessage & message) 17 | { 18 | std::ofstream logstream(m_logfile, std::ios_base::out | std::ios_base::app ); 19 | 20 | logstream << messagePrefix(message) << message.message() << std::endl; 21 | } 22 | 23 | } // namespace cppassist 24 | -------------------------------------------------------------------------------- /source/cppassist/source/logging/LogMessage.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | namespace cppassist 6 | { 7 | 8 | 9 | LogMessage::LogMessage(int level, const std::string & message, const std::string & context) 10 | : m_level(level) 11 | , m_message(message) 12 | , m_context(context) 13 | { 14 | } 15 | 16 | int LogMessage::level() const 17 | { 18 | return m_level; 19 | } 20 | 21 | const std::string & LogMessage::message() const 22 | { 23 | return m_message; 24 | } 25 | 26 | const std::string & LogMessage::context() const 27 | { 28 | return m_context; 29 | } 30 | 31 | 32 | } // namespace cppassist 33 | -------------------------------------------------------------------------------- /source/cppassist/source/logging/logging.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | 9 | namespace 10 | { 11 | int g_verbosityLevel = cppassist::LogMessage::Info; 12 | cppassist::AbstractLogHandler * g_logHandler = new cppassist::ConsoleLogHandler(); 13 | } 14 | 15 | 16 | namespace cppassist 17 | { 18 | 19 | 20 | AbstractLogHandler * loggingHandler() 21 | { 22 | return g_logHandler; 23 | } 24 | 25 | void setLoggingHandler(AbstractLogHandler * handler) 26 | { 27 | delete g_logHandler; 28 | g_logHandler = handler; 29 | } 30 | 31 | int verbosityLevel() 32 | { 33 | return g_verbosityLevel; 34 | } 35 | 36 | void setVerbosityLevel(int verbosity) 37 | { 38 | g_verbosityLevel = verbosity; 39 | } 40 | 41 | LogMessageBuilder log(int level, const std::string & context) 42 | { 43 | return LogMessageBuilder(level, level <= g_verbosityLevel ? g_logHandler : nullptr, context); 44 | } 45 | 46 | LogMessageBuilder critical(const std::string & context) 47 | { 48 | return log(LogMessage::Critical, context); 49 | } 50 | 51 | LogMessageBuilder error(const std::string & context) 52 | { 53 | return log(LogMessage::Error, context); 54 | } 55 | 56 | LogMessageBuilder warning(const std::string & context) 57 | { 58 | return log(LogMessage::Warning, context); 59 | } 60 | 61 | LogMessageBuilder info(const std::string & context) 62 | { 63 | return log(LogMessage::Info, context); 64 | } 65 | 66 | LogMessageBuilder debug(const std::string & context) 67 | { 68 | return log(LogMessage::Debug, context); 69 | } 70 | 71 | LogMessageBuilder debug(unsigned int debugLevel, const std::string & context) 72 | { 73 | return log(LogMessage::Debug + debugLevel, context); 74 | } 75 | 76 | 77 | } // namespace cppassist 78 | -------------------------------------------------------------------------------- /source/cppassist/source/string/processing.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | #include 7 | 8 | 9 | namespace cppassist 10 | { 11 | namespace string 12 | { 13 | 14 | 15 | void parseLine(const std::string & line, const std::string::size_type start_pos, const char delimiter, const char escapeCharacter, std::function callback) 16 | { 17 | if (start_pos == std::string::npos) 18 | { 19 | // No rest of line 20 | return; 21 | } 22 | 23 | int i = 0; 24 | auto last_pos = start_pos; 25 | 26 | // bool hasEscapeCharacter = line.find(escapeCharacter, last_pos); 27 | 28 | for (auto current_pos = line.find(delimiter, last_pos); 29 | current_pos != std::string::npos; 30 | current_pos = line.find(delimiter, last_pos)) 31 | { 32 | // escaped string 33 | if (line.at(last_pos) == escapeCharacter) 34 | { 35 | // find correct closing escape character 36 | if (line.at(current_pos - 1) != escapeCharacter) 37 | { 38 | current_pos = line.find(escapeCharacter, current_pos); 39 | 40 | assert(current_pos == line.size() - 1 || line.at(current_pos+1) == delimiter); 41 | } 42 | 43 | callback(cppassist::string::trim(line.substr(last_pos + 1, current_pos - last_pos - 1)), i); 44 | 45 | last_pos = current_pos + 1 + 1; 46 | ++i; 47 | } 48 | else 49 | { 50 | callback(cppassist::string::trim(line.substr(last_pos, current_pos - last_pos)), i); 51 | 52 | last_pos = current_pos + 1; 53 | ++i; 54 | } 55 | } 56 | 57 | callback(cppassist::string::trim(line.substr(last_pos)), i); 58 | } 59 | 60 | 61 | } // namespace string 62 | } // namespace cppassist 63 | -------------------------------------------------------------------------------- /source/cppassist/source/string/regex.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #ifdef USE_STD_REGEX 5 | #include 6 | 7 | namespace regex_namespace = std; 8 | #else 9 | #include 10 | 11 | namespace regex_namespace = boost; 12 | #endif 13 | 14 | 15 | namespace cppassist 16 | { 17 | namespace string 18 | { 19 | 20 | 21 | bool matchesRegex(const std::string & string, const std::string & regex) 22 | { 23 | return regex_namespace::regex_match(string, regex_namespace::regex(regex)); 24 | } 25 | 26 | std::vector extract(const std::string & string, const std::string & regex) 27 | { 28 | std::vector values; 29 | 30 | regex_namespace::smatch matchResults; 31 | const regex_namespace::regex r(regex); 32 | 33 | std::string s = string; 34 | while (regex_namespace::regex_search(s, matchResults, r)) 35 | { 36 | values.push_back(matchResults[0]); 37 | s = matchResults.suffix().str(); 38 | } 39 | 40 | return values; 41 | } 42 | 43 | std::string::const_iterator extractNext(std::string::const_iterator begin, std::string::const_iterator end, const std::string & regex, std::string & match) 44 | { 45 | match.clear(); 46 | 47 | regex_namespace::smatch matchResults; 48 | const regex_namespace::regex r(regex); 49 | 50 | if (!regex_namespace::regex_search(begin, end, matchResults, r)) 51 | { 52 | return begin; 53 | } 54 | 55 | match = matchResults[0]; 56 | 57 | return begin + match.size(); 58 | } 59 | 60 | const char * extractNext(const char * begin, const char * end, const std::string & regex, std::string & match) 61 | { 62 | match.clear(); 63 | 64 | regex_namespace::cmatch matchResults; 65 | const regex_namespace::regex r(regex); 66 | 67 | if (!regex_namespace::regex_search(begin, end, matchResults, r)) 68 | { 69 | return begin; 70 | } 71 | 72 | match = matchResults[0]; 73 | 74 | return begin + match.size(); 75 | } 76 | 77 | 78 | } // namespace string 79 | } // namespace cppassist 80 | -------------------------------------------------------------------------------- /source/cppassist/source/threading/parallelfor.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | namespace cppassist 7 | { 8 | 9 | 10 | size_t getNumberOfThreads() 11 | { 12 | return std::max(static_cast(2), static_cast(std::thread::hardware_concurrency())); 13 | } 14 | 15 | 16 | } // namespace cppassist 17 | -------------------------------------------------------------------------------- /source/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # Check if examples are enabled 3 | if(NOT OPTION_BUILD_EXAMPLES) 4 | return() 5 | endif() 6 | 7 | # Example applications 8 | add_subdirectory(logging) 9 | add_subdirectory(cmdline) 10 | add_subdirectory(cmdline2) 11 | add_subdirectory(simd) 12 | -------------------------------------------------------------------------------- /source/examples/cmdline/ActionCopy.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ActionCopy.h" 3 | 4 | #include 5 | 6 | #include "Program.h" 7 | 8 | 9 | using namespace cppassist; 10 | 11 | 12 | ActionCopy::ActionCopy(Program & program) 13 | : CommandLineAction("cp", "Copy files") 14 | , m_program(program) 15 | , m_commandCopy("cp") 16 | , m_paramSrc("path", CommandLineParameter::NonOptional) 17 | { 18 | m_program.addDefaultOptionsTo(*this); 19 | 20 | setOptionalParametersAllowed(true); 21 | setOptionalParameterName("path"); 22 | 23 | add(&m_commandCopy); 24 | add(&m_paramSrc); 25 | } 26 | 27 | ActionCopy::~ActionCopy() 28 | { 29 | } 30 | 31 | int ActionCopy::execute() 32 | { 33 | // Copy 34 | info() << "Let me copy that for you ..."; 35 | info() << "- " << m_paramSrc.value(); 36 | 37 | for (auto arg : optionalParameters()) 38 | { 39 | info() << "- " << arg; 40 | } 41 | 42 | // Return success 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /source/examples/cmdline/ActionCopy.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | class Program; 11 | 12 | 13 | /** 14 | * @brief 15 | * Command 'cp' 16 | */ 17 | class ActionCopy : public cppassist::CommandLineAction 18 | { 19 | public: 20 | /** 21 | * @brief 22 | * Constructor 23 | * 24 | * @param[in] program 25 | * Main program 26 | */ 27 | ActionCopy(Program & program); 28 | 29 | /** 30 | * @brief 31 | * Destructor 32 | */ 33 | ~ActionCopy(); 34 | 35 | // Virtual cppassist::CommandLineAction functions 36 | virtual int execute() override; 37 | 38 | 39 | protected: 40 | Program & m_program; 41 | cppassist::CommandLineCommand m_commandCopy; 42 | cppassist::CommandLineParameter m_paramSrc; 43 | }; 44 | -------------------------------------------------------------------------------- /source/examples/cmdline/ActionCount.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ActionCount.h" 3 | 4 | #include 5 | 6 | #include "Program.h" 7 | 8 | 9 | using namespace cppassist; 10 | 11 | 12 | ActionCount::ActionCount(Program & program) 13 | : CommandLineAction("count", "Count from one number to another") 14 | , m_program(program) 15 | , m_commandCount("count") 16 | , m_optionStep("--increment-by", "-i", "step", "Number that is added per iteration", CommandLineOption::Optional) 17 | , m_paramFrom("from", CommandLineParameter::NonOptional) 18 | , m_paramTo("to", CommandLineParameter::NonOptional) 19 | { 20 | m_program.addDefaultOptionsTo(*this); 21 | 22 | add(&m_commandCount); 23 | add(&m_optionStep); 24 | add(&m_paramFrom); 25 | add(&m_paramTo); 26 | } 27 | 28 | ActionCount::~ActionCount() 29 | { 30 | } 31 | 32 | int ActionCount::execute() 33 | { 34 | // Count 35 | info() << "Let me count for you ..." << std::endl; 36 | 37 | // Return success 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /source/examples/cmdline/ActionCount.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | class Program; 12 | 13 | 14 | /** 15 | * @brief 16 | * Command 'count' 17 | */ 18 | class ActionCount : public cppassist::CommandLineAction 19 | { 20 | public: 21 | /** 22 | * @brief 23 | * Constructor 24 | * 25 | * @param[in] program 26 | * Main program 27 | */ 28 | ActionCount(Program & program); 29 | 30 | /** 31 | * @brief 32 | * Destructor 33 | */ 34 | ~ActionCount(); 35 | 36 | // Virtual cppassist::CommandLineAction functions 37 | virtual int execute() override; 38 | 39 | 40 | protected: 41 | Program & m_program; 42 | cppassist::CommandLineCommand m_commandCount; 43 | cppassist::CommandLineOption m_optionStep; 44 | cppassist::CommandLineParameter m_paramFrom; 45 | cppassist::CommandLineParameter m_paramTo; 46 | }; 47 | -------------------------------------------------------------------------------- /source/examples/cmdline/ActionHelp.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "ActionHelp.h" 3 | 4 | #include 5 | 6 | #include "Program.h" 7 | 8 | 9 | using namespace cppassist; 10 | 11 | 12 | ActionHelp::ActionHelp(Program & program) 13 | : CommandLineAction("help", "Print help text") 14 | , m_program(program) 15 | , m_switchHelp("--help", "-h", "Print help text", CommandLineSwitch::NonOptional) 16 | , m_paramCommand("command", CommandLineParameter::Optional) 17 | { 18 | m_program.addDefaultOptionsTo(*this); 19 | 20 | add(&m_switchHelp); 21 | add(&m_paramCommand); 22 | } 23 | 24 | ActionHelp::~ActionHelp() 25 | { 26 | } 27 | 28 | int ActionHelp::execute() 29 | { 30 | CommandLineAction * forAction = nullptr; 31 | 32 | if (!m_paramCommand.value().empty()) 33 | { 34 | forAction = m_program.getAction(m_paramCommand.value()); 35 | } 36 | 37 | m_program.print(m_program.help(forAction)); 38 | 39 | // Return success 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /source/examples/cmdline/ActionHelp.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | #include 8 | 9 | 10 | class Program; 11 | 12 | 13 | /** 14 | * @brief 15 | * Command 'help' 16 | */ 17 | class ActionHelp : public cppassist::CommandLineAction 18 | { 19 | public: 20 | /** 21 | * @brief 22 | * Constructor 23 | * 24 | * @param[in] program 25 | * Main program 26 | */ 27 | ActionHelp(Program & program); 28 | 29 | /** 30 | * @brief 31 | * Destructor 32 | */ 33 | ~ActionHelp(); 34 | 35 | // Virtual cppassist::CommandLineAction functions 36 | virtual int execute() override; 37 | 38 | 39 | protected: 40 | Program & m_program; 41 | cppassist::CommandLineSwitch m_switchHelp; 42 | cppassist::CommandLineParameter m_paramCommand; 43 | }; 44 | -------------------------------------------------------------------------------- /source/examples/cmdline/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # External dependencies 4 | # 5 | 6 | 7 | # 8 | # Executable name and options 9 | # 10 | 11 | # Target name 12 | set(target cmdline-example) 13 | 14 | # Exit here if required dependencies are not met 15 | message(STATUS "Example ${target}") 16 | 17 | 18 | # 19 | # Sources 20 | # 21 | 22 | set(sources 23 | main.cpp 24 | Program.cpp 25 | Program.h 26 | ActionHelp.cpp 27 | ActionHelp.h 28 | ActionCount.cpp 29 | ActionCount.h 30 | ActionCopy.cpp 31 | ActionCopy.h 32 | ) 33 | 34 | 35 | # 36 | # Create executable 37 | # 38 | 39 | # Build executable 40 | add_executable(${target} 41 | MACOSX_BUNDLE 42 | ${sources} 43 | ) 44 | 45 | # Create namespaced alias 46 | add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target}) 47 | 48 | 49 | # 50 | # Project options 51 | # 52 | 53 | set_target_properties(${target} 54 | PROPERTIES 55 | ${DEFAULT_PROJECT_OPTIONS} 56 | FOLDER "${IDE_FOLDER}" 57 | ) 58 | 59 | 60 | # 61 | # Include directories 62 | # 63 | 64 | target_include_directories(${target} 65 | PRIVATE 66 | ${DEFAULT_INCLUDE_DIRECTORIES} 67 | ${CMAKE_CURRENT_SOURCE_DIR} 68 | ${PROJECT_BINARY_DIR}/source/include 69 | ) 70 | 71 | 72 | # 73 | # Libraries 74 | # 75 | 76 | target_link_libraries(${target} 77 | PRIVATE 78 | ${DEFAULT_LIBRARIES} 79 | ${META_PROJECT_NAME}::cppassist 80 | ) 81 | 82 | 83 | # 84 | # Compile definitions 85 | # 86 | 87 | target_compile_definitions(${target} 88 | PRIVATE 89 | ${DEFAULT_COMPILE_DEFINITIONS} 90 | ) 91 | 92 | 93 | # 94 | # Compile options 95 | # 96 | 97 | target_compile_options(${target} 98 | PRIVATE 99 | ${DEFAULT_COMPILE_OPTIONS} 100 | ) 101 | 102 | 103 | # 104 | # Linker options 105 | # 106 | 107 | target_link_libraries(${target} 108 | PRIVATE 109 | ${DEFAULT_LINKER_OPTIONS} 110 | ) 111 | 112 | 113 | # 114 | # Target Health 115 | # 116 | 117 | perform_health_checks( 118 | ${target} 119 | ${sources} 120 | ) 121 | 122 | 123 | # 124 | # Deployment 125 | # 126 | 127 | # Executable 128 | install(TARGETS ${target} 129 | RUNTIME DESTINATION ${INSTALL_BIN} COMPONENT examples 130 | BUNDLE DESTINATION ${INSTALL_BIN} COMPONENT examples 131 | ) 132 | -------------------------------------------------------------------------------- /source/examples/cmdline/Program.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Program.h" 3 | 4 | #include 5 | 6 | #include 7 | 8 | 9 | using namespace cppassist; 10 | 11 | 12 | Program::Program() 13 | : CommandLineProgram( 14 | "cmdline-example", 15 | "cmdline-example " CPPASSIST_VERSION, 16 | "cmdline-example demonstrates how to parse (complex) command line options using the CommandLineProgram class in cppassist.") 17 | , m_switchVerbose("--verbose", "-v", "Make output more verbose") 18 | , m_actionHelp(*this) 19 | , m_actionCount(*this) 20 | , m_actionCopy(*this) 21 | { 22 | add(&m_actionHelp); 23 | add(&m_actionCount); 24 | add(&m_actionCopy); 25 | } 26 | 27 | Program::~Program() 28 | { 29 | } 30 | 31 | void Program::addDefaultOptionsTo(CommandLineAction & action) 32 | { 33 | action.add(&m_switchVerbose); 34 | } 35 | 36 | int Program::executeAction(CommandLineAction * action) 37 | { 38 | // Set log level 39 | int logLevel = LogMessage::Info; 40 | 41 | if (m_switchVerbose.activated()) 42 | { 43 | logLevel += m_switchVerbose.count(); 44 | } 45 | 46 | setVerbosityLevel(logLevel); 47 | 48 | // Display verbosity level 49 | info() << "Verbosity level: " << m_switchVerbose.count() << std::endl; 50 | 51 | // Call action 52 | if (action) 53 | { 54 | return action->execute(); 55 | } 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /source/examples/cmdline/Program.h: -------------------------------------------------------------------------------- 1 | 2 | #pragma once 3 | 4 | 5 | #include 6 | #include 7 | 8 | #include "ActionHelp.h" 9 | #include "ActionCount.h" 10 | #include "ActionCopy.h" 11 | 12 | 13 | /** 14 | * @brief 15 | * Main program interface 16 | */ 17 | class Program : public cppassist::CommandLineProgram 18 | { 19 | public: 20 | /** 21 | * @brief 22 | * Constructor 23 | */ 24 | Program(); 25 | 26 | /** 27 | * @brief 28 | * Destructor 29 | */ 30 | ~Program(); 31 | 32 | /** 33 | * @brief 34 | * Add default options to a program action 35 | * 36 | * @param[in] action 37 | * Command line action 38 | */ 39 | void addDefaultOptionsTo(cppassist::CommandLineAction & action); 40 | 41 | // Virtual cppassist::CommandLineProgram functions 42 | virtual int executeAction(cppassist::CommandLineAction * action) override; 43 | 44 | 45 | public: 46 | // Global options 47 | cppassist::CommandLineSwitch m_switchVerbose; 48 | 49 | // Actions 50 | ActionHelp m_actionHelp; 51 | ActionCount m_actionCount; 52 | ActionCopy m_actionCopy; 53 | }; 54 | -------------------------------------------------------------------------------- /source/examples/cmdline/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include "Program.h" 3 | 4 | 5 | int main(int argc, char * argv[]) 6 | { 7 | Program program; 8 | return program.execute(argc, argv); 9 | } 10 | -------------------------------------------------------------------------------- /source/examples/cmdline2/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # External dependencies 4 | # 5 | 6 | 7 | # 8 | # Executable name and options 9 | # 10 | 11 | # Target name 12 | set(target cmdline-example2) 13 | 14 | # Exit here if required dependencies are not met 15 | message(STATUS "Example ${target}") 16 | 17 | 18 | # 19 | # Sources 20 | # 21 | 22 | set(sources 23 | main.cpp 24 | ) 25 | 26 | 27 | # 28 | # Create executable 29 | # 30 | 31 | # Build executable 32 | add_executable(${target} 33 | MACOSX_BUNDLE 34 | ${sources} 35 | ) 36 | 37 | # Create namespaced alias 38 | add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target}) 39 | 40 | 41 | # 42 | # Project options 43 | # 44 | 45 | set_target_properties(${target} 46 | PROPERTIES 47 | ${DEFAULT_PROJECT_OPTIONS} 48 | FOLDER "${IDE_FOLDER}" 49 | ) 50 | 51 | 52 | # 53 | # Include directories 54 | # 55 | 56 | target_include_directories(${target} 57 | PRIVATE 58 | ${DEFAULT_INCLUDE_DIRECTORIES} 59 | ${CMAKE_CURRENT_SOURCE_DIR} 60 | ${PROJECT_BINARY_DIR}/source/include 61 | ) 62 | 63 | 64 | # 65 | # Libraries 66 | # 67 | 68 | target_link_libraries(${target} 69 | PRIVATE 70 | ${DEFAULT_LIBRARIES} 71 | ${META_PROJECT_NAME}::cppassist 72 | ) 73 | 74 | 75 | # 76 | # Compile definitions 77 | # 78 | 79 | target_compile_definitions(${target} 80 | PRIVATE 81 | ${DEFAULT_COMPILE_DEFINITIONS} 82 | ) 83 | 84 | 85 | # 86 | # Compile options 87 | # 88 | 89 | target_compile_options(${target} 90 | PRIVATE 91 | ${DEFAULT_COMPILE_OPTIONS} 92 | ) 93 | 94 | 95 | # 96 | # Linker options 97 | # 98 | 99 | target_link_libraries(${target} 100 | PRIVATE 101 | ${DEFAULT_LINKER_OPTIONS} 102 | ) 103 | 104 | 105 | # 106 | # Target Health 107 | # 108 | 109 | perform_health_checks( 110 | ${target} 111 | ${sources} 112 | ) 113 | 114 | 115 | # 116 | # Deployment 117 | # 118 | 119 | # Executable 120 | install(TARGETS ${target} 121 | RUNTIME DESTINATION ${INSTALL_BIN} COMPONENT examples 122 | BUNDLE DESTINATION ${INSTALL_BIN} COMPONENT examples 123 | ) 124 | -------------------------------------------------------------------------------- /source/examples/logging/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # External dependencies 4 | # 5 | 6 | 7 | # 8 | # Executable name and options 9 | # 10 | 11 | # Target name 12 | set(target logging-example) 13 | 14 | # Exit here if required dependencies are not met 15 | message(STATUS "Example ${target}") 16 | 17 | 18 | # 19 | # Sources 20 | # 21 | 22 | set(sources 23 | main.cpp 24 | ) 25 | 26 | 27 | # 28 | # Create executable 29 | # 30 | 31 | # Build executable 32 | add_executable(${target} 33 | MACOSX_BUNDLE 34 | ${sources} 35 | ) 36 | 37 | # Create namespaced alias 38 | add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target}) 39 | 40 | 41 | # 42 | # Project options 43 | # 44 | 45 | set_target_properties(${target} 46 | PROPERTIES 47 | ${DEFAULT_PROJECT_OPTIONS} 48 | FOLDER "${IDE_FOLDER}" 49 | ) 50 | 51 | 52 | # 53 | # Include directories 54 | # 55 | 56 | target_include_directories(${target} 57 | PRIVATE 58 | ${DEFAULT_INCLUDE_DIRECTORIES} 59 | ${CMAKE_CURRENT_SOURCE_DIR} 60 | ${PROJECT_BINARY_DIR}/source/include 61 | ) 62 | 63 | 64 | # 65 | # Libraries 66 | # 67 | 68 | target_link_libraries(${target} 69 | PRIVATE 70 | ${DEFAULT_LIBRARIES} 71 | ${META_PROJECT_NAME}::cppassist 72 | ) 73 | 74 | 75 | # 76 | # Compile definitions 77 | # 78 | 79 | target_compile_definitions(${target} 80 | PRIVATE 81 | ${DEFAULT_COMPILE_DEFINITIONS} 82 | ) 83 | 84 | 85 | # 86 | # Compile options 87 | # 88 | 89 | target_compile_options(${target} 90 | PRIVATE 91 | ${DEFAULT_COMPILE_OPTIONS} 92 | ) 93 | 94 | 95 | # 96 | # Linker options 97 | # 98 | 99 | target_link_libraries(${target} 100 | PRIVATE 101 | ${DEFAULT_LINKER_OPTIONS} 102 | ) 103 | 104 | 105 | # 106 | # Target Health 107 | # 108 | 109 | perform_health_checks( 110 | ${target} 111 | ${sources} 112 | ) 113 | 114 | 115 | # 116 | # Deployment 117 | # 118 | 119 | # Executable 120 | install(TARGETS ${target} 121 | RUNTIME DESTINATION ${INSTALL_BIN} COMPONENT examples 122 | BUNDLE DESTINATION ${INSTALL_BIN} COMPONENT examples 123 | ) 124 | -------------------------------------------------------------------------------- /source/examples/logging/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | using namespace cppassist; 6 | 7 | 8 | int main(int, char * []) 9 | { 10 | setVerbosityLevel(LogMessage::Debug + 2); 11 | 12 | critical() << "A normal critical message."; 13 | error() << "A normal error message."; 14 | warning() << "A normal warning message."; 15 | info() << "A normal info message."; 16 | debug() << "A normal debug message."; 17 | debug(1) << "Another debug message."; 18 | 19 | info("A") << "Info message from context A"; 20 | warning("B") << "Warning from context B"; 21 | critical("C") << "Critical message from context C"; 22 | 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /source/examples/simd/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # External dependencies 4 | # 5 | 6 | 7 | # 8 | # Executable name and options 9 | # 10 | 11 | # Target name 12 | set(target simd-example) 13 | 14 | # Exit here if required dependencies are not met 15 | message(STATUS "Example ${target}") 16 | 17 | 18 | # 19 | # Sources 20 | # 21 | 22 | set(sources 23 | main.cpp 24 | ) 25 | 26 | 27 | # 28 | # Create executable 29 | # 30 | 31 | # Build executable 32 | add_executable(${target} 33 | ${sources} 34 | ) 35 | 36 | # Create namespaced alias 37 | add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target}) 38 | 39 | 40 | # 41 | # Project options 42 | # 43 | 44 | set_target_properties(${target} 45 | PROPERTIES 46 | ${DEFAULT_PROJECT_OPTIONS} 47 | FOLDER "${IDE_FOLDER}" 48 | ) 49 | 50 | 51 | # 52 | # Include directories 53 | # 54 | 55 | target_include_directories(${target} 56 | PRIVATE 57 | ${DEFAULT_INCLUDE_DIRECTORIES} 58 | ${CMAKE_CURRENT_SOURCE_DIR} 59 | ${PROJECT_BINARY_DIR}/source/include 60 | ) 61 | 62 | 63 | # 64 | # Libraries 65 | # 66 | 67 | target_link_libraries(${target} 68 | PRIVATE 69 | ${DEFAULT_LIBRARIES} 70 | ${META_PROJECT_NAME}::cppassist 71 | ) 72 | 73 | 74 | # 75 | # Compile definitions 76 | # 77 | 78 | target_compile_definitions(${target} 79 | PRIVATE 80 | ${DEFAULT_COMPILE_DEFINITIONS} 81 | SSE_ENABLED 82 | ) 83 | 84 | 85 | # 86 | # Compile options 87 | # 88 | 89 | target_compile_options(${target} 90 | PRIVATE 91 | ${DEFAULT_COMPILE_OPTIONS} 92 | ) 93 | 94 | 95 | # 96 | # Linker options 97 | # 98 | 99 | target_link_libraries(${target} 100 | PRIVATE 101 | ${DEFAULT_LINKER_OPTIONS} 102 | ) 103 | 104 | 105 | # 106 | # Target Health 107 | # 108 | 109 | perform_health_checks( 110 | ${target} 111 | ${sources} 112 | ) 113 | 114 | 115 | # 116 | # Deployment 117 | # 118 | 119 | # Executable 120 | install(TARGETS ${target} 121 | RUNTIME DESTINATION ${INSTALL_BIN} COMPONENT examples 122 | BUNDLE DESTINATION ${INSTALL_BIN} COMPONENT examples 123 | ) 124 | -------------------------------------------------------------------------------- /source/examples/simd/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | int main(int /*argc*/, char* /*argv*/[]) 13 | { 14 | static const auto valueSize = 512ull * 512ull * 512ull * 8ull; // 4GB of consecutive data 15 | 16 | cppassist::vector values1(valueSize); 17 | cppassist::vector values2(valueSize); 18 | std::fill(values1.valueBegin(), values1.valueEnd(), 2.0f); 19 | std::fill(values2.valueBegin(), values2.valueEnd(), 4.0f); 20 | 21 | std::cout << "Start measuring" << std::endl; 22 | 23 | const auto start = std::chrono::high_resolution_clock::now(); 24 | 25 | cppassist::traverse_mt([](const cppassist::vector::value_type & chunk1, cppassist::vector::value_type & chunk2) 26 | { 27 | chunk2 = sqrt((sqrt(chunk1) * sqrt(chunk2) + 12.0f) * 0.125f + 5.0f); 28 | }, values1, values2); 29 | 30 | const auto end = std::chrono::high_resolution_clock::now(); 31 | 32 | std::cout << " End measuring: " << std::chrono::duration_cast(end - start).count() << "ms" << std::endl; 33 | 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /source/tests/cppassist-test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # External dependencies 4 | # 5 | 6 | find_package(${META_PROJECT_NAME} REQUIRED HINTS "${CMAKE_CURRENT_SOURCE_DIR}/../../../") 7 | 8 | 9 | # 10 | # Executable name and options 11 | # 12 | 13 | # Target name 14 | set(target cppassist-test) 15 | message(STATUS "Test ${target}") 16 | 17 | 18 | # 19 | # Sources 20 | # 21 | 22 | set(sources 23 | main.cpp 24 | 25 | # threading 26 | parallel_for_test.cpp 27 | 28 | # string 29 | manipulation_test.cpp 30 | conversion_test.cpp 31 | processing_test.cpp 32 | 33 | # error 34 | error_test.cpp 35 | 36 | # flags 37 | flags_test.cpp 38 | 39 | # typelist 40 | typelist_test.cpp 41 | 42 | # memory 43 | make_unique_test.cpp 44 | ) 45 | 46 | 47 | # 48 | # Create executable 49 | # 50 | 51 | # Build executable 52 | add_executable(${target} 53 | ${sources} 54 | ) 55 | 56 | # Create namespaced alias 57 | add_executable(${META_PROJECT_NAME}::${target} ALIAS ${target}) 58 | 59 | 60 | # 61 | # Project options 62 | # 63 | 64 | set_target_properties(${target} 65 | PROPERTIES 66 | ${DEFAULT_PROJECT_OPTIONS} 67 | FOLDER "${IDE_FOLDER}" 68 | ) 69 | 70 | 71 | # 72 | # Include directories 73 | # 74 | 75 | target_include_directories(${target} 76 | PRIVATE 77 | ${DEFAULT_INCLUDE_DIRECTORIES} 78 | ${PROJECT_BINARY_DIR}/source/include 79 | ) 80 | 81 | 82 | # 83 | # Libraries 84 | # 85 | 86 | target_link_libraries(${target} 87 | PRIVATE 88 | ${DEFAULT_LIBRARIES} 89 | ${META_PROJECT_NAME}::cppassist 90 | gmock-dev 91 | ) 92 | 93 | 94 | # 95 | # Compile definitions 96 | # 97 | 98 | target_compile_definitions(${target} 99 | PRIVATE 100 | ${DEFAULT_COMPILE_DEFINITIONS} 101 | ) 102 | 103 | 104 | # 105 | # Compile options 106 | # 107 | 108 | target_compile_options(${target} 109 | PRIVATE 110 | ${DEFAULT_COMPILE_OPTIONS} 111 | ) 112 | 113 | 114 | # 115 | # Linker options 116 | # 117 | 118 | target_link_libraries(${target} 119 | PRIVATE 120 | ${DEFAULT_LINKER_OPTIONS} 121 | ) 122 | -------------------------------------------------------------------------------- /source/tests/cppassist-test/error_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | #include 6 | 7 | 8 | using namespace cppassist; 9 | 10 | 11 | // This is really more a compilation test 12 | 13 | 14 | class error_test : public testing::Test 15 | { 16 | public: 17 | error_test() 18 | { 19 | } 20 | 21 | cppassist::Result checkForValidity(bool check) 22 | { 23 | if (check) 24 | { 25 | return cppassist::ok(); 26 | } 27 | else 28 | { 29 | return cppassist::error("Invalid"); 30 | } 31 | } 32 | 33 | cppassist::Result faculty(int n) 34 | { 35 | if (n < 0 || n > 20) 36 | { 37 | return cppassist::error("n out of range"); 38 | } 39 | 40 | if (n < 2) 41 | { 42 | return n; 43 | } 44 | 45 | std::int64_t result = 1; 46 | while (n > 1) 47 | { 48 | result *= n; 49 | --n; 50 | } 51 | 52 | return result; 53 | } 54 | }; 55 | 56 | 57 | TEST_F(error_test, Success) 58 | { 59 | const auto result = checkForValidity(true); 60 | 61 | ASSERT_TRUE(result.isValid()); 62 | } 63 | 64 | TEST_F(error_test, Result) 65 | { 66 | const auto result = faculty(4); 67 | 68 | ASSERT_TRUE(result.isValid()); 69 | ASSERT_EQ(24, result.value()); 70 | } 71 | 72 | 73 | TEST_F(error_test, Failure) 74 | { 75 | const auto result = checkForValidity(false); 76 | 77 | ASSERT_FALSE(result.isValid()); 78 | ASSERT_NE("", result.error().message()); 79 | } 80 | 81 | TEST_F(error_test, Error) 82 | { 83 | const auto result = faculty(30); 84 | 85 | ASSERT_FALSE(result.isValid()); 86 | ASSERT_NE("", result.error().message()); 87 | } 88 | -------------------------------------------------------------------------------- /source/tests/cppassist-test/flags_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | // This is really more a compilation test 7 | 8 | 9 | class flags_test : public testing::Test 10 | { 11 | public: 12 | flags_test() 13 | { 14 | } 15 | }; 16 | 17 | enum class MyEnum : unsigned int { 18 | Value1 = 1, 19 | Value2 = 2, 20 | Value3 = 4 21 | }; 22 | 23 | 24 | TEST_F(flags_test, EmptyFlags) 25 | { 26 | auto f = cppassist::Flags(); 27 | 28 | ASSERT_FALSE(f); 29 | } 30 | 31 | TEST_F(flags_test, SingleFlags) 32 | { 33 | auto f = cppassist::Flags(MyEnum::Value1); 34 | 35 | ASSERT_TRUE(f); 36 | } 37 | 38 | TEST_F(flags_test, MultipleFlags) 39 | { 40 | auto f = cppassist::Flags({ MyEnum::Value1, MyEnum::Value2 }); 41 | 42 | ASSERT_TRUE(f); 43 | } 44 | 45 | TEST_F(flags_test, FlagsOr) 46 | { 47 | auto f = cppassist::makeFlags(MyEnum::Value1) | MyEnum::Value2; 48 | 49 | ASSERT_TRUE(f); 50 | } 51 | 52 | TEST_F(flags_test, MultipleFlagsOr) 53 | { 54 | auto f = cppassist::makeFlags(MyEnum::Value1) | MyEnum::Value2 | MyEnum::Value3; 55 | 56 | ASSERT_TRUE(f); 57 | } 58 | 59 | TEST_F(flags_test, FlagsAnd) 60 | { 61 | auto f = cppassist::makeFlags(MyEnum::Value1) & MyEnum::Value2; 62 | 63 | ASSERT_FALSE(f); 64 | } 65 | 66 | TEST_F(flags_test, MultipleFlagsAnd) 67 | { 68 | auto f = cppassist::makeFlags(MyEnum::Value1) & MyEnum::Value2 & MyEnum::Value3; 69 | 70 | ASSERT_FALSE(f); 71 | } 72 | 73 | TEST_F(flags_test, FlagsXor) 74 | { 75 | auto f = cppassist::makeFlags(MyEnum::Value1) ^ MyEnum::Value2; 76 | 77 | ASSERT_TRUE(f); 78 | } 79 | 80 | TEST_F(flags_test, MultipleFlagsXor) 81 | { 82 | auto f = cppassist::makeFlags(MyEnum::Value1) ^ MyEnum::Value2 ^ MyEnum::Value3; 83 | 84 | ASSERT_TRUE(f); 85 | } 86 | 87 | TEST_F(flags_test, BooleanContext) 88 | { 89 | auto f = cppassist::makeFlags(MyEnum::Value1) | MyEnum::Value2; 90 | 91 | if (f & MyEnum::Value1) 92 | { 93 | SUCCEED(); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /source/tests/cppassist-test/main.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | 5 | int main(int argc, char * argv[]) 6 | { 7 | ::testing::InitGoogleMock(&argc, argv); 8 | return RUN_ALL_TESTS(); 9 | } 10 | -------------------------------------------------------------------------------- /source/tests/cppassist-test/make_unique_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | 7 | using namespace cppassist; 8 | 9 | 10 | // This is really more a compilation test 11 | 12 | 13 | class make_unique_test : public testing::Test 14 | { 15 | public: 16 | make_unique_test() 17 | { 18 | } 19 | }; 20 | 21 | 22 | TEST_F(make_unique_test, Single) 23 | { 24 | auto i = make_unique(6); 25 | auto s = make_unique(5, 'x'); 26 | 27 | ASSERT_NE(nullptr, i); 28 | ASSERT_NE(nullptr, s); 29 | EXPECT_EQ(6, *i); 30 | EXPECT_EQ("xxxxx", *s); 31 | } 32 | 33 | 34 | TEST_F(make_unique_test, Array) 35 | { 36 | auto i = make_unique(6); 37 | 38 | ASSERT_NE(nullptr, i); 39 | } 40 | -------------------------------------------------------------------------------- /source/tests/cppassist-test/processing_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | 7 | using namespace cppassist; 8 | 9 | 10 | class processing_test : public testing::Test 11 | { 12 | public: 13 | processing_test() 14 | { 15 | } 16 | }; 17 | 18 | 19 | TEST_F(processing_test, parseLine) 20 | { 21 | const auto s = std::string("This;is;a;semi-colon;separated;string"); 22 | auto callCount = std::uint16_t(0); 23 | 24 | cppassist::string::parseLine(s, 0, ';', '"', [& callCount](std::string && part, std::uint32_t index) { 25 | callCount++; 26 | 27 | ASSERT_GT(6, index); 28 | ASSERT_NE(std::string(""), part); 29 | }); 30 | 31 | ASSERT_EQ(callCount, 6); 32 | } 33 | 34 | TEST_F(processing_test, parseLine_startPos) 35 | { 36 | const auto s = std::string("This;is;a;semi-colon;separated;string"); 37 | auto callCount = std::uint16_t(0); 38 | 39 | cppassist::string::parseLine(s, 12, ';', '"', [& callCount](std::string && part, std::uint32_t index) { 40 | callCount++; 41 | 42 | ASSERT_GT(3, index); 43 | ASSERT_NE(std::string(""), part); 44 | }); 45 | 46 | ASSERT_EQ(callCount, 3); 47 | } 48 | 49 | TEST_F(processing_test, parseLine_escaped) 50 | { 51 | const auto s = std::string("This;is;a;\"semi-colon;separated\";string"); 52 | auto callCount = std::uint16_t(0); 53 | auto anyWithSemicolon = false; 54 | 55 | cppassist::string::parseLine(s, 0, ';', '"', [& callCount, & anyWithSemicolon](std::string && part, std::uint32_t index) { 56 | callCount++; 57 | 58 | ASSERT_GT(5, index); 59 | ASSERT_NE(std::string(""), part); 60 | 61 | anyWithSemicolon |= part.find(';') != std::string::npos; 62 | }); 63 | 64 | ASSERT_EQ(callCount, 5); 65 | ASSERT_TRUE(anyWithSemicolon); 66 | } 67 | -------------------------------------------------------------------------------- /source/tests/cppassist-test/typelist_test.cpp: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include 5 | 6 | 7 | class typelist_test : public testing::Test 8 | { 9 | public: 10 | typelist_test() 11 | : intCallcount(0) 12 | , floatCallcount(0) 13 | , boolCallcount(0) 14 | { 15 | } 16 | 17 | template 18 | void invoke() 19 | { 20 | if (typeid(T) == typeid(int)) 21 | { 22 | ++intCallcount; 23 | } 24 | 25 | if (typeid(T) == typeid(float)) 26 | { 27 | ++floatCallcount; 28 | } 29 | 30 | if (typeid(T) == typeid(bool)) 31 | { 32 | ++boolCallcount; 33 | } 34 | } 35 | protected: 36 | int intCallcount; 37 | int floatCallcount; 38 | int boolCallcount; 39 | }; 40 | 41 | 42 | TEST_F(typelist_test, ListApply) 43 | { 44 | using list = cppassist::TypeList; 45 | 46 | list::apply(*this); 47 | 48 | ASSERT_EQ(intCallcount, 1); 49 | ASSERT_EQ(floatCallcount, 1); 50 | ASSERT_EQ(boolCallcount, 1); 51 | } 52 | -------------------------------------------------------------------------------- /source/tests/googletest/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore CI build directory 2 | build/ 3 | xcuserdata 4 | cmake-build-debug/ 5 | .idea/ 6 | bazel-bin 7 | bazel-genfiles 8 | bazel-googletest 9 | bazel-out 10 | bazel-testlogs 11 | # python 12 | *.pyc 13 | 14 | # Visual Studio files 15 | *.sdf 16 | *.opensdf 17 | *.VC.opendb 18 | *.suo 19 | *.user 20 | _ReSharper.Caches/ 21 | Win32-Debug/ 22 | Win32-Release/ 23 | x64-Debug/ 24 | x64-Release/ 25 | -------------------------------------------------------------------------------- /source/tests/googletest/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Note: CMake support is community-based. The maintainers do not use CMake 2 | # internally. 3 | 4 | cmake_minimum_required(VERSION 2.8.8) 5 | 6 | if (POLICY CMP0048) 7 | cmake_policy(SET CMP0048 NEW) 8 | endif (POLICY CMP0048) 9 | 10 | project(googletest-distribution) 11 | set(GOOGLETEST_VERSION 1.10.0) 12 | 13 | if (CMAKE_VERSION VERSION_LESS "3.1") 14 | add_definitions(-std=c++11) 15 | else() 16 | set(CMAKE_CXX_STANDARD 11) 17 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 18 | if(NOT CYGWIN) 19 | set(CMAKE_CXX_EXTENSIONS OFF) 20 | endif() 21 | endif() 22 | 23 | enable_testing() 24 | 25 | include(CMakeDependentOption) 26 | include(GNUInstallDirs) 27 | 28 | #Note that googlemock target already builds googletest 29 | option(BUILD_GMOCK "Builds the googlemock subproject" ON) 30 | option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON) 31 | 32 | if(BUILD_GMOCK) 33 | add_subdirectory( googlemock ) 34 | else() 35 | add_subdirectory( googletest ) 36 | endif() 37 | -------------------------------------------------------------------------------- /source/tests/googletest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /source/tests/googletest/WORKSPACE: -------------------------------------------------------------------------------- 1 | workspace(name = "com_google_googletest") 2 | 3 | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 4 | 5 | # Abseil 6 | http_archive( 7 | name = "com_google_absl", 8 | urls = ["https://github.com/abseil/abseil-cpp/archive/master.zip"], 9 | strip_prefix = "abseil-cpp-master", 10 | ) 11 | 12 | http_archive( 13 | name = "rules_cc", 14 | strip_prefix = "rules_cc-master", 15 | urls = ["https://github.com/bazelbuild/rules_cc/archive/master.zip"], 16 | ) 17 | 18 | http_archive( 19 | name = "rules_python", 20 | strip_prefix = "rules_python-master", 21 | urls = ["https://github.com/bazelbuild/rules_python/archive/master.zip"], 22 | ) 23 | 24 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/env-linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # 33 | # This file should be sourced, and not executed as a standalone script. 34 | # 35 | 36 | # TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. 37 | 38 | if [ "${TRAVIS_OS_NAME}" = "linux" ]; then 39 | if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi 40 | if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.9" CC="clang-3.9"; fi 41 | fi 42 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/env-osx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # 33 | # This file should be sourced, and not executed as a standalone script. 34 | # 35 | 36 | # TODO() - we can check if this is being sourced using $BASH_VERSION and $BASH_SOURCE[0] != ${0}. 37 | # 38 | 39 | if [ "${TRAVIS_OS_NAME}" = "osx" ]; then 40 | if [ "$CXX" = "clang++" ]; then 41 | # $PATH needs to be adjusted because the llvm tap doesn't install the 42 | # package to /usr/local/bin, etc, like the gcc tap does. 43 | # See: https://github.com/Homebrew/legacy-homebrew/issues/29733 44 | clang_version=3.9 45 | export PATH="/usr/local/opt/llvm@${clang_version}/bin:$PATH"; 46 | fi 47 | fi 48 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/get-nprocessors.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | # This file is typically sourced by another script. 33 | # if possible, ask for the precise number of processors, 34 | # otherwise take 2 processors as reasonable default; see 35 | # https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization 36 | if [ -x /usr/bin/getconf ]; then 37 | NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) 38 | else 39 | NPROCESSORS=2 40 | fi 41 | 42 | # as of 2017-09-04 Travis CI reports 32 processors, but GCC build 43 | # crashes if parallelized too much (maybe memory consumption problem), 44 | # so limit to 4 processors for the time being. 45 | if [ $NPROCESSORS -gt 4 ] ; then 46 | echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." 47 | NPROCESSORS=4 48 | fi 49 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/install-linux.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | set -eu 33 | 34 | if [ "${TRAVIS_OS_NAME}" != linux ]; then 35 | echo "Not a Linux build; skipping installation" 36 | exit 0 37 | fi 38 | 39 | 40 | if [ "${TRAVIS_SUDO}" = "true" ]; then 41 | echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | \ 42 | sudo tee /etc/apt/sources.list.d/bazel.list 43 | curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - 44 | sudo apt-get update && sudo apt-get install -y bazel gcc-4.9 g++-4.9 clang-3.9 45 | elif [ "${CXX}" = "clang++" ]; then 46 | # Use ccache, assuming $HOME/bin is in the path, which is true in the Travis build environment. 47 | ln -sf /usr/bin/ccache $HOME/bin/${CXX}; 48 | ln -sf /usr/bin/ccache $HOME/bin/${CC}; 49 | fi 50 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/install-osx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | set -eu 33 | 34 | if [ "${TRAVIS_OS_NAME}" != "osx" ]; then 35 | echo "Not a macOS build; skipping installation" 36 | exit 0 37 | fi 38 | 39 | brew update 40 | brew install ccache gcc@4.9 41 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/install-platformio.sh: -------------------------------------------------------------------------------- 1 | # install PlatformIO 2 | sudo pip install -U platformio 3 | 4 | # update PlatformIO 5 | platformio update 6 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/log-config.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2017 Google Inc. 3 | # All Rights Reserved. 4 | # 5 | # 6 | # Redistribution and use in source and binary forms, with or without 7 | # modification, are permitted provided that the following conditions are 8 | # met: 9 | # 10 | # * Redistributions of source code must retain the above copyright 11 | # notice, this list of conditions and the following disclaimer. 12 | # * Redistributions in binary form must reproduce the above 13 | # copyright notice, this list of conditions and the following disclaimer 14 | # in the documentation and/or other materials provided with the 15 | # distribution. 16 | # * Neither the name of Google Inc. nor the names of its 17 | # contributors may be used to endorse or promote products derived from 18 | # this software without specific prior written permission. 19 | # 20 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 21 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 22 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 23 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 24 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 25 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 26 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | set -e 33 | 34 | # ccache on OS X needs installation first 35 | # reset ccache statistics 36 | ccache --zero-stats 37 | 38 | echo PATH=${PATH} 39 | 40 | echo "Compiler configuration:" 41 | echo CXX=${CXX} 42 | echo CC=${CC} 43 | echo CXXFLAGS=${CXXFLAGS} 44 | 45 | echo "C++ compiler version:" 46 | ${CXX} --version || echo "${CXX} does not seem to support the --version flag" 47 | ${CXX} -v || echo "${CXX} does not seem to support the -v flag" 48 | 49 | echo "C compiler version:" 50 | ${CC} --version || echo "${CXX} does not seem to support the --version flag" 51 | ${CC} -v || echo "${CXX} does not seem to support the -v flag" 52 | -------------------------------------------------------------------------------- /source/tests/googletest/ci/travis.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | set -evx 3 | 4 | . ci/get-nprocessors.sh 5 | 6 | # if possible, ask for the precise number of processors, 7 | # otherwise take 2 processors as reasonable default; see 8 | # https://docs.travis-ci.com/user/speeding-up-the-build/#Makefile-optimization 9 | if [ -x /usr/bin/getconf ]; then 10 | NPROCESSORS=$(/usr/bin/getconf _NPROCESSORS_ONLN) 11 | else 12 | NPROCESSORS=2 13 | fi 14 | # as of 2017-09-04 Travis CI reports 32 processors, but GCC build 15 | # crashes if parallelized too much (maybe memory consumption problem), 16 | # so limit to 4 processors for the time being. 17 | if [ $NPROCESSORS -gt 4 ] ; then 18 | echo "$0:Note: Limiting processors to use by make from $NPROCESSORS to 4." 19 | NPROCESSORS=4 20 | fi 21 | # Tell make to use the processors. No preceding '-' required. 22 | MAKEFLAGS="j${NPROCESSORS}" 23 | export MAKEFLAGS 24 | 25 | env | sort 26 | 27 | # Set default values to OFF for these variables if not specified. 28 | : "${NO_EXCEPTION:=OFF}" 29 | : "${NO_RTTI:=OFF}" 30 | : "${COMPILER_IS_GNUCXX:=OFF}" 31 | 32 | mkdir build || true 33 | cd build 34 | cmake -Dgtest_build_samples=ON \ 35 | -Dgtest_build_tests=ON \ 36 | -Dgmock_build_tests=ON \ 37 | -Dcxx_no_exception=$NO_EXCEPTION \ 38 | -Dcxx_no_rtti=$NO_RTTI \ 39 | -DCMAKE_COMPILER_IS_GNUCXX=$COMPILER_IS_GNUCXX \ 40 | -DCMAKE_CXX_FLAGS=$CXX_FLAGS \ 41 | -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ 42 | .. 43 | make 44 | CTEST_OUTPUT_ON_FAILURE=1 make test 45 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Mocking Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Benoit Sigoure 7 | Bogdan Piloca 8 | Chandler Carruth 9 | Dave MacLachlan 10 | David Anderson 11 | Dean Sturtevant 12 | Gene Volovich 13 | Hal Burch 14 | Jeffrey Yasskin 15 | Jim Keller 16 | Joe Walnes 17 | Jon Wray 18 | Keir Mierle 19 | Keith Ray 20 | Kostya Serebryany 21 | Lev Makhlis 22 | Manuel Klimek 23 | Mario Tanev 24 | Mark Paskin 25 | Markus Heule 26 | Matthew Simmons 27 | Mike Bland 28 | Neal Norwitz 29 | Nermin Ozkiranartli 30 | Owen Carlsen 31 | Paneendra Ba 32 | Paul Menage 33 | Piotr Kaminski 34 | Russ Rufer 35 | Sverre Sundsdal 36 | Takeshi Yoshino 37 | Vadim Berman 38 | Vlad Losev 39 | Wolfgang Klier 40 | Zhanyong Wan 41 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/README.md: -------------------------------------------------------------------------------- 1 | # Googletest Mocking (gMock) Framework 2 | 3 | ### Overview 4 | 5 | Google's framework for writing and using C++ mock classes. It can help you 6 | derive better designs of your system and write better tests. 7 | 8 | It is inspired by: 9 | 10 | * [jMock](http://www.jmock.org/), 11 | * [EasyMock](http://www.easymock.org/), and 12 | * [Hamcrest](http://code.google.com/p/hamcrest/), 13 | 14 | and designed with C++'s specifics in mind. 15 | 16 | gMock: 17 | 18 | - provides a declarative syntax for defining mocks, 19 | - can define partial (hybrid) mocks, which are a cross of real and mock 20 | objects, 21 | - handles functions of arbitrary types and overloaded functions, 22 | - comes with a rich set of matchers for validating function arguments, 23 | - uses an intuitive syntax for controlling the behavior of a mock, 24 | - does automatic verification of expectations (no record-and-replay needed), 25 | - allows arbitrary (partial) ordering constraints on function calls to be 26 | expressed, 27 | - lets a user extend it by defining new matchers and actions. 28 | - does not use exceptions, and 29 | - is easy to learn and use. 30 | 31 | Details and examples can be found here: 32 | 33 | * [gMock for Dummies](docs/for_dummies.md) 34 | * [Legacy gMock FAQ](docs/gmock_faq.md) 35 | * [gMock Cookbook](docs/cook_book.md) 36 | * [gMock Cheat Sheet](docs/cheat_sheet.md) 37 | 38 | Please note that code under scripts/generator/ is from the [cppclean 39 | project](http://code.google.com/p/cppclean/) and under the Apache 40 | License, which is different from Google Mock's license. 41 | 42 | Google Mock is a part of 43 | [Google Test C++ testing framework](http://github.com/google/googletest/) and a 44 | subject to the same requirements. 45 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/cmake/gmock.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gmock 6 | Description: GoogleMock (without main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Requires: gtest 10 | Libs: -L${libdir} -lgmock @CMAKE_THREAD_LIBS_INIT@ 11 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 12 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/cmake/gmock_main.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gmock_main 6 | Description: GoogleMock (with main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Requires: gmock 10 | Libs: -L${libdir} -lgmock_main @CMAKE_THREAD_LIBS_INIT@ 11 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 12 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/include/gmock/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gmock-port.h` 6 | 7 | The following macros can be defined: 8 | 9 | ### Flag related macros: 10 | 11 | * `GMOCK_DECLARE_bool_(name)` 12 | * `GMOCK_DECLARE_int32_(name)` 13 | * `GMOCK_DECLARE_string_(name)` 14 | * `GMOCK_DEFINE_bool_(name, default_val, doc)` 15 | * `GMOCK_DEFINE_int32_(name, default_val, doc)` 16 | * `GMOCK_DEFINE_string_(name, default_val, doc)` 17 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h: -------------------------------------------------------------------------------- 1 | // This file was GENERATED by command: 2 | // pump.py gmock-generated-actions.h.pump 3 | // DO NOT EDIT BY HAND!!! 4 | 5 | // GOOGLETEST_CM0002 DO NOT DELETE 6 | 7 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 8 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 9 | 10 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 11 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/include/gmock/internal/custom/gmock-generated-actions.h.pump: -------------------------------------------------------------------------------- 1 | $$ -*- mode: c++; -*- 2 | $$ This is a Pump source file. Please use Pump to convert 3 | $$ it to callback-actions.h. 4 | $$ 5 | $var max_callback_arity = 5 6 | $$}} This meta comment fixes auto-indentation in editors. 7 | 8 | // GOOGLETEST_CM0002 DO NOT DELETE 9 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 10 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 11 | 12 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_GENERATED_ACTIONS_H_ 13 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/include/gmock/internal/custom/gmock-matchers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // GOOGLETEST_CM0002 DO NOT DELETE 33 | 34 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 35 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 36 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_MATCHERS_H_ 37 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/include/gmock/internal/custom/gmock-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | // GOOGLETEST_CM0002 DO NOT DELETE 35 | 36 | #ifndef GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 37 | #define GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 38 | 39 | #endif // GMOCK_INCLUDE_GMOCK_INTERNAL_CUSTOM_GMOCK_PORT_H_ 40 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/scripts/generator/README: -------------------------------------------------------------------------------- 1 | 2 | The Google Mock class generator is an application that is part of cppclean. 3 | For more information about cppclean, visit http://code.google.com/p/cppclean/ 4 | 5 | The mock generator requires Python 2.3.5 or later. If you don't have Python 6 | installed on your system, you will also need to install it. You can download 7 | Python from: http://www.python.org/download/releases/ 8 | 9 | To use the Google Mock class generator, you need to call it 10 | on the command line passing the header file and class for which you want 11 | to generate a Google Mock class. 12 | 13 | Make sure to install the scripts somewhere in your path. Then you can 14 | run the program. 15 | 16 | gmock_gen.py header-file.h [ClassName]... 17 | 18 | If no ClassNames are specified, all classes in the file are emitted. 19 | 20 | To change the indentation from the default of 2, set INDENT in 21 | the environment. For example to use an indent of 4 spaces: 22 | 23 | INDENT=4 gmock_gen.py header-file.h ClassName 24 | 25 | This version was made from SVN revision 281 in the cppclean repository. 26 | 27 | Known Limitations 28 | ----------------- 29 | Not all code will be generated properly. For example, when mocking templated 30 | classes, the template information is lost. You will need to add the template 31 | information manually. 32 | 33 | Not all permutations of using multiple pointers/references will be rendered 34 | properly. These will also have to be fixed manually. 35 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/scripts/generator/cpp/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cginternals/cppassist/a6617bfe869c105eca1aba76b4777773315aa181/source/tests/googletest/googlemock/scripts/generator/cpp/__init__.py -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/scripts/generator/cpp/keywords.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Neal Norwitz 4 | # Portions Copyright 2007 Google Inc. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """C++ keywords and helper utilities for determining keywords.""" 19 | 20 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 21 | 22 | 23 | try: 24 | # Python 3.x 25 | import builtins 26 | except ImportError: 27 | # Python 2.x 28 | import __builtin__ as builtins 29 | 30 | 31 | if not hasattr(builtins, 'set'): 32 | # Nominal support for Python 2.3. 33 | from sets import Set as set 34 | 35 | 36 | TYPES = set('bool char int long short double float void wchar_t unsigned signed'.split()) 37 | TYPE_MODIFIERS = set('auto register const inline extern static virtual volatile mutable'.split()) 38 | ACCESS = set('public protected private friend'.split()) 39 | 40 | CASTS = set('static_cast const_cast dynamic_cast reinterpret_cast'.split()) 41 | 42 | OTHERS = set('true false asm class namespace using explicit this operator sizeof'.split()) 43 | OTHER_TYPES = set('new delete typedef struct union enum typeid typename template'.split()) 44 | 45 | CONTROL = set('case switch default if else return goto'.split()) 46 | EXCEPTION = set('try catch throw'.split()) 47 | LOOP = set('while do for break continue'.split()) 48 | 49 | ALL = TYPES | TYPE_MODIFIERS | ACCESS | CASTS | OTHERS | OTHER_TYPES | CONTROL | EXCEPTION | LOOP 50 | 51 | 52 | def IsKeyword(token): 53 | return token in ALL 54 | 55 | def IsBuiltinType(token): 56 | if token in ('virtual', 'inline'): 57 | # These only apply to methods, they can't be types by themselves. 58 | return False 59 | return token in TYPES or token in TYPE_MODIFIERS 60 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/scripts/generator/cpp/utils.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2007 Neal Norwitz 4 | # Portions Copyright 2007 Google Inc. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | 18 | """Generic utilities for C++ parsing.""" 19 | 20 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 21 | 22 | 23 | import sys 24 | 25 | 26 | # Set to True to see the start/end token indices. 27 | DEBUG = True 28 | 29 | 30 | def ReadFile(filename, print_error=True): 31 | """Returns the contents of a file.""" 32 | try: 33 | fp = open(filename) 34 | try: 35 | return fp.read() 36 | finally: 37 | fp.close() 38 | except IOError: 39 | if print_error: 40 | print('Error reading %s: %s' % (filename, sys.exc_info()[1])) 41 | return None 42 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/scripts/generator/gmock_gen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # 3 | # Copyright 2008 Google Inc. All Rights Reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | """Driver for starting up Google Mock class generator.""" 18 | 19 | __author__ = 'nnorwitz@google.com (Neal Norwitz)' 20 | 21 | import os 22 | import sys 23 | 24 | if __name__ == '__main__': 25 | # Add the directory of this script to the path so we can import gmock_class. 26 | sys.path.append(os.path.dirname(__file__)) 27 | 28 | from cpp import gmock_class 29 | # Fix the docstring in case they require the usage. 30 | gmock_class.__doc__ = gmock_class.__doc__.replace('gmock_class.py', __file__) 31 | gmock_class.main() 32 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/src/gmock-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // Google C++ Mocking Framework (Google Mock) 32 | // 33 | // This file #includes all Google Mock implementation .cc files. The 34 | // purpose is to allow a user to build Google Mock by compiling this 35 | // file alone. 36 | 37 | // This line ensures that gmock.h can be compiled on its own, even 38 | // when it's fused. 39 | #include "gmock/gmock.h" 40 | 41 | // The following lines pull in the real gmock *.cc files. 42 | #include "src/gmock-cardinalities.cc" 43 | #include "src/gmock-internal-utils.cc" 44 | #include "src/gmock-matchers.cc" 45 | #include "src/gmock-spec-builders.cc" 46 | #include "src/gmock.cc" 47 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/test/gmock-function-mocker_nc.cc: -------------------------------------------------------------------------------- 1 | #include "gmock/gmock.h" 2 | 3 | #include 4 | #include 5 | 6 | #if defined(TEST_MOCK_METHOD_INVALID_CONST_SPEC) 7 | 8 | struct Base { 9 | MOCK_METHOD(int, F, (), (onst)); 10 | }; 11 | 12 | #else 13 | 14 | // Sanity check - this should compile. 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/test/gmock-function-mocker_nc_test.py: -------------------------------------------------------------------------------- 1 | """Negative compilation tests for Google Mock macro MOCK_METHOD.""" 2 | 3 | import os 4 | import sys 5 | 6 | IS_LINUX = os.name == "posix" and os.uname()[0] == "Linux" 7 | if not IS_LINUX: 8 | sys.stderr.write( 9 | "WARNING: Negative compilation tests are not supported on this platform") 10 | sys.exit(0) 11 | 12 | # Suppresses the 'Import not at the top of the file' lint complaint. 13 | # pylint: disable-msg=C6204 14 | from google3.testing.pybase import fake_target_util 15 | from google3.testing.pybase import googletest 16 | 17 | # pylint: enable-msg=C6204 18 | 19 | 20 | class GMockMethodNCTest(googletest.TestCase): 21 | """Negative compilation tests for MOCK_METHOD.""" 22 | 23 | # The class body is intentionally empty. The actual test*() methods 24 | # will be defined at run time by a call to 25 | # DefineNegativeCompilationTests() later. 26 | pass 27 | 28 | 29 | # Defines a list of test specs, where each element is a tuple 30 | # (test name, list of regexes for matching the compiler errors). 31 | TEST_SPECS = [ 32 | ("MOCK_METHOD_INVALID_CONST_SPEC", 33 | [r"onst cannot be recognized as a valid specification modifier"]), 34 | ] 35 | 36 | # Define a test method in GMockNCTest for each element in TEST_SPECS. 37 | fake_target_util.DefineNegativeCompilationTests( 38 | GMockMethodNCTest, 39 | "google3/third_party/googletest/googlemock/test/gmock-function-mocker_nc", 40 | "gmock-function-mocker_nc.o", TEST_SPECS) 41 | 42 | if __name__ == "__main__": 43 | googletest.main() 44 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/test/gmock-port_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | // Google Mock - a framework for writing C++ mock classes. 32 | // 33 | // This file tests the internal cross-platform support utilities. 34 | 35 | #include "gmock/internal/gmock-port.h" 36 | #include "gtest/gtest.h" 37 | 38 | // NOTE: if this file is left without tests for some reason, put a dummy 39 | // test here to make references to symbols in the gtest library and avoid 40 | // 'undefined symbol' linker errors in gmock_main: 41 | 42 | TEST(DummyTest, Dummy) {} 43 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/test/gmock_link2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | // Google Mock - a framework for writing C++ mock classes. 32 | // 33 | // This file is for verifying that various Google Mock constructs do not 34 | // produce linker errors when instantiated in different translation units. 35 | // Please see gmock_link_test.h for details. 36 | 37 | #define LinkTest LinkTest2 38 | 39 | #include "test/gmock_link_test.h" 40 | -------------------------------------------------------------------------------- /source/tests/googletest/googlemock/test/gmock_link_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | // Google Mock - a framework for writing C++ mock classes. 32 | // 33 | // This file is for verifying that various Google Mock constructs do not 34 | // produce linker errors when instantiated in different translation units. 35 | // Please see gmock_link_test.h for details. 36 | 37 | #define LinkTest LinkTest1 38 | 39 | #include "test/gmock_link_test.h" 40 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/CONTRIBUTORS: -------------------------------------------------------------------------------- 1 | # This file contains a list of people who've made non-trivial 2 | # contribution to the Google C++ Testing Framework project. People 3 | # who commit code to the project are encouraged to add their names 4 | # here. Please keep the list sorted by first names. 5 | 6 | Ajay Joshi 7 | Balázs Dán 8 | Bharat Mediratta 9 | Chandler Carruth 10 | Chris Prince 11 | Chris Taylor 12 | Dan Egnor 13 | Eric Roman 14 | Hady Zalek 15 | Jeffrey Yasskin 16 | Jói Sigurðsson 17 | Keir Mierle 18 | Keith Ray 19 | Kenton Varda 20 | Manuel Klimek 21 | Markus Heule 22 | Mika Raento 23 | Miklós Fazekas 24 | Pasi Valminen 25 | Patrick Hanna 26 | Patrick Riley 27 | Peter Kaminski 28 | Preston Jackson 29 | Rainer Klaffenboeck 30 | Russ Cox 31 | Russ Rufer 32 | Sean Mcafee 33 | Sigurður Ásgeirsson 34 | Tracy Bialik 35 | Vadim Berman 36 | Vlad Losev 37 | Zhanyong Wan 38 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2008, Google Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/cmake/Config.cmake.in: -------------------------------------------------------------------------------- 1 | @PACKAGE_INIT@ 2 | include(CMakeFindDependencyMacro) 3 | if (@GTEST_HAS_PTHREAD@) 4 | set(THREADS_PREFER_PTHREAD_FLAG @THREADS_PREFER_PTHREAD_FLAG@) 5 | find_dependency(Threads) 6 | endif() 7 | 8 | include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") 9 | check_required_components("@project_name@") 10 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/cmake/gtest.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gtest 6 | Description: GoogleTest (without main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Libs: -L${libdir} -lgtest @CMAKE_THREAD_LIBS_INIT@ 10 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 11 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/cmake/gtest_main.pc.in: -------------------------------------------------------------------------------- 1 | prefix=${pcfiledir}/../.. 2 | libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ 3 | includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ 4 | 5 | Name: gtest_main 6 | Description: GoogleTest (with main() function) 7 | Version: @PROJECT_VERSION@ 8 | URL: https://github.com/google/googletest 9 | Requires: gtest 10 | Libs: -L${libdir} -lgtest_main @CMAKE_THREAD_LIBS_INIT@ 11 | Cflags: -I${includedir} @GTEST_HAS_PTHREAD_MACRO@ @CMAKE_THREAD_LIBS_INIT@ 12 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/cmake/libgtest.la.in: -------------------------------------------------------------------------------- 1 | # libgtest.la - a libtool library file 2 | # Generated by libtool (GNU libtool) 2.4.6 3 | 4 | # Please DO NOT delete this file! 5 | # It is necessary for linking the library. 6 | 7 | # Names of this library. 8 | library_names='libgtest.so' 9 | 10 | # Is this an already installed library? 11 | installed=yes 12 | 13 | # Should we warn about portability when linking against -modules? 14 | shouldnotlink=no 15 | 16 | # Files to dlopen/dlpreopen 17 | dlopen='' 18 | dlpreopen='' 19 | 20 | # Directory that this library needs to be installed in: 21 | libdir='@CMAKE_INSTALL_FULL_LIBDIR@' 22 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/docs/samples.md: -------------------------------------------------------------------------------- 1 | # Googletest Samples {#samples} 2 | 3 | If you're like us, you'd like to look at 4 | [googletest samples.](https://github.com/google/googletest/tree/master/googletest/samples) 5 | The sample directory has a number of well-commented samples showing how to use a 6 | variety of googletest features. 7 | 8 | * Sample #1 shows the basic steps of using googletest to test C++ functions. 9 | * Sample #2 shows a more complex unit test for a class with multiple member 10 | functions. 11 | * Sample #3 uses a test fixture. 12 | * Sample #4 teaches you how to use googletest and `googletest.h` together to 13 | get the best of both libraries. 14 | * Sample #5 puts shared testing logic in a base test fixture, and reuses it in 15 | derived fixtures. 16 | * Sample #6 demonstrates type-parameterized tests. 17 | * Sample #7 teaches the basics of value-parameterized tests. 18 | * Sample #8 shows using `Combine()` in value-parameterized tests. 19 | * Sample #9 shows use of the listener API to modify Google Test's console 20 | output and the use of its reflection API to inspect test results. 21 | * Sample #10 shows use of the listener API to implement a primitive memory 22 | leak checker. 23 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/include/gtest/internal/custom/README.md: -------------------------------------------------------------------------------- 1 | # Customization Points 2 | 3 | The custom directory is an injection point for custom user configurations. 4 | 5 | ## Header `gtest.h` 6 | 7 | ### The following macros can be defined: 8 | 9 | * `GTEST_OS_STACK_TRACE_GETTER_` - The name of an implementation of 10 | `OsStackTraceGetterInterface`. 11 | * `GTEST_CUSTOM_TEMPDIR_FUNCTION_` - An override for `testing::TempDir()`. See 12 | `testing::TempDir` for semantics and signature. 13 | 14 | ## Header `gtest-port.h` 15 | 16 | The following macros can be defined: 17 | 18 | ### Flag related macros: 19 | 20 | * `GTEST_FLAG(flag_name)` 21 | * `GTEST_USE_OWN_FLAGFILE_FLAG_` - Define to 0 when the system provides its 22 | own flagfile flag parsing. 23 | * `GTEST_DECLARE_bool_(name)` 24 | * `GTEST_DECLARE_int32_(name)` 25 | * `GTEST_DECLARE_string_(name)` 26 | * `GTEST_DEFINE_bool_(name, default_val, doc)` 27 | * `GTEST_DEFINE_int32_(name, default_val, doc)` 28 | * `GTEST_DEFINE_string_(name, default_val, doc)` 29 | 30 | ### Logging: 31 | 32 | * `GTEST_LOG_(severity)` 33 | * `GTEST_CHECK_(condition)` 34 | * Functions `LogToStderr()` and `FlushInfoLog()` have to be provided too. 35 | 36 | ### Threading: 37 | 38 | * `GTEST_HAS_NOTIFICATION_` - Enabled if Notification is already provided. 39 | * `GTEST_HAS_MUTEX_AND_THREAD_LOCAL_` - Enabled if `Mutex` and `ThreadLocal` 40 | are already provided. Must also provide `GTEST_DECLARE_STATIC_MUTEX_(mutex)` 41 | and `GTEST_DEFINE_STATIC_MUTEX_(mutex)` 42 | * `GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)` 43 | * `GTEST_LOCK_EXCLUDED_(locks)` 44 | 45 | ### Underlying library support features 46 | 47 | * `GTEST_HAS_CXXABI_H_` 48 | 49 | ### Exporting API symbols: 50 | 51 | * `GTEST_API_` - Specifier for exported symbols. 52 | 53 | ## Header `gtest-printers.h` 54 | 55 | * See documentation at `gtest/gtest-printers.h` for details on how to define a 56 | custom printer. 57 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/include/gtest/internal/custom/gtest-port.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PORT_H_ 38 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/include/gtest/internal/custom/gtest-printers.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // This file provides an injection point for custom printers in a local 31 | // installation of gTest. 32 | // It will be included from gtest-printers.h and the overrides in this file 33 | // will be visible to everyone. 34 | // 35 | // Injection point for custom user configurations. See README for details 36 | // 37 | // ** Custom implementation starts here ** 38 | 39 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 40 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 41 | 42 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_PRINTERS_H_ 43 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/include/gtest/internal/custom/gtest.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Injection point for custom user configurations. See README for details 31 | // 32 | // ** Custom implementation starts here ** 33 | 34 | #ifndef GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 35 | #define GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 36 | 37 | #endif // GTEST_INCLUDE_GTEST_INTERNAL_CUSTOM_GTEST_H_ 38 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/samples/sample1.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | 32 | #ifndef GTEST_SAMPLES_SAMPLE1_H_ 33 | #define GTEST_SAMPLES_SAMPLE1_H_ 34 | 35 | // Returns n! (the factorial of n). For negative n, n! is defined to be 1. 36 | int Factorial(int n); 37 | 38 | // Returns true if and only if n is a prime number. 39 | bool IsPrime(int n); 40 | 41 | #endif // GTEST_SAMPLES_SAMPLE1_H_ 42 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/samples/sample4.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | 32 | #include 33 | 34 | #include "sample4.h" 35 | 36 | // Returns the current counter value, and increments it. 37 | int Counter::Increment() { 38 | return counter_++; 39 | } 40 | 41 | // Returns the current counter value, and decrements it. 42 | // counter can not be less than 0, return 0 in this case 43 | int Counter::Decrement() { 44 | if (counter_ == 0) { 45 | return counter_; 46 | } else { 47 | return counter_--; 48 | } 49 | } 50 | 51 | // Prints the current counter value to STDOUT. 52 | void Counter::Print() const { 53 | printf("%d", counter_); 54 | } 55 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/samples/sample4.h: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // A sample program demonstrating using Google C++ testing framework. 31 | #ifndef GTEST_SAMPLES_SAMPLE4_H_ 32 | #define GTEST_SAMPLES_SAMPLE4_H_ 33 | 34 | // A simple monotonic counter. 35 | class Counter { 36 | private: 37 | int counter_; 38 | 39 | public: 40 | // Creates a counter that starts at 0. 41 | Counter() : counter_(0) {} 42 | 43 | // Returns the current counter value, and increments it. 44 | int Increment(); 45 | 46 | // Returns the current counter value, and decrements it. 47 | int Decrement(); 48 | 49 | // Prints the current counter value to STDOUT. 50 | void Print() const; 51 | }; 52 | 53 | #endif // GTEST_SAMPLES_SAMPLE4_H_ 54 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/samples/sample4_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2005, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | #include "sample4.h" 32 | #include "gtest/gtest.h" 33 | 34 | namespace { 35 | // Tests the Increment() method. 36 | 37 | TEST(Counter, Increment) { 38 | Counter c; 39 | 40 | // Test that counter 0 returns 0 41 | EXPECT_EQ(0, c.Decrement()); 42 | 43 | // EXPECT_EQ() evaluates its arguments exactly once, so they 44 | // can have side effects. 45 | 46 | EXPECT_EQ(0, c.Increment()); 47 | EXPECT_EQ(1, c.Increment()); 48 | EXPECT_EQ(2, c.Increment()); 49 | 50 | EXPECT_EQ(3, c.Decrement()); 51 | } 52 | 53 | } // namespace 54 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/scripts/test/Makefile: -------------------------------------------------------------------------------- 1 | # A Makefile for fusing Google Test and building a sample test against it. 2 | # 3 | # SYNOPSIS: 4 | # 5 | # make [all] - makes everything. 6 | # make TARGET - makes the given target. 7 | # make check - makes everything and runs the built sample test. 8 | # make clean - removes all files generated by make. 9 | 10 | # Points to the root of fused Google Test, relative to where this file is. 11 | FUSED_GTEST_DIR = output 12 | 13 | # Paths to the fused gtest files. 14 | FUSED_GTEST_H = $(FUSED_GTEST_DIR)/gtest/gtest.h 15 | FUSED_GTEST_ALL_CC = $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 16 | 17 | # Where to find the sample test. 18 | SAMPLE_DIR = ../../samples 19 | 20 | # Where to find gtest_main.cc. 21 | GTEST_MAIN_CC = ../../src/gtest_main.cc 22 | 23 | # Flags passed to the preprocessor. 24 | # We have no idea here whether pthreads is available in the system, so 25 | # disable its use. 26 | CPPFLAGS += -I$(FUSED_GTEST_DIR) -DGTEST_HAS_PTHREAD=0 27 | 28 | # Flags passed to the C++ compiler. 29 | CXXFLAGS += -g 30 | 31 | all : sample1_unittest 32 | 33 | check : all 34 | ./sample1_unittest 35 | 36 | clean : 37 | rm -rf $(FUSED_GTEST_DIR) sample1_unittest *.o 38 | 39 | $(FUSED_GTEST_H) : 40 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 41 | 42 | $(FUSED_GTEST_ALL_CC) : 43 | ../fuse_gtest_files.py $(FUSED_GTEST_DIR) 44 | 45 | gtest-all.o : $(FUSED_GTEST_H) $(FUSED_GTEST_ALL_CC) 46 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(FUSED_GTEST_DIR)/gtest/gtest-all.cc 47 | 48 | gtest_main.o : $(FUSED_GTEST_H) $(GTEST_MAIN_CC) 49 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(GTEST_MAIN_CC) 50 | 51 | sample1.o : $(SAMPLE_DIR)/sample1.cc $(SAMPLE_DIR)/sample1.h 52 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1.cc 53 | 54 | sample1_unittest.o : $(SAMPLE_DIR)/sample1_unittest.cc \ 55 | $(SAMPLE_DIR)/sample1.h $(FUSED_GTEST_H) 56 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $(SAMPLE_DIR)/sample1_unittest.cc 57 | 58 | sample1_unittest : sample1.o sample1_unittest.o gtest-all.o gtest_main.o 59 | $(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ -o $@ 60 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/src/gtest-all.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // Google C++ Testing and Mocking Framework (Google Test) 32 | // 33 | // Sometimes it's desirable to build Google Test by compiling a single file. 34 | // This file serves this purpose. 35 | 36 | // This line ensures that gtest.h can be compiled on its own, even 37 | // when it's fused. 38 | #include "gtest/gtest.h" 39 | 40 | // The following lines pull in the real gtest *.cc files. 41 | #include "src/gtest.cc" 42 | #include "src/gtest-death-test.cc" 43 | #include "src/gtest-filepath.cc" 44 | #include "src/gtest-matchers.cc" 45 | #include "src/gtest-port.cc" 46 | #include "src/gtest-printers.cc" 47 | #include "src/gtest-test-part.cc" 48 | #include "src/gtest-typed-test.cc" 49 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/src/gtest_main.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include 31 | #include "gtest/gtest.h" 32 | 33 | #ifdef ARDUINO 34 | void setup() { 35 | testing::InitGoogleTest(); 36 | } 37 | 38 | void loop() { RUN_ALL_TESTS(); } 39 | 40 | #else 41 | 42 | GTEST_API_ int main(int argc, char **argv) { 43 | printf("Running main() from %s\n", __FILE__); 44 | testing::InitGoogleTest(&argc, argv); 45 | return RUN_ALL_TESTS(); 46 | } 47 | #endif 48 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/googletest-param-test-invalid-name1-test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | #include "gtest/gtest.h" 32 | 33 | namespace { 34 | class DummyTest : public ::testing::TestWithParam {}; 35 | 36 | TEST_P(DummyTest, Dummy) { 37 | } 38 | 39 | INSTANTIATE_TEST_SUITE_P(InvalidTestName, 40 | DummyTest, 41 | ::testing::Values("InvalidWithQuotes"), 42 | ::testing::PrintToStringParamName()); 43 | 44 | } // namespace 45 | 46 | int main(int argc, char *argv[]) { 47 | testing::InitGoogleTest(&argc, argv); 48 | return RUN_ALL_TESTS(); 49 | } 50 | 51 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/googletest-param-test-invalid-name2-test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | #include "gtest/gtest.h" 32 | 33 | namespace { 34 | class DummyTest : public ::testing::TestWithParam {}; 35 | 36 | std::string StringParamTestSuffix( 37 | const testing::TestParamInfo& info) { 38 | return std::string(info.param); 39 | } 40 | 41 | TEST_P(DummyTest, Dummy) { 42 | } 43 | 44 | INSTANTIATE_TEST_SUITE_P(DuplicateTestNames, 45 | DummyTest, 46 | ::testing::Values("a", "b", "a", "c"), 47 | StringParamTestSuffix); 48 | } // namespace 49 | 50 | int main(int argc, char *argv[]) { 51 | testing::InitGoogleTest(&argc, argv); 52 | return RUN_ALL_TESTS(); 53 | } 54 | 55 | 56 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/googletest-uninitialized-test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | #include "gtest/gtest.h" 32 | 33 | TEST(DummyTest, Dummy) { 34 | // This test doesn't verify anything. We just need it to create a 35 | // realistic stage for testing the behavior of Google Test when 36 | // RUN_ALL_TESTS() is called without 37 | // testing::InitGoogleTest() being called first. 38 | } 39 | 40 | int main() { 41 | return RUN_ALL_TESTS(); 42 | } 43 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/gtest-typed-test2_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | #include 32 | 33 | #include "test/gtest-typed-test_test.h" 34 | #include "gtest/gtest.h" 35 | 36 | #if GTEST_HAS_TYPED_TEST_P 37 | 38 | // Tests that the same type-parameterized test case can be 39 | // instantiated in different translation units linked together. 40 | // (ContainerTest is also instantiated in gtest-typed-test_test.cc.) 41 | INSTANTIATE_TYPED_TEST_SUITE_P(Vector, ContainerTest, 42 | testing::Types >); 43 | 44 | #endif // GTEST_HAS_TYPED_TEST_P 45 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/gtest_help_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2009, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | // This program is meant to be run by gtest_help_test.py. Do not run 32 | // it directly. 33 | 34 | #include "gtest/gtest.h" 35 | 36 | // When a help flag is specified, this program should skip the tests 37 | // and exit with 0; otherwise the following test will be executed, 38 | // causing this program to exit with a non-zero code. 39 | TEST(HelpFlagTest, ShouldNotBeRun) { 40 | ASSERT_TRUE(false) << "Tests shouldn't be run when --help is specified."; 41 | } 42 | 43 | #if GTEST_HAS_DEATH_TEST 44 | TEST(DeathTest, UsedByPythonScriptToDetectSupportForDeathTestsInThisBinary) {} 45 | #endif 46 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/gtest_list_output_unittest_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: david.schuldenfrei@gmail.com (David Schuldenfrei) 31 | 32 | // Unit test for Google Test's --gtest_list_tests and --gtest_output flag. 33 | // 34 | // A user can ask Google Test to list all tests that will run, 35 | // and have the output saved in a Json/Xml file. 36 | // The tests will not be run after listing. 37 | // 38 | // This program will be invoked from a Python unit test. 39 | // Don't run it directly. 40 | 41 | #include "gtest/gtest.h" 42 | 43 | TEST(FooTest, Test1) {} 44 | 45 | TEST(FooTest, Test2) {} 46 | 47 | int main(int argc, char **argv) { 48 | ::testing::InitGoogleTest(&argc, argv); 49 | 50 | return RUN_ALL_TESTS(); 51 | } 52 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/gtest_main_unittest.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | #include "gtest/gtest.h" 32 | 33 | // Tests that we don't have to define main() when we link to 34 | // gtest_main instead of gtest. 35 | 36 | namespace { 37 | 38 | TEST(GTestMainTest, ShouldSucceed) { 39 | } 40 | 41 | } // namespace 42 | 43 | // We are using the main() function defined in gtest_main.cc, so we 44 | // don't define it here. 45 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/gtest_prod_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // Unit test for gtest_prod.h. 32 | 33 | #include "production.h" 34 | #include "gtest/gtest.h" 35 | 36 | // Tests that private members can be accessed from a TEST declared as 37 | // a friend of the class. 38 | TEST(PrivateCodeTest, CanAccessPrivateMembers) { 39 | PrivateCode a; 40 | EXPECT_EQ(0, a.x_); 41 | 42 | a.set_x(1); 43 | EXPECT_EQ(1, a.x_); 44 | } 45 | 46 | typedef testing::Test PrivateCodeFixtureTest; 47 | 48 | // Tests that private members can be accessed from a TEST_F declared 49 | // as a friend of the class. 50 | TEST_F(PrivateCodeFixtureTest, CanAccessPrivateMembers) { 51 | PrivateCode a; 52 | EXPECT_EQ(0, a.x_); 53 | 54 | a.set_x(2); 55 | EXPECT_EQ(2, a.x_); 56 | } 57 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/gtest_skip_in_environment_setup_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2019, Google LLC. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google LLC. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // This test verifies that skipping in the environment results in the 31 | // testcases being skipped. 32 | 33 | #include 34 | #include "gtest/gtest.h" 35 | 36 | class SetupEnvironment : public testing::Environment { 37 | public: 38 | void SetUp() override { GTEST_SKIP() << "Skipping the entire environment"; } 39 | }; 40 | 41 | TEST(Test, AlwaysFails) { EXPECT_EQ(true, false); } 42 | 43 | int main(int argc, char **argv) { 44 | testing::InitGoogleTest(&argc, argv); 45 | 46 | testing::AddGlobalTestEnvironment(new SetupEnvironment()); 47 | 48 | return RUN_ALL_TESTS(); 49 | } 50 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/gtest_skip_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008 Google Inc. 2 | // All Rights Reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // Author: arseny.aprelev@gmail.com (Arseny Aprelev) 31 | // 32 | 33 | #include "gtest/gtest.h" 34 | 35 | using ::testing::Test; 36 | 37 | TEST(SkipTest, DoesSkip) { 38 | GTEST_SKIP(); 39 | EXPECT_EQ(0, 1); 40 | } 41 | 42 | class Fixture : public Test { 43 | protected: 44 | void SetUp() override { 45 | GTEST_SKIP() << "skipping all tests for this fixture"; 46 | } 47 | }; 48 | 49 | TEST_F(Fixture, SkipsOneTest) { 50 | EXPECT_EQ(5, 7); 51 | } 52 | 53 | TEST_F(Fixture, SkipsAnotherTest) { 54 | EXPECT_EQ(99, 100); 55 | } 56 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/gtest_testbridge_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018, Google LLC. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | 31 | // This program is meant to be run by gtest_test_filter_test.py. Do not run 32 | // it directly. 33 | 34 | #include "gtest/gtest.h" 35 | 36 | // These tests are used to detect if filtering is working. Only 37 | // 'TestThatSucceeds' should ever run. 38 | 39 | TEST(TestFilterTest, TestThatSucceeds) {} 40 | 41 | TEST(TestFilterTest, TestThatFails) { 42 | ASSERT_TRUE(false) << "This test should never be run."; 43 | } 44 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/gtest_xml_outfile1_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // gtest_xml_outfile1_test_ writes some xml via TestProperty used by 31 | // gtest_xml_outfiles_test.py 32 | 33 | #include "gtest/gtest.h" 34 | 35 | class PropertyOne : public testing::Test { 36 | protected: 37 | void SetUp() override { RecordProperty("SetUpProp", 1); } 38 | void TearDown() override { RecordProperty("TearDownProp", 1); } 39 | }; 40 | 41 | TEST_F(PropertyOne, TestSomeProperties) { 42 | RecordProperty("TestSomeProperty", 1); 43 | } 44 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/gtest_xml_outfile2_test_.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2008, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | // 30 | // gtest_xml_outfile2_test_ writes some xml via TestProperty used by 31 | // gtest_xml_outfiles_test.py 32 | 33 | #include "gtest/gtest.h" 34 | 35 | class PropertyTwo : public testing::Test { 36 | protected: 37 | void SetUp() override { RecordProperty("SetUpProp", 2); } 38 | void TearDown() override { RecordProperty("TearDownProp", 2); } 39 | }; 40 | 41 | TEST_F(PropertyTwo, TestSomeProperties) { 42 | RecordProperty("TestSomeProperty", 2); 43 | } 44 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/production.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // This is part of the unit test for gtest_prod.h. 32 | 33 | #include "production.h" 34 | 35 | PrivateCode::PrivateCode() : x_(0) {} 36 | -------------------------------------------------------------------------------- /source/tests/googletest/googletest/test/production.h: -------------------------------------------------------------------------------- 1 | // Copyright 2006, Google Inc. 2 | // All rights reserved. 3 | // 4 | // Redistribution and use in source and binary forms, with or without 5 | // modification, are permitted provided that the following conditions are 6 | // met: 7 | // 8 | // * Redistributions of source code must retain the above copyright 9 | // notice, this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above 11 | // copyright notice, this list of conditions and the following disclaimer 12 | // in the documentation and/or other materials provided with the 13 | // distribution. 14 | // * Neither the name of Google Inc. nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | 30 | // 31 | // This is part of the unit test for gtest_prod.h. 32 | 33 | #ifndef GTEST_TEST_PRODUCTION_H_ 34 | #define GTEST_TEST_PRODUCTION_H_ 35 | 36 | #include "gtest/gtest_prod.h" 37 | 38 | class PrivateCode { 39 | public: 40 | // Declares a friend test that does not use a fixture. 41 | FRIEND_TEST(PrivateCodeTest, CanAccessPrivateMembers); 42 | 43 | // Declares a friend test that uses a fixture. 44 | FRIEND_TEST(PrivateCodeFixtureTest, CanAccessPrivateMembers); 45 | 46 | PrivateCode(); 47 | 48 | int x() const { return x_; } 49 | private: 50 | void set_x(int an_x) { x_ = an_x; } 51 | int x_; 52 | }; 53 | 54 | #endif // GTEST_TEST_PRODUCTION_H_ 55 | -------------------------------------------------------------------------------- /source/tests/googletest/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "googletest", 3 | "keywords": "unittest, unit, test, gtest, gmock", 4 | "description": "googletest is a testing framework developed by the Testing Technology team with Google's specific requirements and constraints in mind. No matter whether you work on Linux, Windows, or a Mac, if you write C++ code, googletest can help you. And it supports any kind of tests, not just unit tests.", 5 | "license": "BSD-3-Clause", 6 | "homepage": "https://github.com/google/googletest/blob/master/README.md", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/google/googletest.git" 10 | }, 11 | "version": "1.8.1", 12 | "frameworks": "arduino", 13 | "platforms": [ 14 | "espressif32" 15 | ], 16 | "export": { 17 | "include": [ 18 | "googlemock/include/*", 19 | "googlemock/src/*", 20 | "googletest/include/*", 21 | "googletest/src/*" 22 | ], 23 | "exclude": [ 24 | "ci", 25 | "googlemock/build-aux", 26 | "googlemock/cmake", 27 | "googlemock/make", 28 | "googlemock/msvc", 29 | "googlemock/scripts", 30 | "googlemock/src/gmock-all.cc", 31 | "googlemock/src/gmock_main.cc", 32 | "googlemock/test", 33 | "googlemock/CMakeLists.txt", 34 | "googlemock/Makefile.am", 35 | "googlemock/configure.ac", 36 | "googletest/cmake", 37 | "googletest/codegear", 38 | "googletest/m4", 39 | "googletest/make", 40 | "googletest/msvc", 41 | "googletest/scripts", 42 | "googletest/src/gtest-all.cc", 43 | "googletest/src/gtest_main.cc", 44 | "googletest/test", 45 | "googletest/xcode", 46 | "googletest/CMakeLists.txt", 47 | "googletest/Makefile.am", 48 | "googletest/configure.ac" 49 | ] 50 | }, 51 | "build": { 52 | "flags": [ 53 | "-Igooglemock/include", 54 | "-Igooglemock", 55 | "-Igoogletest/include", 56 | "-Igoogletest" 57 | ] 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /source/tests/googletest/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | 12 | [platformio] 13 | #src_dir = ./googlemock 14 | #src_dir = ./googletest 15 | src_dir = . 16 | 17 | [env:googletest_esp32] 18 | platform = espressif32 19 | board = esp32dev 20 | framework = arduino 21 | build_flags = -I./googletest/include -I./googletest 22 | src_filter = +<*> -<.git/> - - - - - - + + 23 | upload_speed = 921600 24 | 25 | [env:googlemock_esp32] 26 | platform = espressif32 27 | board = esp32dev 28 | framework = arduino 29 | build_flags = -I./googlemock/include -I./googletest/include -I./googletest -I./googlemock 30 | src_filter = +<*> -<.git/> - - - + + + 31 | upload_speed = 921600 32 | -------------------------------------------------------------------------------- /source/version.h.in: -------------------------------------------------------------------------------- 1 | 2 | #define ${META_PROJECT_ID}_PROJECT_NAME "@META_PROJECT_NAME@" 3 | #define ${META_PROJECT_ID}_PROJECT_DESCRIPTION "@META_PROJECT_DESCRIPTION@" 4 | 5 | #define ${META_PROJECT_ID}_AUTHOR_ORGANIZATION "@META_AUTHOR_ORGANIZATION@" 6 | #define ${META_PROJECT_ID}_AUTHOR_DOMAIN "@META_AUTHOR_DOMAIN@" 7 | #define ${META_PROJECT_ID}_AUTHOR_MAINTAINER "@META_AUTHOR_MAINTAINER@" 8 | 9 | #define ${META_PROJECT_ID}_VERSION_MAJOR "@META_VERSION_MAJOR@" 10 | #define ${META_PROJECT_ID}_VERSION_MINOR "@META_VERSION_MINOR@" 11 | #define ${META_PROJECT_ID}_VERSION_PATCH "@META_VERSION_PATCH@" 12 | #define ${META_PROJECT_ID}_VERSION_REVISION "@META_VERSION_REVISION@" 13 | 14 | #define ${META_PROJECT_ID}_VERSION "@META_VERSION@" 15 | #define ${META_PROJECT_ID}_NAME_VERSION "@META_NAME_VERSION@" 16 | --------------------------------------------------------------------------------