delphi - Comparing issues in DUnit CheckEquals with Currency Field Values -


I am comparing some currency values ​​in DUnit but it is not working on my machine (working on others But not on mine).

An example:

  Check Ecloss (16.65, some CurrencyFieldValue);  

Wakes Up:

  Expected: & lt; 16,65 & gt; But it was: & lt; 16,65 & gt;  

If comparing, then does the following:

  var temp: currency; Start temporarily: = 16.65; Check Eclol (Temp, SomeCurrencyFieldValue);  

The question is: Why do not I compare when I pass the value directly to the Check Acquisition method?

What to do with the problem how the currency value Runtime changes to extended values ​​versus how the points running on compiled time are converted into extended values. If the conversion is not the same in both cases, then the value equal to CheckEquals can not be the same.

This value is being examined in the debugger's CPU window or not for the function call at an intermediate double value on extended goes. An additional conversion will affect the exact value of the result.

One more thing to consider is that 16.65 is not exactly used as a extended value, but it is is as much as possible a currency as the value. Although currency is classified as floating-point type, it is actually a 64-bit integer with a fixed point. This is probably an overload of an additional CheckEquals The basis for the request is that it takes into account.


Comments