<?xml version="1.0" encoding="windows-1252"?>
<node id="480791" title="Re: When test-driven development just won't do" created="2005-08-04 08:18:25" updated="2005-08-11 08:34:53">
<type id="11">
note</type>
<author id="961">
Anonymous Monk</author>
<data>
<field name="doctext">
There are a lot of things I would like to test, but I've no idea how to write tests for. For instance, how do you write a test that tests your objects (or other datastructures) timely destruct? That is, they get garbage collected at the moment you think they are, and aren't kept alive (consuming more memory you think they do) longer than they are supposed to due to an unexpected reference loop? Sure, you could add a DESTROY function that sets a global flag, but that would be a heavy price to pay.
&lt;p&gt;
How do you test your shuffling or die rolling technique is fair and produces results according to your specifications (say, according to a Gaussing distribution), and isn't biased favouring certain outcomes? 
&lt;p&gt;
&lt;blockquote&gt;
A common case where tests pass is with the &lt;tt&gt;can_ok $CLASS, $method;&lt;/tt&gt; test.
&lt;/blockquote&gt;
That's a test I wouldn't use without a testing &lt;tt&gt;$method&lt;/tt&gt; itself as well - because it's a test which isn't interesting if it passes. It's interesting if it fails, because that you know the method isn't there, but if it's there, and doesn't do what it's supposed to do, its existance isn't useful. So, if I use this test, it would preceede the tests that test &lt;tt&gt;$method&lt;/tt&gt;.</field>
<field name="root_node">
480680</field>
<field name="parent_node">
480680</field>
<field name="reputation">
16</field>
</data>
</node>
