//==============================================================================
//
// DTest - the (simple) Test class in the objc-site
//
// Copyright (C) 2002 Dick van Oudheusden
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free
// Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//==============================================================================
//
// $Date: 2003/10/07 18:10:40 $ $Revision: 1.1 $
//==============================================================================
#include "DTest.h"
#include <stdio.h>
//
//
// The DTest module contains a number of methods for testing other classes.
//
//
static long tested = 0;
static long failed = 0;
//
// Start the test
//
// @param name the name of the object
//
void startTest(const char *name)
{
tested = 0;
failed = 0;
printf("%s:", name); fflush(stdout);
}
//
// Check the result of a test.
//
// @param result the boolean result of the test
// @param line the line in the class of the test
//
void checkTest(int result, long line)
{
tested++;
if (!result)
{
failed++;
printf("%ld,", line);
}
}
//
// Stop the test
//
//
void stopTest()
{
if (failed == 0)
{
printf("ok\n");
}
else
{
printf("(%ld/%ld)\n", tested - failed, tested);
}
}
/*===========================================================================*/
syntax highlighted by Code2HTML, v. 0.9.1