sora2-network icon indicating copy to clipboard operation
sora2-network copied to clipboard

[Tech]: Rewrite `assert_approx_eq` tests to `assert_eq`

Open bragov4ik opened this issue 1 year ago • 0 comments

Problem statement

Macro assert_approx_eq should be deprecated and tests that use it should be rewritten to assert_eq. For example, this can be done by performing the same fixed-point computations within the tests and comparing the results (which should be exactly equal).

Description

We use fixed-point arithmetics since financial applications require exact computations; therefore testing should consider this aspect and check for exact values. It is highly discouraged to allow room for error when counting assets.

Definition of Done

  1. Macro is marked as deprecated
  2. Tests are rewritten

Requirements

  • The tests should not just copy the code of tested functions, but they should use formulae from them to compute expected values.

bragov4ik avatar Jan 18 '24 09:01 bragov4ik