When creating software, data types are the basic bricks. Most of the time a programmer will use data types defined in library modules, therefore being tested by many users over many years. But sometimes, the appropriate data type is unavailable in the libraries and has to be constructed from scratch. In this way, new basic bricks are created, and potentially used in many products in the future. It pays off to test such data types thoroughly.
This paper presents a structured methodology to follow when testing data types using Quviq QuickCheck, a tool for random testing against specifications. The validation process will be explained carefully, from the convenience of defining a model for the datatype to be tested, to a strategy for better shrinking of failing test cases, and including the benefits of working with symbolic representations.
The leading example in this paper is a data type implemented for a risk management information system, a commercial product developed in Erlang, that has been used on a daily basis for several years.
[1]
Laura M. Castro,et al.
Formalisation of a Functional Risk Management System
,
2006,
ICEIS.
[2]
Robert W. Floyd,et al.
Assigning meaning to programs
,
1967
.
[3]
V.M. Gulfas,et al.
A new risk management approach deployed over a client/server distributed functional architecture
,
2005,
18th International Conference on Systems Engineering (ICSEng'05).
[4]
Koen Claessen,et al.
QuickCheck: a lightweight tool for random testing of Haskell programs
,
2000,
ICFP.
[5]
C. A. R. Hoare,et al.
Proof of correctness of data representations
,
1972,
Acta Informatica.
[6]
Laura M. Castro,et al.
ARMISTICE: an experience developing management software with Erlang
,
2003,
ERLANG '03.
[7]
John Hughes,et al.
Testing telecoms software with quviq QuickCheck
,
2006,
ERLANG '06.
[8]
Ansi Ieee,et al.
IEEE Standard for Binary Floating Point Arithmetic
,
1985
.