Visual Assert – The Unit Testing Add-In for Visual C++
cfix – C/C++ Unit Testing for Win32 and NT
 
 

Fixture definition (C++ only)

Fixture definition (C++ only)

The WinUnit API supports two kinds of tests -- standalone tests (definded with BEGIN_TEST and END_TEST), and fixtures (defined with FIXTURE and BEGIN_TESTF/END_TESTF).

#include <winunit.h>

//
// 'Standalone' tests.
//
BEGIN_TEST( ExampleStandaloneTest )
{
  WIN_ASSERT_EQUAL( 1, 1 );
  WIN_ASSERT_STRING_EQUAL( "foo bar", "foo bar" );
}
END_TEST

//
// Fixture.
//
FIXTURE( TestFixture );

SETUP( TestFixture )
{    
  WIN_TRACE( L"Setting up" );
}

TEARDOWN( TestFixture )
{
  WIN_TRACE( L"Tearing down" );
}

BEGIN_TESTF( Test, TestFixture )
{
  WIN_ASSERT_EQUAL( 1, 1 );
  WIN_ASSERT_STRING_EQUAL( "foo bar", "foo bar" );
}
END_TESTF