listing multiple unit test failures

Spacen Jasset spacen at yahoo.co.uk
Tue Mar 11 12:08:13 PDT 2008


	I have started some unit tests:

	unittest
	{
		// Check row column indexing is correct
		Matrix	m;
		m[2,0] = 59;
		assert(m.matrix_flat[2]==59, "opIndexAssign failed");
		assert(m.matrix_flat[8]!=59, "opIndexAssign failed");
		
	}

If an assert fails the other assertions in a program do not fire. This 
is inconvient since the "real bug" introduced may be caused by some 
other assertion that has not been evaluated yet.

What I am looking for, therefore is more of a writefln of each failure, 
together with a single assertion to abort the program if any test has 
failed.

If there isn't such a feature then I suppose I need a "Global" class 
which holds a bit flag to be set when an assertion is registered, and 
then in main this class could be made to assert if the flag is set.


More information about the Digitalmars-d-learn mailing list