Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The presented function has a verification mechanism for verifying whether the divisor (denominator) is equal to zero , or is close to zero in the case of a floating-point number, it is close to zero. In case when the condition is evaluated evaluates to True then , an exception should be is thrown.  To To implement the exception, include the <stdexcept> library.


tests:

We also need to create a folder for our tests. In this tutorial, this folder is called tst. To start writing tests, we will create run_tests.cpp and test_operations.cpp. We want GoogleTest to search for test files automatically, and we do this thanks to the code stored in the run_tests.cpp source file. Typically, this code will be universal for all kinds of projects:

...