POV-Ray : Newsgroups : povray.off-topic : Unit testing - simple question with long explanation for discussion... : Re: Unit testing - simple question with long explanation for discussion... Server Time
6 Sep 2024 11:20:32 EDT (-0400)
  Re: Unit testing - simple question with long explanation for discussion...  
From: Darren New
Date: 5 Jan 2009 17:37:34
Message: <49628bae$1@news.povray.org>
Orchid XP v8 wrote:
> I'm currently trying to implement a PostScript interpretter. Do you have 
> *any idea* how non-trivial it is to come up with good tests which cover 
> all possible corner-cases? Do you have any idea how you verify what the 
> "correct" result is even supposed to be? 

I don't think that's "unit tests", tho.  Normally, a "unit test" covers what 
would normally be one class, and not a whole operation. If you're building 
lots of data structures, unit tests can give you confidence that the data 
structure meets its postconditions and invariants. Stuff like inserting into 
a hash table keeps the same size if the key is a repeat, or increases the 
size by one if the key isn't a repeat.  I can imagine lots of tests for a 
postscript parser: The string "one two three" parses into three words, the 
word "three" winds up on top of the stack, that "1.0" parses as a number but 
"1X0" doesn't, etc.

I think my problem is that most of the data structures I use are either 
complex SQL tables, or hash tables and arrays provided by the language, so I 
rarely have any kinds of code where there's an obvious pre- and 
post-condition to it. If there were, someone else would have already written 
it to death. :-?

-- 
   Darren New, San Diego CA, USA (PST)
   Why is there a chainsaw in DOOM?
   There aren't any trees on Mars.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.