[Cosm Logo]

Main Include and Self-tests


v3Test

Syntax

#include "cosm.h"
s32 v3Test( s32 * failed_module, s32 * failed_test, s32 module_num );

Description

If module_num is 0, then test all Cosm functions and return a negative number corresponding to the module that failed. failed_module and failed_test will be set to the corresponding failed functions. Otherwise test only the module module_num.

Users will probably find the predefined arrays V3_TEST_MODULES useful, see example below.

Return Values

V3_PASS on success, or a negative number corresponding to the module that failed.

Errors

A negative number will be returned corresponding to the module/test that failed.

Example

  const ascii * test_modules[] = V3_TEST_MODULES;
  s32 error;
  s32 error2;

  v3PrintA( (ascii *) "Running system tests... " );
  if ( v3Test( &error, &error2, 0 ) != V3_PASS )
  {
    v3PrintA( (ascii *) "Self-test failure in module %.16s %i.\n",
      test_modules[( -error > V3_TEST_MODULE_MAX ) ? 0 : -error],
      error2 );
    v3ProcessEnd( error );
  }
  v3PrintA( (ascii *) "all passed.\n" );

© Copyright Mithral Communications & Design Inc. 1995-2003. All rights reserved. Mithral® and Cosm® are trademarks of Mithral Communications & Design Inc.
Document last modified: May 22, 2003