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:19:22 EDT (-0400)
  Re: Unit testing - simple question with long explanation for discussion...  
From: Darren New
Date: 8 Jan 2009 18:58:11
Message: <49669313$1@news.povray.org>
Orchid XP v8 wrote:
>> Look, you have to figure out every possible case to *write* the code, 
>> yes?
> 
> Yeah. But you sit down and write some code which you think should work, 
> and then you have to write lots of test cases for
> 
> - Does it fail on a zero-length literal name. [The spec explicitly 
> *allows* such names.]
> - Does it correctly handle [what would otherwise be] comments inside a 
> literal string?
> - Does it choke if the input contains a comment [and so is non-empty] 
> but no further actual tokens?
> - Does it parse all possible reals, but not invalid ones such as "." and 
> "e1"?
> - Does it handle balanced brackets and escaped brackets in strings?

There's a good start. Why do you think it's hard?

> It's easy to *think* you got all these working, only to suddenly 
> discover that in some sufficiently obscure case it falls over. :-/

Testing doesn't prove the absence of bugs, only the presence of bugs.

> I'm not aware of any Adobe implementation that's freely available. 

Ghostscript would probably do pretty close, then. :-)

> (Except perhaps for the one inside the nearest laser printer. 

That one was far from free. :-)

> already tried to get that to parse stuff; it didn't seem to want to do 
> it for some reason.)

Sometimes you need to wrap it up in actual page description stuff, by which 
I mean the magic comments that mark the start and end of pages and such.

-- 
   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.