How To Install doctest-dev on Ubuntu 18.04

In this tutorial we learn how to install doctest-dev on Ubuntu 18.04. doctest-dev is Light and feature-rich C++ testing framework

Introduction

In this tutorial we learn how to install doctest-dev on Ubuntu 18.04.

What is doctest-dev

doctest-dev is:

doctest is a light and feature-rich C++98 / C++11 single-header testing framework for unit tests and TDD.

It is inspired by the unittest {} functionality of the D programming language and Python’s docstrings - tests can be considered a form of documentation and should be able to reside near the production code which they test. This isn’t possible (or at least practical) with any other testing framework for C++.

There are three methods to install doctest-dev on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install doctest-dev Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install doctest-dev using apt-get by running the following command:

sudo apt-get -y install doctest-dev

Install doctest-dev Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install doctest-dev using apt by running the following command:

sudo apt -y install doctest-dev

Install doctest-dev Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install doctest-dev using aptitude by running the following command:

sudo aptitude -y install doctest-dev

How To Uninstall doctest-dev on Ubuntu 18.04

To uninstall only the doctest-dev package we can use the following command:

sudo apt-get remove doctest-dev

Uninstall doctest-dev And Its Dependencies

To uninstall doctest-dev and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove doctest-dev

Remove doctest-dev Configurations and Data

To remove doctest-dev configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge doctest-dev

Remove doctest-dev configuration, data, and all of its dependencies

We can use the following command to remove doctest-dev configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge doctest-dev

References

Summary

In this tutorial we learn how to install doctest-dev package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.