aboutsummaryrefslogtreecommitdiff
path: root/test/cxxtest/sample
diff options
context:
space:
mode:
Diffstat (limited to 'test/cxxtest/sample')
-rw-r--r--test/cxxtest/sample/Construct64
-rw-r--r--test/cxxtest/sample/CreatedTest.h31
-rw-r--r--test/cxxtest/sample/DeltaTest.h27
-rw-r--r--test/cxxtest/sample/EnumTraits.h39
-rw-r--r--test/cxxtest/sample/ExceptionTest.h52
-rw-r--r--test/cxxtest/sample/FixtureTest.h37
-rwxr-xr-xtest/cxxtest/sample/Makefile.PL32
-rw-r--r--test/cxxtest/sample/Makefile.bcc3294
-rw-r--r--test/cxxtest/sample/Makefile.msvc93
-rw-r--r--test/cxxtest/sample/Makefile.unix88
-rw-r--r--test/cxxtest/sample/MessageTest.h30
-rw-r--r--test/cxxtest/sample/SimpleTest.h59
-rw-r--r--test/cxxtest/sample/TraitsTest.h69
-rw-r--r--test/cxxtest/sample/aborter.tpl16
-rw-r--r--test/cxxtest/sample/file_printer.tpl22
-rw-r--r--test/cxxtest/sample/gui/GreenYellowRed.h57
-rw-r--r--test/cxxtest/sample/mock/Dice.cpp14
-rw-r--r--test/cxxtest/sample/mock/Dice.h13
-rw-r--r--test/cxxtest/sample/mock/Makefile22
-rw-r--r--test/cxxtest/sample/mock/MockStdlib.h31
-rw-r--r--test/cxxtest/sample/mock/T/stdlib.h13
-rw-r--r--test/cxxtest/sample/mock/TestDice.h62
-rw-r--r--test/cxxtest/sample/mock/mock_stdlib.cpp2
-rw-r--r--test/cxxtest/sample/mock/real_stdlib.cpp2
-rw-r--r--test/cxxtest/sample/mock/roll.cpp11
-rw-r--r--test/cxxtest/sample/msvc/CxxTest_1_Run.dsp93
-rw-r--r--test/cxxtest/sample/msvc/CxxTest_2_Build.dsp94
-rw-r--r--test/cxxtest/sample/msvc/CxxTest_3_Generate.dsp93
-rw-r--r--test/cxxtest/sample/msvc/CxxTest_Workspace.dsw59
-rw-r--r--test/cxxtest/sample/msvc/FixFiles.bat212
-rw-r--r--test/cxxtest/sample/msvc/Makefile36
-rw-r--r--test/cxxtest/sample/msvc/ReadMe.txt30
-rw-r--r--test/cxxtest/sample/only.tpl33
-rw-r--r--test/cxxtest/sample/parts/Makefile.unix39
-rw-r--r--test/cxxtest/sample/winddk/Makefile2
-rw-r--r--test/cxxtest/sample/winddk/Makefile.inc15
-rw-r--r--test/cxxtest/sample/winddk/RunTests.tpl13
-rw-r--r--test/cxxtest/sample/winddk/SOURCES46
-rw-r--r--test/cxxtest/sample/yes_no_runner.cpp11
39 files changed, 1756 insertions, 0 deletions
diff --git a/test/cxxtest/sample/Construct b/test/cxxtest/sample/Construct
new file mode 100644
index 0000000000..b8019616a9
--- /dev/null
+++ b/test/cxxtest/sample/Construct
@@ -0,0 +1,64 @@
+# -*- Perl -*-
+
+#
+# This file shows how to use CxxTest with Cons
+#
+
+$env = new cons( CXX => ("$^O" eq 'MSWin32') ? 'cl -nologo -GX' : 'c++',
+ CPPPATH => '..',
+ CXXTESTGEN => 'perl -w ../cxxtestgen.pl' );
+
+@tests = <*.h>;
+
+# The error printer is the most basic runner
+CxxTestErrorPrinter $env 'error_printer', @tests;
+
+# You can also specify which runner you want to use
+CxxTestRunner $env 'stdio_printer', 'StdioPrinter', @tests;
+
+# For more control, use template files
+CxxTestTemplate $env 'file_printer', 'file_printer.tpl', @tests;
+
+# Or, you can always separate the tests from the runner
+CxxTest $env 'tests.cpp', '', @tests;
+Program $env 'yes_no_runner', ('yes_no_runner.cpp', 'tests.cpp');
+
+
+#
+# Here is the code used to build these files
+# You can use this in your own Construct files
+#
+
+# cons::CxxTest $env $dst, $options, @srcs
+# Generates a CxxTest source file, passing the specified options to cxxtestgen
+sub cons::CxxTest($$$@) {
+ my ($env, $dst, $options, @srcs) = @_;
+ Command $env $dst, @srcs, "%CXXTESTGEN -o %> ${options} %<";
+}
+
+# cons::CxxTestTemplate $env $dst, $template, @srcs
+# Generates and builds a CxxTest runner using a template file
+sub cons::CxxTestTemplate($$$@) {
+ my ($env, $dst, $template, @srcs) = @_;
+ my $source = "${dst}.cpp";
+ CxxTest $env $source, "--template=${template}", ($template, @srcs);
+ Program $env $dst, $source;
+}
+
+# cons::CxxTestRunner $env $dst, $runner, @srcs
+# Generates and builds a CxxTest runner using the --runner option
+sub cons::CxxTestRunner($$$@) {
+ my ($env, $dst, $runner, @srcs) = @_;
+ my $source = "${dst}.cpp";
+ CxxTest $env $source, "--runner=${runner}", @srcs;
+ Program $env $dst, $source;
+}
+
+# cons::CxxTestErrorPrinter $env $dst, @srcs
+# Generates and builds a CxxTest ErrorPrinter
+sub cons::CxxTestErrorPrinter($$@) {
+ my ($env, $dst, @srcs) = @_;
+ CxxTestRunner $env $dst, 'ErrorPrinter', @srcs;
+}
+
+
diff --git a/test/cxxtest/sample/CreatedTest.h b/test/cxxtest/sample/CreatedTest.h
new file mode 100644
index 0000000000..84e8ae8a4b
--- /dev/null
+++ b/test/cxxtest/sample/CreatedTest.h
@@ -0,0 +1,31 @@
+#ifndef __CREATEDTEST_H
+#define __CREATEDTEST_H
+
+#include <cxxtest/TestSuite.h>
+#include <string.h>
+#include <memory.h>
+
+//
+// This test suite shows what to do when your test case
+// class cannot be instantiated statically.
+// As an example, this test suite requires a non-default constructor.
+//
+
+class CreatedTest : public CxxTest::TestSuite
+{
+ char *_buffer;
+public:
+ CreatedTest( unsigned size ) : _buffer( new char[size] ) {}
+ virtual ~CreatedTest() { delete [] _buffer; }
+
+ static CreatedTest *createSuite() { return new CreatedTest( 16 ); }
+ static void destroySuite( CreatedTest *suite ) { delete suite; }
+
+ void test_nothing()
+ {
+ TS_FAIL( "Nothing to test" );
+ }
+};
+
+
+#endif // __CREATEDTEST_H
diff --git a/test/cxxtest/sample/DeltaTest.h b/test/cxxtest/sample/DeltaTest.h
new file mode 100644
index 0000000000..7223c3af25
--- /dev/null
+++ b/test/cxxtest/sample/DeltaTest.h
@@ -0,0 +1,27 @@
+#ifndef __DELTATEST_H
+#define __DELTATEST_H
+
+#include <cxxtest/TestSuite.h>
+#include <math.h>
+
+class DeltaTest : public CxxTest::TestSuite
+{
+ double _pi, _delta;
+
+public:
+ void setUp()
+ {
+ _pi = 3.1415926535;
+ _delta = 0.0001;
+ }
+
+ void testSine()
+ {
+ TS_ASSERT_DELTA( sin(0.0), 0.0, _delta );
+ TS_ASSERT_DELTA( sin(_pi / 6), 0.5, _delta );
+ TS_ASSERT_DELTA( sin(_pi / 2), 1.0, _delta );
+ TS_ASSERT_DELTA( sin(_pi), 0.0, _delta );
+ }
+};
+
+#endif // __DELTATEST_H
diff --git a/test/cxxtest/sample/EnumTraits.h b/test/cxxtest/sample/EnumTraits.h
new file mode 100644
index 0000000000..1a987318f6
--- /dev/null
+++ b/test/cxxtest/sample/EnumTraits.h
@@ -0,0 +1,39 @@
+//
+// This is a test of CxxTest's ValueTraits for enumerations.
+//
+#include <cxxtest/TestSuite.h>
+
+//
+// First define your enumeration
+//
+enum Answer {
+ Yes,
+ No,
+ Maybe,
+ DontKnow,
+ DontCare
+};
+
+//
+// Now make CxxTest aware of it
+//
+CXXTEST_ENUM_TRAITS( Answer,
+ CXXTEST_ENUM_MEMBER( Yes )
+ CXXTEST_ENUM_MEMBER( No )
+ CXXTEST_ENUM_MEMBER( Maybe )
+ CXXTEST_ENUM_MEMBER( DontKnow )
+ CXXTEST_ENUM_MEMBER( DontCare ) );
+
+class EnumTraits : public CxxTest::TestSuite
+{
+public:
+ void test_Enum_traits()
+ {
+ TS_FAIL( Yes );
+ TS_FAIL( No );
+ TS_FAIL( Maybe );
+ TS_FAIL( DontKnow );
+ TS_FAIL( DontCare );
+ TS_FAIL( (Answer)1000 );
+ }
+};
diff --git a/test/cxxtest/sample/ExceptionTest.h b/test/cxxtest/sample/ExceptionTest.h
new file mode 100644
index 0000000000..68363c8740
--- /dev/null
+++ b/test/cxxtest/sample/ExceptionTest.h
@@ -0,0 +1,52 @@
+#ifndef __EXCEPTIONTEST_H
+#define __EXCEPTIONTEST_H
+
+#include <cxxtest/TestSuite.h>
+
+//
+// This test suite demonstrates the use of TS_ASSERT_THROWS
+//
+
+class ExceptionTest : public CxxTest::TestSuite
+{
+public:
+ void testAssertion( void )
+ {
+ // This assert passes, since throwThis() throws (Number)
+ TS_ASSERT_THROWS( throwThis(3), const Number & );
+ // This assert passes, since throwThis() throws something
+ TS_ASSERT_THROWS_ANYTHING( throwThis(-30) );
+ // This assert fails, since throwThis() doesn't throw char *
+ TS_ASSERT_THROWS( throwThis(5), const char * );
+ // This assert fails since goodFunction() throws nothing
+ TS_ASSERT_THROWS_ANYTHING( goodFunction(1) );
+ // The regular TS_ASSERT macros will catch unhandled exceptions
+ TS_ASSERT_EQUALS( throwThis(3), 333 );
+ // You can assert that a function throws nothing
+ TS_ASSERT_THROWS_NOTHING( throwThis(-1) );
+ // If you want to catch the exceptions yourself, use the ETS_ marcos
+ try {
+ ETS_ASSERT_EQUALS( throwThis(3), 333 );
+ } catch( const Number & ) {
+ TS_FAIL( "throwThis(3) failed" );
+ }
+ }
+
+private:
+ void goodFunction( int )
+ {
+ }
+
+ class Number
+ {
+ public:
+ Number( int ) {}
+ };
+
+ int throwThis( int i )
+ {
+ throw Number( i );
+ }
+};
+
+#endif // __EXCEPTIONTEST_H
diff --git a/test/cxxtest/sample/FixtureTest.h b/test/cxxtest/sample/FixtureTest.h
new file mode 100644
index 0000000000..653c7a14ae
--- /dev/null
+++ b/test/cxxtest/sample/FixtureTest.h
@@ -0,0 +1,37 @@
+#ifndef __FIXTURETEST_H
+#define __FIXTURETEST_H
+
+#include <cxxtest/TestSuite.h>
+#include <string.h>
+
+//
+// This test suite shows how to use setUp() and tearDown()
+// to initialize data common to all tests.
+// setUp()/tearDown() will be called before and after each
+// test.
+//
+
+class FixtureTest : public CxxTest::TestSuite
+{
+ char *_buffer;
+public:
+ void setUp()
+ {
+ _buffer = new char[1024];
+ }
+
+ void tearDown()
+ {
+ delete [] _buffer;
+ }
+
+ void test_strcpy()
+ {
+ strcpy( _buffer, "Hello, world!" );
+ TS_ASSERT_EQUALS( _buffer[0], 'H' );
+ TS_ASSERT_EQUALS( _buffer[1], 'E' );
+ }
+};
+
+
+#endif // __FIXTURETEST_H
diff --git a/test/cxxtest/sample/Makefile.PL b/test/cxxtest/sample/Makefile.PL
new file mode 100755
index 0000000000..d29afcc688
--- /dev/null
+++ b/test/cxxtest/sample/Makefile.PL
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+#
+# This isn't a "real" `Makefile.PL'
+# It just copies the correct `Makefile.*' to `Makefile'
+#
+use strict;
+use Getopt::Long;
+use File::Copy;
+
+sub usage() {
+ die "Usage: $0 [--bcc32]\n";
+}
+
+my $source;
+my $target = 'Makefile';
+my $windows = $ENV{'windir'};
+
+GetOptions( 'bcc32' => sub { $source = 'Makefile.bcc32' } ) or usage();
+if ( !defined( $source ) ) {
+ $source = $windows ? 'Makefile.msvc' : 'Makefile.unix';
+}
+
+unlink($target);
+$windows ? copy($source, $target) : symlink($source, $target);
+
+print "`Makefile' is now `$source'.\n";
+
+#
+# Local Variables:
+# compile-command: "perl Makefile.PL"
+# End:
+#
diff --git a/test/cxxtest/sample/Makefile.bcc32 b/test/cxxtest/sample/Makefile.bcc32
new file mode 100644
index 0000000000..907b98d596
--- /dev/null
+++ b/test/cxxtest/sample/Makefile.bcc32
@@ -0,0 +1,94 @@
+#
+# Makefile for Borland C++
+# Make sure bcc32.exe is in the PATH or change CXXC below
+#
+
+# For the Win32 GUI
+#WIN32_FLAGS = user32.lib comctl32.lib
+
+# For the Qt GUI
+#QTDIR = c:\qt
+QT_FLAGS = -I$(QTDIR)/include $(QTDIR)/lib/qt.lib
+
+
+TARGETS = error_printer.exe stdio_printer.exe yes_no_runner.exe file_printer.exe aborter.exe only.exe
+GUI_TARGETS = win32_runner.exe qt_runner.exe
+TESTS = *.h
+GUI_TESTS = gui/GreenYellowRed.h $(TESTS)
+TESTGEN = perl -w ../cxxtestgen.pl
+CXXC = bcc32.exe -w- -I. -I..
+
+all: $(TARGETS)
+
+clean:
+ del *~ *.o *.obj
+ del $(TARGETS)
+ del $(GUI_TARGETS)
+ del tests.cpp error_printer.cpp stdio_printer.cpp file_printer.cpp aborter.cpp only.cpp
+ del win32_runner.cpp qt_runner.cpp
+
+distclean: clean
+ del Makefile
+
+run: error_printer.exe
+ error_printer.exe
+
+run_win32: win32_runner.exe
+ win32_runner.exe
+
+run_qt: qt_runner.exe
+ qt_runner.exe
+
+error_printer.cpp: $(TESTS)
+ $(TESTGEN) -o error_printer.cpp --error-printer $(TESTS)
+
+stdio_printer.cpp: $(TESTS)
+ $(TESTGEN) -o stdio_printer.cpp --runner=StdioPrinter $(TESTS)
+
+file_printer.cpp: file_printer.tpl $(TESTS)
+ $(TESTGEN) -o file_printer.cpp --template=file_printer.tpl $(TESTS)
+
+aborter.cpp: aborter.tpl $(TESTS)
+ $(TESTGEN) -o aborter.cpp --template=aborter.tpl $(TESTS)
+
+only.cpp: only.tpl $(TESTS)
+ $(TESTGEN) -o only.cpp --template=only.tpl $(TESTS)
+
+tests.cpp: $(TESTS)
+ $(TESTGEN) -o tests.cpp $(TESTS)
+
+win32_runner.cpp: $(GUI_TESTS)
+ $(TESTGEN) -o win32_runner.cpp --gui=Win32Gui $(GUI_TESTS)
+
+qt_runner.cpp: $(GUI_TESTS)
+ $(TESTGEN) -o qt_runner.cpp --gui=QtGui $(GUI_TESTS)
+
+error_printer.exe: error_printer.cpp
+ $(CXXC) -eerror_printer.exe error_printer.cpp
+
+stdio_printer.exe: stdio_printer.cpp
+ $(CXXC) -estdio_printer.exe stdio_printer.cpp
+
+file_printer.exe: file_printer.cpp
+ $(CXXC) -efile_printer.exe file_printer.cpp
+
+only.exe: only.cpp
+ $(CXXC) -eonly.exe only.cpp
+
+aborter.exe: aborter.cpp
+ $(CXXC) -eaborter.exe aborter.cpp
+
+yes_no_runner.exe: yes_no_runner.cpp tests.cpp
+ $(CXXC) -eyes_no_runner.exe yes_no_runner.cpp tests.cpp
+
+win32_runner.exe: win32_runner.cpp
+ $(CXXC) -ewin32_runner.exe win32_runner.cpp $(WIN32_FLAGS)
+
+qt_runner.exe: qt_runner.cpp
+ $(CXXC) -o qt_runner.exe qt_runner.cpp $(QT_FLAGS)
+
+#
+# Local Variables:
+# compile-command: "make -fMakefile.bcc32"
+# End:
+#
diff --git a/test/cxxtest/sample/Makefile.msvc b/test/cxxtest/sample/Makefile.msvc
new file mode 100644
index 0000000000..35ce2f9b17
--- /dev/null
+++ b/test/cxxtest/sample/Makefile.msvc
@@ -0,0 +1,93 @@
+#
+# Makefile for Microsoft Visual C++
+# Make sure cl.exe is in the PATH (run vcvars.bat) or change CXXC below
+#
+
+# For the Win32 GUI
+WIN32_FLAGS = user32.lib
+
+# For the Qt GUI
+# QTDIR = c:\qt
+QT_FLAGS = -I$(QTDIR)/include $(QTDIR)/lib/qt.lib
+
+TARGETS = error_printer.exe stdio_printer.exe yes_no_runner.exe file_printer.exe aborter.exe only.exe
+GUI_TARGETS = win32_runner.exe qt_runner.exe
+TESTS = *.h
+GUI_TESTS = gui/GreenYellowRed.h $(TESTS)
+TESTGEN = perl -w ../cxxtestgen.pl
+CXXC = cl.exe -GX -W3 -WX -I. -I..
+
+all: $(TARGETS)
+
+clean:
+ del *~ *.o *.obj
+ del $(TARGETS)
+ del $(GUI_TARGETS)
+ del tests.cpp error_printer.cpp stdio_printer.cpp file_printer.cpp aborter.cpp only.cpp
+ del win32_runner.cpp qt_runner.cpp
+
+distclean: clean
+ del Makefile
+
+run: error_printer.exe
+ error_printer.exe
+
+run_win32: win32_runner.exe
+ win32_runner.exe
+
+run_qt: qt_runner.exe
+ qt_runner.exe
+
+error_printer.cpp: $(TESTS)
+ $(TESTGEN) -o error_printer.cpp --error-printer $(TESTS)
+
+stdio_printer.cpp: $(TESTS)
+ $(TESTGEN) -o stdio_printer.cpp --runner=StdioPrinter $(TESTS)
+
+file_printer.cpp: file_printer.tpl $(TESTS)
+ $(TESTGEN) -o file_printer.cpp --template=file_printer.tpl $(TESTS)
+
+aborter.cpp: aborter.tpl $(TESTS)
+ $(TESTGEN) -o aborter.cpp --template=aborter.tpl $(TESTS)
+
+only.cpp: only.tpl $(TESTS)
+ $(TESTGEN) -o only.cpp --template=only.tpl $(TESTS)
+
+tests.cpp: $(TESTS)
+ $(TESTGEN) -o tests.cpp $(TESTS)
+
+win32_runner.cpp: $(GUI_TESTS)
+ $(TESTGEN) -o win32_runner.cpp --gui=Win32Gui $(GUI_TESTS)
+
+qt_runner.cpp: $(GUI_TESTS)
+ $(TESTGEN) -o qt_runner.cpp --gui=QtGui $(GUI_TESTS)
+
+error_printer.exe: error_printer.cpp
+ $(CXXC) -o error_printer.exe error_printer.cpp
+
+stdio_printer.exe: stdio_printer.cpp
+ $(CXXC) -o stdio_printer.exe stdio_printer.cpp
+
+file_printer.exe: file_printer.cpp
+ $(CXXC) -o file_printer.exe file_printer.cpp
+
+only.exe: only.cpp
+ $(CXXC) -o only.exe only.cpp
+
+aborter.exe: aborter.cpp
+ $(CXXC) -o aborter.exe aborter.cpp
+
+yes_no_runner.exe: yes_no_runner.cpp tests.cpp
+ $(CXXC) -o yes_no_runner.exe yes_no_runner.cpp tests.cpp
+
+win32_runner.exe: win32_runner.cpp
+ $(CXXC) -o win32_runner.exe win32_runner.cpp $(WIN32_FLAGS)
+
+qt_runner.exe: qt_runner.cpp
+ $(CXXC) -o qt_runner.exe qt_runner.cpp $(QT_FLAGS)
+
+#
+# Local Variables:
+# compile-command: "nmake -fMakefile.msvc"
+# End:
+#
diff --git a/test/cxxtest/sample/Makefile.unix b/test/cxxtest/sample/Makefile.unix
new file mode 100644
index 0000000000..ee52c8f77a
--- /dev/null
+++ b/test/cxxtest/sample/Makefile.unix
@@ -0,0 +1,88 @@
+#
+# Makefile for UN*X-like systems
+#
+
+# Change this line if you want a different compiler
+CXXC = c++ -Wall -W -Werror -I. -I..
+
+# If you want to use python, specify USE_PYTHON=1 on the command line
+ifdef USE_PYTHON
+ TESTGEN = ../cxxtestgen.py
+else
+ TESTGEN = ../cxxtestgen.pl
+endif
+
+# For the X11 GUI
+X11_FLAGS = -I/usr/X11R6/include -L/usr/X11R6/lib -lX11
+
+# For the Qt GUI
+#QTDIR = /usr/lib/qt
+QTLIB = -lqt-mt
+#QTLIB = -lqt
+QT_FLAGS = -I$(QTDIR)/include -L$(QTDIR)/lib $(QTLIB) -O2
+
+TARGETS = error_printer stdio_printer yes_no_runner file_printer aborter only
+GUI_TARGETS = x11_runner qt_runner
+TESTS = *.h
+GUI_TESTS = gui/GreenYellowRed.h $(TESTS)
+
+all: $(TARGETS)
+
+clean:
+ rm -f *~ *.o *.obj $(TARGETS) $(GUI_TARGETS)
+ rm -f tests.cpp error_printer.cpp stdio_printer.cpp file_printer.cpp aborter.cpp only.cpp
+ rm -f x11_runner.cpp qt_runner.cpp
+
+distclean: clean
+ rm -f Makefile
+
+run: error_printer
+ ./error_printer
+
+run_x11: x11_runner
+ ./x11_runner
+
+run_qt: qt_runner
+ ./qt_runner
+
+error_printer.cpp: $(TESTS)
+ $(TESTGEN) -o $@ --error-printer $(TESTS)
+
+stdio_printer.cpp: $(TESTS)
+ $(TESTGEN) -o $@ --runner=StdioPrinter $(TESTS)
+
+file_printer.cpp: file_printer.tpl $(TESTS)
+ $(TESTGEN) -o $@ --template=file_printer.tpl $(TESTS)
+
+aborter.cpp: aborter.tpl $(TESTS)
+ $(TESTGEN) -o $@ --template=aborter.tpl $(TESTS)
+
+only.cpp: only.tpl $(TESTS)
+ $(TESTGEN) -o $@ --template=only.tpl $(TESTS)
+
+tests.cpp: $(TESTS)
+ $(TESTGEN) -o $@ $(TESTS)
+
+x11_runner.cpp: $(GUI_TESTS)
+ $(TESTGEN) -o $@ --gui=X11Gui $(GUI_TESTS)
+
+qt_runner.cpp: $(GUI_TESTS)
+ $(TESTGEN) -o $@ --gui=QtGui $(GUI_TESTS)
+
+%: %.cpp
+ $(CXXC) -o $@ $<
+
+yes_no_runner: yes_no_runner.cpp tests.cpp
+ $(CXXC) -o $@ $^
+
+x11_runner: x11_runner.cpp
+ $(CXXC) -o $@ $^ $(X11_FLAGS)
+
+qt_runner: qt_runner.cpp
+ $(CXXC) -o $@ $^ $(QT_FLAGS)
+
+#
+# Local Variables:
+# compile-command: "make -fMakefile.unix"
+# End:
+#
diff --git a/test/cxxtest/sample/MessageTest.h b/test/cxxtest/sample/MessageTest.h
new file mode 100644
index 0000000000..621289f78d
--- /dev/null
+++ b/test/cxxtest/sample/MessageTest.h
@@ -0,0 +1,30 @@
+#ifndef __MESSAGETEST_H
+#define __MESSAGETEST_H
+
+#include <cxxtest/TestSuite.h>
+
+//
+// The [E]TSM_ macros can be used to print a specified message
+// instead of the default one.
+// This is useful when you refactor your tests, as shown below
+//
+
+class MessageTest : public CxxTest::TestSuite
+{
+public:
+ void testValues()
+ {
+ checkValue( 0, "My hovercraft" );
+ checkValue( 1, "is full" );
+ checkValue( 2, "of eels" );
+ }
+
+ void checkValue( unsigned value, const char *message )
+ {
+ TSM_ASSERT( message, value != 0 );
+ TSM_ASSERT_EQUALS( message, value, value * value );
+ }
+};
+
+
+#endif // __MESSAGETEST_H
diff --git a/test/cxxtest/sample/SimpleTest.h b/test/cxxtest/sample/SimpleTest.h
new file mode 100644
index 0000000000..b3fae12cad
--- /dev/null
+++ b/test/cxxtest/sample/SimpleTest.h
@@ -0,0 +1,59 @@
+#ifndef __SIMPLETEST_H
+#define __SIMPLETEST_H
+
+#include <cxxtest/TestSuite.h>
+
+//
+// A simple test suite: Just inherit CxxTest::TestSuite and write tests!
+//
+
+class SimpleTest : public CxxTest::TestSuite
+{
+public:
+ void testEquality()
+ {
+ TS_ASSERT_EQUALS( 1, 1 );
+ TS_ASSERT_EQUALS( 1, 2 );
+ TS_ASSERT_EQUALS( 'a', 'A' );
+ TS_ASSERT_EQUALS( 1.0, -12345678900000000000000000000000000000000000000000.1234 );
+ }
+
+ void testAddition()
+ {
+ TS_ASSERT_EQUALS( 1 + 1, 2 );
+ TS_ASSERT_EQUALS( 2 + 2, 5 );
+ }
+
+ void TestMultiplication()
+ {
+ TS_ASSERT_EQUALS( 2 * 2, 4 );
+ TS_ASSERT_EQUALS( 4 * 4, 44 );
+ TS_ASSERT_DIFFERS( -2 * -2, 4 );
+ }
+
+ void testComparison()
+ {
+ TS_ASSERT_LESS_THAN( (int)1, (unsigned long)2 );
+ TS_ASSERT_LESS_THAN( -1, -2 );
+ }
+
+ void testTheWorldIsCrazy()
+ {
+ TS_ASSERT_EQUALS( true, false );
+ }
+
+ void test_Failure()
+ {
+ TS_FAIL( "Not implemented" );
+ TS_FAIL( 1569779912 );
+ }
+
+ void test_TS_WARN_macro()
+ {
+ TS_WARN( "Just a friendly warning" );
+ TS_WARN( "Warnings don't abort the test" );
+ }
+};
+
+
+#endif // __SIMPLETEST_H
diff --git a/test/cxxtest/sample/TraitsTest.h b/test/cxxtest/sample/TraitsTest.h
new file mode 100644
index 0000000000..14659385d0
--- /dev/null
+++ b/test/cxxtest/sample/TraitsTest.h
@@ -0,0 +1,69 @@
+#ifndef __TRAITSTEST_H
+#define __TRAITSTEST_H
+
+//
+// This example shows how to use TS_ASSERT_EQUALS for your own classes
+//
+#include <cxxtest/TestSuite.h>
+#include <cxxtest/ValueTraits.h>
+
+//
+// Define your class with operator==
+//
+#include <stdio.h>
+#include <string.h>
+
+class Pet
+{
+ char _name[128];
+public:
+ Pet( const char *petName ) { strcpy( _name, petName ); }
+
+ const char *name() const { return _name; }
+
+ bool operator== ( const Pet &other ) const
+ {
+ return !strcmp( name(), other.name() );
+ }
+};
+
+//
+// Instantiate CxxTest::ValueTraits<*your class*>
+// Note: Most compilers do not require that you define both
+// ValueTraits<const T> and ValueTraits<T>, but some do.
+//
+namespace CxxTest
+{
+ CXXTEST_TEMPLATE_INSTANTIATION
+ class ValueTraits<const Pet>
+ {
+ char _asString[256];
+
+ public:
+ ValueTraits( const Pet &pet ) { sprintf( _asString, "Pet(\"%s\")", pet.name() ); }
+ const char *asString() const { return _asString; }
+ };
+
+ CXXTEST_COPY_CONST_TRAITS( Pet );
+}
+
+//
+// Here's how it works
+//
+class TestFunky : public CxxTest::TestSuite
+{
+public:
+ void testPets()
+ {
+ Pet pet1("dog"), pet2("cat");
+ TS_ASSERT_EQUALS( pet1, pet2 );
+ Pet cat("cat"), gato("cat");
+ TS_ASSERT_DIFFERS( cat, gato );
+#ifdef _CXXTEST_HAVE_STD
+ typedef CXXTEST_STD(string) String;
+ TS_ASSERT_EQUALS( String("Hello"), String("World!") );
+#endif // _CXXTEST_HAVE_STD
+ }
+};
+
+#endif // __TRAITSTEST_H
diff --git a/test/cxxtest/sample/aborter.tpl b/test/cxxtest/sample/aborter.tpl
new file mode 100644
index 0000000000..14fc50d2c7
--- /dev/null
+++ b/test/cxxtest/sample/aborter.tpl
@@ -0,0 +1,16 @@
+// -*- C++ -*-
+// This template file demonstrates the use of CXXTEST_ABORT_TEST_ON_FAIL
+//
+
+#define CXXTEST_HAVE_STD
+#define CXXTEST_ABORT_TEST_ON_FAIL
+#include <cxxtest/ErrorPrinter.h>
+
+int main()
+{
+ return CxxTest::ErrorPrinter().run();
+}
+
+// The CxxTest "world"
+<CxxTest world>
+
diff --git a/test/cxxtest/sample/file_printer.tpl b/test/cxxtest/sample/file_printer.tpl
new file mode 100644
index 0000000000..a9627d6d0d
--- /dev/null
+++ b/test/cxxtest/sample/file_printer.tpl
@@ -0,0 +1,22 @@
+// -*- C++ -*-
+// This is a sample of a custom test runner
+// using CxxTest template files.
+// This prints the output to a file given on the command line.
+//
+
+#include <cxxtest/StdioPrinter.h>
+#include <stdio.h>
+
+int main( int argc, char *argv[] )
+{
+ if ( argc != 2 ) {
+ fprintf( stderr, "Usage: %s <output file name>\n", argv[0] );
+ return -1;
+ }
+
+ return CxxTest::StdioPrinter( fopen( argv[1], "w" ) ).run();
+}
+
+// The CxxTest "world"
+<CxxTest world>
+
diff --git a/test/cxxtest/sample/gui/GreenYellowRed.h b/test/cxxtest/sample/gui/GreenYellowRed.h
new file mode 100644
index 0000000000..446b23345f
--- /dev/null
+++ b/test/cxxtest/sample/gui/GreenYellowRed.h
@@ -0,0 +1,57 @@
+#include <cxxtest/TestSuite.h>
+
+#ifdef _WIN32
+# include <windows.h>
+# define CXXTEST_SAMPLE_GUI_WAIT() Sleep( 1000 )
+#else // !_WIN32
+ extern "C" unsigned sleep( unsigned seconds );
+# define CXXTEST_SAMPLE_GUI_WAIT() sleep( 1 )
+#endif // _WIN32
+
+class GreenYellowRed : public CxxTest::TestSuite
+{
+public:
+ void wait()
+ {
+ CXXTEST_SAMPLE_GUI_WAIT();
+ }
+
+ void test_Start_green()
+ {
+ wait();
+ }
+
+ void test_Green_again()
+ {
+ TS_TRACE( "Still green" );
+ wait();
+ }
+
+ void test_Now_yellow()
+ {
+ TS_WARN( "Yellow" );
+ wait();
+ }
+
+ void test_Cannot_go_back()
+ {
+ wait();
+ }
+
+ void test_Finally_red()
+ {
+ TS_FAIL( "Red" );
+ wait();
+ }
+
+ void test_Cannot_go_back_to_yellow()
+ {
+ TS_WARN( "Yellow?" );
+ wait();
+ }
+
+ void test_Cannot_go_back_to_green()
+ {
+ wait();
+ }
+};
diff --git a/test/cxxtest/sample/mock/Dice.cpp b/test/cxxtest/sample/mock/Dice.cpp
new file mode 100644
index 0000000000..161b80fa2b
--- /dev/null
+++ b/test/cxxtest/sample/mock/Dice.cpp
@@ -0,0 +1,14 @@
+#include <T/stdlib.h>
+#include "Dice.h"
+
+Dice::Dice()
+{
+ T::srand( T::time( 0 ) );
+}
+
+unsigned Dice::roll()
+{
+ return (T::rand() % 6) + 1;
+}
+
+
diff --git a/test/cxxtest/sample/mock/Dice.h b/test/cxxtest/sample/mock/Dice.h
new file mode 100644
index 0000000000..94271417e1
--- /dev/null
+++ b/test/cxxtest/sample/mock/Dice.h
@@ -0,0 +1,13 @@
+#ifndef __DICE_H
+#define __DICE_H
+
+class Dice
+{
+public:
+ Dice();
+
+ unsigned roll();
+};
+
+#endif // __DICE_H
+
diff --git a/test/cxxtest/sample/mock/Makefile b/test/cxxtest/sample/mock/Makefile
new file mode 100644
index 0000000000..709b7cbe95
--- /dev/null
+++ b/test/cxxtest/sample/mock/Makefile
@@ -0,0 +1,22 @@
+all: roll run
+
+clean:
+ rm -f *~ *.o roll test test.cpp
+
+CXXTEST = ../..
+CCFLAGS = -I. -I$(CXXTEST)
+
+roll: roll.o Dice.o real_stdlib.o
+ g++ -o $@ $^
+
+run: test
+ ./test
+
+test: test.o Dice.o mock_stdlib.o
+ g++ -o $@ $^
+
+.cpp.o:
+ g++ -c -o $@ $(CCFLAGS) $<
+
+test.cpp: TestDice.h
+ $(CXXTEST)/cxxtestgen.pl -o $@ --error-printer $<
diff --git a/test/cxxtest/sample/mock/MockStdlib.h b/test/cxxtest/sample/mock/MockStdlib.h
new file mode 100644
index 0000000000..aee62bafe7
--- /dev/null
+++ b/test/cxxtest/sample/mock/MockStdlib.h
@@ -0,0 +1,31 @@
+#include <T/stdlib.h>
+
+class MockStdlib :
+ public T::Base_srand,
+ public T::Base_rand,
+ public T::Base_time
+{
+public:
+ unsigned lastSeed;
+
+ void srand( unsigned seed )
+ {
+ lastSeed = seed;
+ }
+
+ int nextRand;
+
+ int rand()
+ {
+ return nextRand;
+ }
+
+ time_t nextTime;
+
+ time_t time( time_t *t )
+ {
+ if ( t )
+ *t = nextTime;
+ return nextTime;
+ }
+};
diff --git a/test/cxxtest/sample/mock/T/stdlib.h b/test/cxxtest/sample/mock/T/stdlib.h
new file mode 100644
index 0000000000..30306ba22b
--- /dev/null
+++ b/test/cxxtest/sample/mock/T/stdlib.h
@@ -0,0 +1,13 @@
+#ifndef __T__STDLIB_H
+#define __T__STDLIB_H
+
+#include <stdlib.h>
+#include <time.h>
+
+#include <cxxtest/Mock.h>
+
+CXXTEST_MOCK_VOID_GLOBAL( srand, ( unsigned seed ), ( seed ) );
+CXXTEST_MOCK_GLOBAL( int, rand, ( void ), () );
+CXXTEST_MOCK_GLOBAL( time_t, time, ( time_t *t ), ( t ) );
+
+#endif // __T__STDLIB_H
diff --git a/test/cxxtest/sample/mock/TestDice.h b/test/cxxtest/sample/mock/TestDice.h
new file mode 100644
index 0000000000..35b3b7eec9
--- /dev/null
+++ b/test/cxxtest/sample/mock/TestDice.h
@@ -0,0 +1,62 @@
+#include <cxxtest/TestSuite.h>
+#include "Dice.h"
+#include "MockStdlib.h"
+
+class TestDice : public CxxTest::TestSuite
+{
+public:
+ MockStdlib *stdlib;
+
+ void setUp()
+ {
+ TS_ASSERT( stdlib = new MockStdlib );
+ }
+
+ void tearDown()
+ {
+ delete stdlib;
+ }
+
+ void test_Randomize_uses_time()
+ {
+ stdlib->nextTime = 12345;
+ Dice dice;
+ TS_ASSERT_EQUALS( stdlib->lastSeed, 12345 );
+ }
+
+ void test_Roll()
+ {
+ Dice dice;
+
+ stdlib->nextRand = 0;
+ TS_ASSERT_EQUALS( dice.roll(), 1 );
+
+ stdlib->nextRand = 2;
+ TS_ASSERT_EQUALS( dice.roll(), 3 );
+
+ stdlib->nextRand = 5;
+ TS_ASSERT_EQUALS( dice.roll(), 6 );
+
+ stdlib->nextRand = 7;
+ TS_ASSERT_EQUALS( dice.roll(), 2 );
+ }
+
+ void test_Temporary_override_of_one_mock_function()
+ {
+ Dice dice;
+
+ stdlib->nextRand = 2;
+ TS_ASSERT_EQUALS( dice.roll(), 3 );
+
+ class Five : public T::Base_rand { int rand() { return 5; } };
+
+ Five *five = new Five;
+ TS_ASSERT_EQUALS( dice.roll(), 6 );
+ TS_ASSERT_EQUALS( dice.roll(), 6 );
+ TS_ASSERT_EQUALS( dice.roll(), 6 );
+ delete five;
+
+ stdlib->nextRand = 1;
+ TS_ASSERT_EQUALS( dice.roll(), 2 );
+ }
+};
diff --git a/test/cxxtest/sample/mock/mock_stdlib.cpp b/test/cxxtest/sample/mock/mock_stdlib.cpp
new file mode 100644
index 0000000000..148a044d26
--- /dev/null
+++ b/test/cxxtest/sample/mock/mock_stdlib.cpp
@@ -0,0 +1,2 @@
+#define CXXTEST_MOCK_TEST_SOURCE_FILE
+#include <T/stdlib.h>
diff --git a/test/cxxtest/sample/mock/real_stdlib.cpp b/test/cxxtest/sample/mock/real_stdlib.cpp
new file mode 100644
index 0000000000..db02f3a154
--- /dev/null
+++ b/test/cxxtest/sample/mock/real_stdlib.cpp
@@ -0,0 +1,2 @@
+#define CXXTEST_MOCK_REAL_SOURCE_FILE
+#include <T/stdlib.h>
diff --git a/test/cxxtest/sample/mock/roll.cpp b/test/cxxtest/sample/mock/roll.cpp
new file mode 100644
index 0000000000..20ea967af3
--- /dev/null
+++ b/test/cxxtest/sample/mock/roll.cpp
@@ -0,0 +1,11 @@
+#include <stdio.h>
+#include "Dice.h"
+
+int main()
+{
+ Dice dice;
+ printf( "First roll: %u\n", dice.roll() );
+ printf( "Second roll: %u\n", dice.roll() );
+
+ return 0;
+}
diff --git a/test/cxxtest/sample/msvc/CxxTest_1_Run.dsp b/test/cxxtest/sample/msvc/CxxTest_1_Run.dsp
new file mode 100644
index 0000000000..9ab9114d53
--- /dev/null
+++ b/test/cxxtest/sample/msvc/CxxTest_1_Run.dsp
@@ -0,0 +1,93 @@
+# Microsoft Developer Studio Project File - Name="CxxTest_1_Run" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=CxxTest_1_Run - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CxxTest_1_Run.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CxxTest_1_Run.mak" CFG="CxxTest_1_Run - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CxxTest_1_Run - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "CxxTest_1_Run - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "CxxTest_1_Run - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f CxxTest_1_Run.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "CxxTest_1_Run.exe"
+# PROP BASE Bsc_Name "CxxTest_1_Run.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "nmake DIR=Release run"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "Release\run.log"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "CxxTest_1_Run - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f CxxTest_1_Run.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "CxxTest_1_Run.exe"
+# PROP BASE Bsc_Name "CxxTest_1_Run.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "nmake DIR=Debug run"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "Debug\run.log"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "CxxTest_1_Run - Win32 Release"
+# Name "CxxTest_1_Run - Win32 Debug"
+
+!IF "$(CFG)" == "CxxTest_1_Run - Win32 Release"
+
+!ELSEIF "$(CFG)" == "CxxTest_1_Run - Win32 Debug"
+
+!ENDIF
+
+# Begin Source File
+
+SOURCE=.\Makefile
+# End Source File
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# End Target
+# End Project
diff --git a/test/cxxtest/sample/msvc/CxxTest_2_Build.dsp b/test/cxxtest/sample/msvc/CxxTest_2_Build.dsp
new file mode 100644
index 0000000000..301320d84b
--- /dev/null
+++ b/test/cxxtest/sample/msvc/CxxTest_2_Build.dsp
@@ -0,0 +1,94 @@
+# Microsoft Developer Studio Project File - Name="CxxTest_2_Build" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=CxxTest_2_Build - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CxxTest_2_Build.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CxxTest_2_Build.mak" CFG="CxxTest_2_Build - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CxxTest_2_Build - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "CxxTest_2_Build - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "CxxTest_2_Build - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x40d /d "NDEBUG"
+# ADD RSC /l 0x40d /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"Release/runner.exe"
+
+!ELSEIF "$(CFG)" == "CxxTest_2_Build - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40d /d "_DEBUG"
+# ADD RSC /l 0x40d /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/runner.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "CxxTest_2_Build - Win32 Release"
+# Name "CxxTest_2_Build - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\runner.cpp
+# End Source File
+# End Target
+# End Project
diff --git a/test/cxxtest/sample/msvc/CxxTest_3_Generate.dsp b/test/cxxtest/sample/msvc/CxxTest_3_Generate.dsp
new file mode 100644
index 0000000000..1dd6d4dc5d
--- /dev/null
+++ b/test/cxxtest/sample/msvc/CxxTest_3_Generate.dsp
@@ -0,0 +1,93 @@
+# Microsoft Developer Studio Project File - Name="CxxTest_3_Generate" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) External Target" 0x0106
+
+CFG=CxxTest_3_Generate - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CxxTest_3_Generate.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CxxTest_3_Generate.mak" CFG="CxxTest_3_Generate - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CxxTest_3_Generate - Win32 Release" (based on "Win32 (x86) External Target")
+!MESSAGE "CxxTest_3_Generate - Win32 Debug" (based on "Win32 (x86) External Target")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+
+!IF "$(CFG)" == "CxxTest_3_Generate - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Cmd_Line "NMAKE /f CxxTest_3_Generate.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "CxxTest_3_Generate.exe"
+# PROP BASE Bsc_Name "CxxTest_3_Generate.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Cmd_Line "nmake runner.cpp"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "runner.cpp"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ELSEIF "$(CFG)" == "CxxTest_3_Generate - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Cmd_Line "NMAKE /f CxxTest_3_Generate.mak"
+# PROP BASE Rebuild_Opt "/a"
+# PROP BASE Target_File "CxxTest_3_Generate.exe"
+# PROP BASE Bsc_Name "CxxTest_3_Generate.bsc"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Cmd_Line "nmake runner.cpp"
+# PROP Rebuild_Opt "/a"
+# PROP Target_File "runner.cpp"
+# PROP Bsc_Name ""
+# PROP Target_Dir ""
+
+!ENDIF
+
+# Begin Target
+
+# Name "CxxTest_3_Generate - Win32 Release"
+# Name "CxxTest_3_Generate - Win32 Debug"
+
+!IF "$(CFG)" == "CxxTest_3_Generate - Win32 Release"
+
+!ELSEIF "$(CFG)" == "CxxTest_3_Generate - Win32 Debug"
+
+!ENDIF
+
+# Begin Source File
+
+SOURCE=.\Makefile
+# End Source File
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# End Target
+# End Project
diff --git a/test/cxxtest/sample/msvc/CxxTest_Workspace.dsw b/test/cxxtest/sample/msvc/CxxTest_Workspace.dsw
new file mode 100644
index 0000000000..9a88de6ef7
--- /dev/null
+++ b/test/cxxtest/sample/msvc/CxxTest_Workspace.dsw
@@ -0,0 +1,59 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "CxxTest_1_Run"=.\CxxTest_1_Run.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name CxxTest_2_Build
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "CxxTest_2_Build"=.\CxxTest_2_Build.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+ Begin Project Dependency
+ Project_Dep_Name CxxTest_3_Generate
+ End Project Dependency
+}}}
+
+###############################################################################
+
+Project: "CxxTest_3_Generate"=.\CxxTest_3_Generate.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/test/cxxtest/sample/msvc/FixFiles.bat b/test/cxxtest/sample/msvc/FixFiles.bat
new file mode 100644
index 0000000000..fb14a6c495
--- /dev/null
+++ b/test/cxxtest/sample/msvc/FixFiles.bat
@@ -0,0 +1,212 @@
+@rem = '--*-Perl-*--
+@echo off
+if "%OS%" == "Windows_NT" goto WinNT
+perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+goto endofperl
+:WinNT
+perl -x -S %0 %*
+if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
+if %errorlevel% == 9009 echo You do not have Perl in your PATH.
+if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
+goto endofperl
+@rem ';
+#!/usr/bin/perl -w
+#line 15
+use strict;
+use English;
+use Getopt::Long;
+
+$OUTPUT_AUTOFLUSH = 1;
+
+sub usage() {
+ print STDERR "Usage: $0 <OPTIONS>\n\n";
+ print STDERR "Fix Makefile and CxxTest_2_Build.dsp for your setup.\n\n";
+ print STDERR " --cxxtest=DIR Assume CxxTest is installed in DIR (default: '..\\..')\n";
+ print STDERR " --tests=SPEC Use SPEC for the test files (default: '../gui/*.h ../*.h')\n\n";
+ print STDERR "You must specify at least one option.\n";
+ exit -1;
+}
+
+my ($cxxtest, $tests);
+my ($Makefile, $CxxTest_2_Build);
+
+sub main {
+ parseCommandline();
+ fixFiles();
+}
+
+sub parseCommandline() {
+ GetOptions( 'cxxtest=s' => \$cxxtest,
+ 'tests=s' => \$tests,
+ ) or usage();
+
+ usage() unless (defined($cxxtest) || defined($tests));
+ $cxxtest = '..\\..' unless defined($cxxtest);
+ $tests = '../gui/*.h ../*.h' unless defined($tests);
+}
+
+sub fixFiles() {
+ fixFile( $Makefile, 'Makefile' );
+ fixFile( $CxxTest_2_Build, 'CxxTest_2_Build.dsp' );
+}
+
+sub fixFile($$) {
+ my ($data, $output) = @_;
+
+ print "$output...";
+
+ $data =~ s/<TESTS>/$tests/g;
+ $data =~ s/<CXXTEST>/$cxxtest/g;
+
+ open OUTPUT, ">$output" or die "Cannot create output file \"$output\"\n";
+ print OUTPUT $data;
+ close OUTPUT;
+
+ print "OK\n";
+}
+
+$Makefile =
+'# Where to look for the tests
+TESTS = <TESTS>
+
+# Where the CxxTest distribution is unpacked
+CXXTESTDIR = <CXXTEST>
+
+# Check CXXTESTDIR
+!if !exist($(CXXTESTDIR)\cxxtestgen.pl)
+!error Please fix CXXTESTDIR
+!endif
+
+# cxxtestgen needs Perl or Python
+!if defined(PERL)
+CXXTESTGEN = $(PERL) $(CXXTESTDIR)/cxxtestgen.pl
+!elseif defined(PYTHON)
+CXXTESTGEN = $(PYTHON) $(CXXTESTDIR)/cxxtestgen.py
+!else
+!error You must define PERL or PYTHON
+!endif
+
+# The arguments to pass to cxxtestgen
+# - ParenPrinter is the way MSVC likes its compilation errors
+# - --have-eh/--abort-on-fail are nice when you have them
+CXXTESTGEN_FLAGS = --gui=Win32Gui --runner=ParenPrinter --have-eh --abort-on-fail
+
+# How to generate the test runner, "runner.cpp"
+runner.cpp: $(TESTS)
+ $(CXXTESTGEN) $(CXXTESTGEN_FLAGS) -o $@ $(TESTS)
+
+# Command-line arguments to the runner
+RUNNER_FLAGS = -title "CxxTest Runner"
+
+# How to run the tests, which should be in DIR\runner.exe
+run: $(DIR)\runner.exe
+ $(DIR)\runner.exe $(RUNNER_FLAGS)
+';
+
+$CxxTest_2_Build =
+'# Microsoft Developer Studio Project File - Name="CxxTest_2_Build" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=CxxTest_2_Build - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "CxxTest_2_Build.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "CxxTest_2_Build.mak" CFG="CxxTest_2_Build - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "CxxTest_2_Build - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "CxxTest_2_Build - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "CxxTest_2_Build - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "<CXXTEST>" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x40d /d "NDEBUG"
+# ADD RSC /l 0x40d /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"Release/runner.exe"
+
+!ELSEIF "$(CFG)" == "CxxTest_2_Build - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "<CXXTEST>" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD BASE RSC /l 0x40d /d "_DEBUG"
+# ADD RSC /l 0x40d /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /out:"Debug/runner.exe" /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "CxxTest_2_Build - Win32 Release"
+# Name "CxxTest_2_Build - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\ReadMe.txt
+# End Source File
+# Begin Source File
+
+SOURCE=.\runner.cpp
+# End Source File
+# End Target
+# End Project
+';
+
+main();
+
+__END__
+:endofperl
+
+rem
+rem Local Variables:
+rem compile-command: "perl FixFiles.bat"
+rem End:
+rem
diff --git a/test/cxxtest/sample/msvc/Makefile b/test/cxxtest/sample/msvc/Makefile
new file mode 100644
index 0000000000..606004d4cf
--- /dev/null
+++ b/test/cxxtest/sample/msvc/Makefile
@@ -0,0 +1,36 @@
+# Where to look for the tests
+TESTS = ..\gui\*.h ..\*.h
+
+# Where the CxxTest distribution is unpacked
+CXXTESTDIR = ..\..
+
+# Check CXXTESTDIR
+!if !exist($(CXXTESTDIR)\cxxtestgen.pl)
+!error Please fix CXXTESTDIR
+!endif
+
+# cxxtestgen needs Perl or Python
+!if defined(PERL)
+CXXTESTGEN = $(PERL) $(CXXTESTDIR)/cxxtestgen.pl
+!elseif defined(PYTHON)
+CXXTESTGEN = $(PYTHON) $(CXXTESTDIR)/cxxtestgen.py
+!else
+!error You must define PERL or PYTHON
+!endif
+
+# The arguments to pass to cxxtestgen
+# - ParenPrinter is the way MSVC likes its compilation errors
+# - --have-eh/--abort-on-fail are nice when you have them
+CXXTESTGEN_FLAGS = \
+ --gui=Win32Gui \
+ --runner=ParenPrinter \
+ --have-eh \
+ --abort-on-fail
+
+# How to generate the test runner, `runner.cpp'
+runner.cpp: $(TESTS)
+ $(CXXTESTGEN) $(CXXTESTGEN_FLAGS) -o $@ $(TESTS)
+
+# How to run the tests, which should be in DIR\runner.exe
+run: $(DIR)\runner.exe
+ $(DIR)\runner.exe
diff --git a/test/cxxtest/sample/msvc/ReadMe.txt b/test/cxxtest/sample/msvc/ReadMe.txt
new file mode 100644
index 0000000000..816fce45b0
--- /dev/null
+++ b/test/cxxtest/sample/msvc/ReadMe.txt
@@ -0,0 +1,30 @@
+Sample files for Visual Studio
+==============================
+
+There are three projects in this workspace:
+
+ - CxxTest_3_Generate runs cxxtestgen to create runner.cpp
+ - CxxTest_2_Build compiles the generated file
+ - CxxTest_1_Run runs the compiled binary
+
+Whenever you build this workspace, the tests are run, and any failed assertions
+are displayed as compilation errors (you can browse them using F4).
+
+Note that to run this sample, you need first to create an environment
+variable PERL or PYTHON, e.g. PERL=c:\perl\bin\perl.exe
+
+
+To use these .dsp and .dsw files in your own project, run FixFiles.bat
+to adjust them to where you've placed CxxTest and your own tests.
+
+If you want to use just the .dsp files in your own workspace, don't
+forget to:
+
+ - Set up the dependencies (CxxTest_3_Generate depends on
+ CxxTest_2_Build which depends on CxxTest_1_Run)
+
+ - Add your own include paths, libraries etc. to the CxxTest_2_Build project
+
+
+NOTE: I haven't used "Post-Build Step" to run the tests because I
+wanted the tests to be executed even if nothing has changed.
diff --git a/test/cxxtest/sample/only.tpl b/test/cxxtest/sample/only.tpl
new file mode 100644
index 0000000000..b2a7277cf6
--- /dev/null
+++ b/test/cxxtest/sample/only.tpl
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+#include <cxxtest/StdioPrinter.h>
+#include <stdio.h>
+
+int main( int argc, char *argv[] )
+{
+ if ( argc < 2 || argc > 3 ) {
+ fprintf( stderr, "Usage: only <suite name> [<test name>]\n\n" );
+ fprintf( stderr, "Available tests:\n" );
+ CxxTest::RealWorldDescription wd;
+ for ( CxxTest::SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() )
+ for ( CxxTest::TestDescription *td = sd->firstTest(); td; td = td->next() )
+ fprintf( stderr, " - %s::%s()\n", sd->suiteName(), td->testName() );
+ return 1;
+ }
+
+ const char *suiteName = argv[1];
+ const char *testName = (argc > 2) ? argv[2] : 0;
+ if ( !CxxTest::leaveOnly( suiteName, testName ) ) {
+ if ( testName )
+ fprintf( stderr, "Cannot find %s::%s()\n", argv[1], argv[2] );
+ else
+ fprintf( stderr, "Cannot find class %s\n", argv[1] );
+ return 2;
+ }
+
+ return CxxTest::StdioPrinter().run();
+}
+
+
+// The CxxTest "world"
+<CxxTest world>
+
diff --git a/test/cxxtest/sample/parts/Makefile.unix b/test/cxxtest/sample/parts/Makefile.unix
new file mode 100644
index 0000000000..5e6ae4e43c
--- /dev/null
+++ b/test/cxxtest/sample/parts/Makefile.unix
@@ -0,0 +1,39 @@
+#
+# (GNU) Makefile for UN*X-like systems
+# This makefile shows how to make a different runner for each test
+#
+
+.PHONY: all clean
+
+all: run
+
+clean:
+ rm -f *~ *.cpp *.o runner
+
+CXXTESTDIR = ../..
+CXXTESTGEN = $(CXXTESTDIR)/cxxtestgen.pl
+CXXTESTFLAGS = --have-eh --abort-on-fail
+
+TESTS = $(wildcard ../*Test.h)
+OBJS = runner.o $(TESTS:../%.h=%.o)
+
+run: runner
+ ./runner
+
+runner: $(OBJS)
+ c++ -o $@ $^
+
+%.o: %.cpp
+ c++ -c -o $@ -I $(CXXTESTDIR) -I .. $^
+
+%.cpp: ../%.h
+ $(CXXTESTGEN) $(CXXTESTFLAGS) --part -o $@ $^
+
+runner.cpp:
+ $(CXXTESTGEN) $(CXXTESTFLAGS) --root --error-printer -o $@
+
+#
+# Local Variables:
+# compile-command: "make -fMakefile.unix"
+# End:
+#
diff --git a/test/cxxtest/sample/winddk/Makefile b/test/cxxtest/sample/winddk/Makefile
new file mode 100644
index 0000000000..8bf25333e8
--- /dev/null
+++ b/test/cxxtest/sample/winddk/Makefile
@@ -0,0 +1,2 @@
+# Standard DDK Makefile
+!include $(NTMAKEENV)\makefile.def
diff --git a/test/cxxtest/sample/winddk/Makefile.inc b/test/cxxtest/sample/winddk/Makefile.inc
new file mode 100644
index 0000000000..edc6f8c8cb
--- /dev/null
+++ b/test/cxxtest/sample/winddk/Makefile.inc
@@ -0,0 +1,15 @@
+# -*- Makefile -*-
+
+#
+# Tell the DDK how to generate RunTests.cpp from RunTests.tpl and the tests
+#
+
+PERL=perl
+PYTHON=python
+CXXTESTGEN=$(PERL) $(CXXTESTDIR)/cxxtestgen.pl
+#CXXTESTGEN=$(PYTHON) $(CXXTESTDIR)/cxxtestgen.py
+
+TEST_SUITES=$(SUITESDIR)/*.h
+
+RunTests.cpp: RunTests.tpl $(TEST_SUITES)
+ $(CXXTESTGEN) -o $@ --template=RunTests.tpl $(TEST_SUITES)
diff --git a/test/cxxtest/sample/winddk/RunTests.tpl b/test/cxxtest/sample/winddk/RunTests.tpl
new file mode 100644
index 0000000000..917f14b4d6
--- /dev/null
+++ b/test/cxxtest/sample/winddk/RunTests.tpl
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+
+//
+// The DDK doesn't handle <iostream> too well
+//
+#include <cxxtest/StdioPrinter.h>
+
+int __cdecl main()
+{
+ return CxxTest::StdioPrinter().run();
+}
+
+<CxxTest world>
diff --git a/test/cxxtest/sample/winddk/SOURCES b/test/cxxtest/sample/winddk/SOURCES
new file mode 100644
index 0000000000..dae0148885
--- /dev/null
+++ b/test/cxxtest/sample/winddk/SOURCES
@@ -0,0 +1,46 @@
+# -*- Makefile -*-
+
+#
+# Build this sample with the Windows DDK (XP or later)
+#
+SUITESDIR=..
+CXXTESTDIR=../..
+
+#
+# Build a user-mode application
+#
+TARGETNAME=RunTests
+TARGETPATH=.
+TARGETTYPE=PROGRAM
+
+#
+# Make it a console-mode app
+#
+UMTYPE=console
+
+#
+# Add CxxTest and tests directory to include path
+#
+INCLUDES=$(SUITESDIR);$(CXXTESTDIR)
+
+#
+# Enable exception handling and standard library
+#
+USE_NATIVE_EH=1
+LINKER_FLAGS=$(LINKER_FLAGS) -IGNORE:4099
+386_WARNING_LEVEL=-W3 -WX -wd4290
+
+TARGETLIBS=\
+ $(CRT_LIB_PATH)\libcp.lib \
+ $(CRT_LIB_PATH)\libc.lib
+
+#
+# Only one source file -- the generated test runner
+#
+SOURCES=RunTests.cpp
+
+#
+# This line tells the build utility to process Makefile.inc
+#
+NTTARGETFILE0=RunTests.cpp
+
diff --git a/test/cxxtest/sample/yes_no_runner.cpp b/test/cxxtest/sample/yes_no_runner.cpp
new file mode 100644
index 0000000000..c32b94cd5c
--- /dev/null
+++ b/test/cxxtest/sample/yes_no_runner.cpp
@@ -0,0 +1,11 @@
+//
+// A sample program that uses class YesNoRunner to run all the tests
+// and find out if all pass.
+//
+
+#include <cxxtest/YesNoRunner.h>
+
+int main()
+{
+ return CxxTest::YesNoRunner().run();
+}