English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Exceptions Handling and Unit Testing.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-09-21 (23:23)
From: chris.danx <chris.danx@n...>
Subject: Re: [Caml-list] Exceptions Handling and Unit Testing.
Oops!  I keep clicking reply instead of reply all! :(

Thanks for all the suggestions.  It looks like I was generalising the 
wrong thing (concentrating on handling the exception, rather than the 
identification of a test repeated for different inputs).

Instead I created a function which does the test and catches a specific 
exception but with the test data supplied as parameters.  This enables 
constructing tests as closures from sample cases (each case has a test 
name, sample data and a message should the test fail), with the 
extension to lists of sample cases being a trivial application of 
List.map.  Cases are added by putting them in a list.

Simple really. *slaps himself for being stupid*


To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners