As of October, 2016, Embarcadero is offering a free release
of Delphi (Delphi
10.1 Berlin Starter Edition ). There
are a few restrictions, but it is a welcome step toward making
more programmers aware of the joys of Delphi. They do say
"Offer may be withdrawn at any time", so don't delay if you want
to check it out. Please use the
link to let me know if the link stops working.
Support DFF - Shop
If you shop at Amazon anyway, consider
using this link.
We receive a few cents from each
Support DFF - Donate
If you benefit from the website, in terms of
knowledge, entertainment value, or something otherwise useful,
consider making a donation via PayPal to help defray the
costs. (No PayPal account necessary to donate via credit
card.) Transaction is secure.
For over 15 years
Mensa Page-A-Day calendars have provided several puzzles a year
for my programming pleasure. Coding "solvers" is most fun,
but many programs also allow user solving, convenient for "fill
in the blanks" type. Below are Amazon links to the
two most recent years.
365 Puzzlers Calendar 2017
365 Puzzlers Calendar 2018
(Hint: If you can
wait, current year calendars are usually on sale in January.)
e-mail with your comments about this program (or anything else).
Here's a class TRegress, which provides a
framework for building regression tests for specific programs.
Included is the program that motivated the new class, BigIntsTest builds
and tests case files for our TInteger class. TInteger
does arithmetic for arbitrarily long integers.
Background & Techniques
Regression testing is a major part of quality control for commercial
software projects. Introducing a new bug while fixing an old one is
a common occurrence in programming. Regression testing, sometimes
called "back testing", reruns inputs that are known to run
successfully to make sure that it still produces the same output, or at
least that any differences represent improvements.
Our TInteger unit has gained popularity here at DFF and among users who
need to do large integer arithmetic. Several contributors have
worked at adding functions and improving the speed of the component which
has put me in the role of quality control analyst, a job I managed to
avoid during my professional career. But it did provide an excuse to
create this initial attempt at a regression testing control.
The TRegress class contains the methods to assist in building or
cases from a file. A calling program will be required for each
specific application. The case file is a plain text file containing
nine lines per case as defined by the following TOprec record
definition: (All variables are in text string. format.)
|CaseID: Case identifier.|
|Funcstr: A description of the operations.|
|OpCode: Numeric indicator of the operation performed.|
|Op1,Op2, Op3: Up to 3 input operands|
|Result1, Result2: 1 or 2 results; For Boolean results, 1=true, 0=false.|
|RunMuSecs: Execution time in microseconds.|
Here are the main methods contained in the class:
Create constructor takes three parameters from the calling program:
|NewOnLoadrec: Address of an optional function in the user program called by TRegress when a case is to be retrieved and tested by GetNextrec. It gives the user a chance to move the input operands to his|
edit areas. Calling sequence is defined in TEventRec.
Value may be Nil if not necessary in calling program
|NewOnEvaluate: Address of a user function called by GetNextrec and by Saverec
functions to evaluate the current case. Any unused TOprec|
fields are set to 0.
|NewMemo: Address of a TMemo used by TRegress to display results.|
Procedure Reset opens process a case file based on the NewMode
|Newmode opens a new file for adding cases|
Newmode=Append opens an existing file at the end of existing
case for adding new cases. New cases are numbered
beginning with the number of cases in the file + 1.
|NewMode=Read opens a file for reading to comparison with new
|Newmode=None just closes any open file. |
|Newmode=Renumber is provide a handy way to update a case
file with new case numbers, descriptions, results, and run times base
on the Op code and input field found on the input file. |
Function GetNextrec returns a TOprec record with the next case.
If no more cases are found, function returns false, otherwise true.
Procedure Saverec saves a case passed in a TOprec when mode is Write or Append.
Saverec calls the OnEvaluate function to fill in the results fields, and
optionally run time microseconds. If OnEvaluate does not fill in run
time, Saverec will do it. .
The included demo program, BigIntsRegrTest, contains
most of the arithmetic functions of TInteger, including a couple with
Boolean results. An executable version compiled with an
older version of TInteger of UBigIntsV2, the unit containing the
TInteger class, is included in the zip file for constructing or
adding to case files. The current version included in the DFFLibV03
library as of September 8 is included here so that those not otherwise
requiring the library file, can compile and see typical old vs. new
Running/Exploring the Program
Suggestions for Further Explorations
September 7, 2005
July 29, 2017