Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

In Part 6 of this series I began rewriting some of the embed code from the UpdateDetail procedure in the Invoice app as a reusable, testable class. Although I simply showed some test code on its own, that code lives inside a ClarionTest-compatible test DLL.

...

Now, right-click on the procedure and choose Source to bring up the Embeditor

There really are only two embeds you need to be concerned about in the test procedure. One is the data embed, where you declare any data you need for the test. The other is Priority 5000, right before the return statement. That's where you place your test code.

Here's the code for the data embed:

...

I used to think that as long as you had at least one decimal field in a calculation that the BCD library would be invoked. But the help says this about addition, multiplication and subtraction:

Performed as a BCD operation when neither operand has a REAL Base Type (both are LONG or DECIMAL) and one has the DECIMAL Base Type. 

and this about division:

Performed as a BCD operation when neither operand has a REAL Base Type (both are LONG or DECIMAL). 

It seems the safe thing to do is to ensure that no reals are involved, which is why I've saved the returned value to a local variable. It is however safe to return the value as a real since no math is done at that point. 

...