This repository contains homegrown versions of various important data-structures used in quantitative trading and finance. My goal is to develop an intuition for the kind of code required to write these types and not replace the standard facilities - they exist, they work, they are tested ad nauseam.
git clone --recurse-submodules -j8 https://github.com/quasar-chunawala/interview_data_structures.git
Run cmake
to generate the build system:
mkdir build
cd build
cmake ..
Build the project by issuing:
cmake --build .
Run all tests by issuing :
ctest
Ensure that gcov
, lcov
and genhtml
are installed.
Check if the gcov
version matches the compiler
version using the build the code:
gcov --version
gcc --version
On Arch Linux, install lcov
using pacman
:
sudo pacman -S lcov
On Ubuntu/Debian, install lcov
using apt
:
sudo apt update
sudo apt install lcov
On Fedora, install lcov
using dnf
:
sudo dnf install lcov
On macOS, install lcov
using homebrew
:
brew install lcov
Once all the dependencies are installed, from the root folder, run the following set of commands:
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake --build .
# Run the tests
ctest
# Generate the coverage report
lcov --capture --directory . --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/tests/*' --output-file coverage.filtered.info
genhtml coverage.filtered.info --output-directory coverage_report
If you use VSCode as your IDE and there are issues with the Intellisense configuration, go to command palette Ctrl+Shift+P
(Windows/Linux) or Cmd+Shift+P
(macOS) and search for and select Intellisense configuration and ensure that you pick the right one.