Michel Fortin wrote:
Walter had a point... what if you want to test multiple outputs of the same 
function on one go? Here's an example:

        unittest {
                int[3] result = makeSomeTable(399, 383, 927);
                assert(result[0] == 281);
                assert(result[1] == 281);
                assert(result[2] == 281);
        }

Here, each assert is independent one from another and knowing that the first 
and the third fails but not the second might help diagnose the problem.

I think Jonathan's idea is quite on the spot. It'd allow you to write this:

        unittest {
                int[3] result = makeSomeTable(399, 383, 927);
                unittest { assert(result[0] == 281); }
                unittest { assert(result[1] == 281); }
                unittest { assert(result[2] == 281); }
        }

and each "unittest assert" becomes an independent test that may fail but 
without interrupting the flow of the outside scope.

That the use mode I was thinking of. Right after I hit send, I realized that what I had said would include allowing unittests in main.

_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to