Search⌘ K
AI Features

Right-B[I]CEP: Checking Inverse Relationships

Explore how to use the Right-BICEP method to verify inverse relationships in unit tests, such as checking square root calculations and database queries. Understand how cross-checking complements testing accuracy and learn strategies to avoid common coding defects.

Logical inverse relationships

Sometimes, we’ll be able to check behavior by applying its logical inverse. For mathematical computations, this is often the case. We can:

  • Verify division with multiplication
  • Verify addition with subtraction

Implementation of the square-root function

Let’s take a look at the square-root function using Newton’s algorithm.

Remember that ...