This repository has been created to answer an exercise requested by Bosch. The exercise is detailed here.
I consider that the main goal of the exercise has been reached as I have developed:
- The Queue class with the given interface;
- A main file to serve as an example implementation;
- Unit tests using GoogleTest framework;
- A CMake file to ease the build process.
In this repo you will find the following folder structure:
📦
├─ include
│ └─ problem_queue.hpp (The core file of the exercise, containing the Queue Class)
├─ src
│ └─ main.cpp (The main file that will implement the test case of the exercise)
├─ tests
│ └─ main_tests.cpp (File to run unit tests using Google Test)
├─ .gitignore
├─ CMakeLists.txt
├─ Offline-Exercise-Queue_v2.pdf
└─ README.md
- Clone this repository and move inside the root folder
- Create a build folder and move inside it
$ mkdir build
$ cd build
- Configure the CMake
$ cmake ..
- Build the project
$ cmake --build .
- To run the Unit tests, move inside the build folder and:
$ ctest
std::condition_variable - Examples
Unit tests (Google Test) - Quick start guide
- The extra : "The reading/writing threads should optionally block for a certain period of time. If the
action is successful within this time, true is returned, otherwise false." - Has not been implemented as it would have required changes on the given class interface. However, only slight changes are required to implement this functionality. Preferably using
wait_for
method fromstd::condition_variable
.