mabrarov / yatest

Test for C++

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C++ Test

License Travis CI build status AppVeyor CI build status Code coverage status

C++ tests.

Building

Requirements

  1. C++ toolchain
    • Microsoft Visual Studio 2015-2019
    • MinGW 7+
    • GCC 6+
    • Clang 6+
  2. CMake 3.2+

Assumptions

  1. yatest_home environment variable is path to local copy of this repository
  2. build_dir environment variable specifies build directory, it may be different than yatest_home for "out of source tree" build, it may be build subdirectory of yatest_home
  3. build_type environment variable specifies CMake build type
    • Debug
    • Release
    • RelWithDebInfo
    • MinSizeRel
  4. cmake_generator environment variable is CMake generator
    • Visual Studio 14 2015 - Visual Studio 2015
    • Visual Studio 15 2017 - Visual Studio 2017
    • Visual Studio 16 2019 - Visual Studio 2019
    • NMake Makefiles - NMake makefiles
    • MinGW Makefiles - MinGW makefiles
    • Unix Makefiles - Unix / Linux makefiles
  5. cmake_platform environment variable is CMAKE_GENERATOR_PLATFORM
    • Win32 - x86 platform when using Visual Studio
    • x64 - amd64 (x64) platform when using Visual Studio
  6. Unix / Linux commands use Bash
  7. Windows commands use Windows Command Prompt

Steps

  1. Generate project for build system from CMake project, assuming current directory is build_dir

    • Unix / Linux

      cmake -D CMAKE_BUILD_TYPE="${build_type}" -G "${cmake_generator}" "${yatest_home}"
    • Windows, Visual Studio CMake generator, shared C/C++ runtime

      cmake -G "%cmake_generator%" -A "%cmake_platform%" "%yatest_home%"
    • Windows, Visual Studio CMake generator, static C/C++ runtime

      cmake ^
      -D CMAKE_USER_MAKE_RULES_OVERRIDE="%yatest_home%\cmake\static_c_runtime_overrides.cmake" ^
      -D CMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%yatest_home%\cmake\static_cxx_runtime_overrides.cmake" ^
      -G "%cmake_generator%" -A "%cmake_platform%" "%yatest_home%"
    • Windows, NMake / MinGW makefiles CMake generator, static C/C++ runtime

      cmake ^
      -D CMAKE_USER_MAKE_RULES_OVERRIDE="%yatest_home%\cmake\static_c_runtime_overrides.cmake" ^
      -D CMAKE_USER_MAKE_RULES_OVERRIDE_CXX="%yatest_home%\cmake\static_cxx_runtime_overrides.cmake" ^
      -D CMAKE_BUILD_TYPE="%build_type%" ^
      -G "%cmake_generator%" "%yatest_home%"
  2. Build generated project with build system chosen at previous step via CMake generator

    • Unix / Linux

      cmake --build "${build_dir}" --config "${build_type}"
    • Windows

      cmake --build "%build_dir%" --config "%build_type%"
  3. Run tests, assuming current directory is build_dir

    • Unix / Linux

      ctest --build-config "${build_type}" --verbose
    • Windows

      ctest --build-config "%build_type%" --verbose

Usage

Refer to

  1. src/brackets/README.md
  2. src/top/README.md
  3. src/rle/README.md
  4. src/stone_jewellery/README.md
  5. src/anagram/README.md
  6. src/brackets_gen/README.md

About

Test for C++

License:Apache License 2.0


Languages

Language:C++ 55.2%Language:PowerShell 20.7%Language:CMake 16.5%Language:Shell 7.6%