sergeyklay / ytc

An yaml-cpp example project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

YTC

Actions Status License: MIT

YTC (a Yaml Template Class example) is an yaml-cpp example project. The main goal of this project is to show a possible strategy to convert user data types using yaml-cpp.

This project build with following tools:

How to try it out

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

To build YTC you need the following requirements:

  • A C++ compiler such as Gcc >= 7.0.0, Clang >= 5.0.0 or Apple Clang >= 10.0.0
  • CMake 3.11 or later
  • Conan decentralized package manager with a client-server architecture

To enable test coverage reports you need the following requirements:

  • lcov
  • genhtml

For project dependencies list see conanfile.txt bundled with this project.

If you're using Ubuntu, you can install the required packages this way:

sudo apt install gcc cmake build-essential

On macOS you most likely have a compiler so you'll need only cmake:

brew install cmake

Please note that specific versions of libraries and programs at the time of reading this guide may vary. The following dependencies is recommended install using pip:

  • conan

They can be installed using pip as follows:

pip install -r requirements.txt

Building

First you'll need clone the project and fetch its modules:

git clone https://github.com/sergeyklay/ytc
cd ytc

Then build project as follows:

cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Debug
cmake --build build

Running the tests

Tests expect YTC_TESTS_ROOT environment variable to use fixtures. This variable should point to the tests directory root. Set this variable and run the tests as follows:

export YTC_TESTS_ROOT=$(pwd)/tests
cmake --build build --target check

Generate HTML code coverage report

Follow these steps:

  1. Configure with code coverage instrumentation enabled -DCODE_COVERAGE=ON
  2. Build project
  3. Execute the tests to generate the coverage data
  4. Generate and customize reports as follows:
# Create lcov report
lcov --directory build --capture --output-file ./build/coverage.info

# Filter out extra files
lcov \
    --remove ./build/coverage.info \
    '/usr/*'                       \
    "${HOME}"'/.conan/*'           \
    '*/tests/*'                    \
    --output-file ./build/coverage.info

# Output coverage data for debugging (Optional)
lcov --list ./build/coverage.info

# Create a directory to store HTML report 
mkdir ./build/coverage

# Generate HTML report
genhtml ./build/coverage.info --output-directory ./build/coverage

Further Reading

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

An yaml-cpp example project.

License:MIT License


Languages

Language:C++ 67.8%Language:CMake 32.2%