diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2016-10-03 20:51:05 +0000 |
|---|---|---|
| committer | jabiertxof <info@marker.es> | 2016-10-03 20:51:05 +0000 |
| commit | 4db35e8a6706ddece9e977e5f26d4a6867ff8cbe (patch) | |
| tree | f9711f260f694d96e26bf3216fb64f2b38611b2b /cxxtest/sample | |
| parent | update to trunk (diff) | |
| parent | Merge in jabiertxof's hover information for measure tool (diff) | |
| download | inkscape-4db35e8a6706ddece9e977e5f26d4a6867ff8cbe.tar.gz inkscape-4db35e8a6706ddece9e977e5f26d4a6867ff8cbe.zip | |
Update to trunk
(bzr r15017.1.35)
Diffstat (limited to 'cxxtest/sample')
39 files changed, 0 insertions, 1756 deletions
diff --git a/cxxtest/sample/Construct b/cxxtest/sample/Construct deleted file mode 100644 index b8019616a..000000000 --- a/cxxtest/sample/Construct +++ /dev/null @@ -1,64 +0,0 @@ -# -*- 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/cxxtest/sample/CreatedTest.h b/cxxtest/sample/CreatedTest.h deleted file mode 100644 index 84e8ae8a4..000000000 --- a/cxxtest/sample/CreatedTest.h +++ /dev/null @@ -1,31 +0,0 @@ -#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/cxxtest/sample/DeltaTest.h b/cxxtest/sample/DeltaTest.h deleted file mode 100644 index 7223c3af2..000000000 --- a/cxxtest/sample/DeltaTest.h +++ /dev/null @@ -1,27 +0,0 @@ -#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/cxxtest/sample/EnumTraits.h b/cxxtest/sample/EnumTraits.h deleted file mode 100644 index 1a987318f..000000000 --- a/cxxtest/sample/EnumTraits.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// 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/cxxtest/sample/ExceptionTest.h b/cxxtest/sample/ExceptionTest.h deleted file mode 100644 index 68363c874..000000000 --- a/cxxtest/sample/ExceptionTest.h +++ /dev/null @@ -1,52 +0,0 @@ -#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/cxxtest/sample/FixtureTest.h b/cxxtest/sample/FixtureTest.h deleted file mode 100644 index 653c7a14a..000000000 --- a/cxxtest/sample/FixtureTest.h +++ /dev/null @@ -1,37 +0,0 @@ -#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/cxxtest/sample/Makefile.PL b/cxxtest/sample/Makefile.PL deleted file mode 100755 index d29afcc68..000000000 --- a/cxxtest/sample/Makefile.PL +++ /dev/null @@ -1,32 +0,0 @@ -#!/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/cxxtest/sample/Makefile.bcc32 b/cxxtest/sample/Makefile.bcc32 deleted file mode 100644 index 907b98d59..000000000 --- a/cxxtest/sample/Makefile.bcc32 +++ /dev/null @@ -1,94 +0,0 @@ -# -# 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/cxxtest/sample/Makefile.msvc b/cxxtest/sample/Makefile.msvc deleted file mode 100644 index 35ce2f9b1..000000000 --- a/cxxtest/sample/Makefile.msvc +++ /dev/null @@ -1,93 +0,0 @@ -# -# 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/cxxtest/sample/Makefile.unix b/cxxtest/sample/Makefile.unix deleted file mode 100644 index ee52c8f77..000000000 --- a/cxxtest/sample/Makefile.unix +++ /dev/null @@ -1,88 +0,0 @@ -# -# 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/cxxtest/sample/MessageTest.h b/cxxtest/sample/MessageTest.h deleted file mode 100644 index 621289f78..000000000 --- a/cxxtest/sample/MessageTest.h +++ /dev/null @@ -1,30 +0,0 @@ -#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/cxxtest/sample/SimpleTest.h b/cxxtest/sample/SimpleTest.h deleted file mode 100644 index b3fae12ca..000000000 --- a/cxxtest/sample/SimpleTest.h +++ /dev/null @@ -1,59 +0,0 @@ -#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/cxxtest/sample/TraitsTest.h b/cxxtest/sample/TraitsTest.h deleted file mode 100644 index 14659385d..000000000 --- a/cxxtest/sample/TraitsTest.h +++ /dev/null @@ -1,69 +0,0 @@ -#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/cxxtest/sample/aborter.tpl b/cxxtest/sample/aborter.tpl deleted file mode 100644 index 14fc50d2c..000000000 --- a/cxxtest/sample/aborter.tpl +++ /dev/null @@ -1,16 +0,0 @@ -// -*- 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/cxxtest/sample/file_printer.tpl b/cxxtest/sample/file_printer.tpl deleted file mode 100644 index a9627d6d0..000000000 --- a/cxxtest/sample/file_printer.tpl +++ /dev/null @@ -1,22 +0,0 @@ -// -*- 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/cxxtest/sample/gui/GreenYellowRed.h b/cxxtest/sample/gui/GreenYellowRed.h deleted file mode 100644 index 446b23345..000000000 --- a/cxxtest/sample/gui/GreenYellowRed.h +++ /dev/null @@ -1,57 +0,0 @@ -#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/cxxtest/sample/mock/Dice.cpp b/cxxtest/sample/mock/Dice.cpp deleted file mode 100644 index 161b80fa2..000000000 --- a/cxxtest/sample/mock/Dice.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#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/cxxtest/sample/mock/Dice.h b/cxxtest/sample/mock/Dice.h deleted file mode 100644 index 94271417e..000000000 --- a/cxxtest/sample/mock/Dice.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef __DICE_H -#define __DICE_H - -class Dice -{ -public: - Dice(); - - unsigned roll(); -}; - -#endif // __DICE_H - diff --git a/cxxtest/sample/mock/Makefile b/cxxtest/sample/mock/Makefile deleted file mode 100644 index 709b7cbe9..000000000 --- a/cxxtest/sample/mock/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -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/cxxtest/sample/mock/MockStdlib.h b/cxxtest/sample/mock/MockStdlib.h deleted file mode 100644 index aee62bafe..000000000 --- a/cxxtest/sample/mock/MockStdlib.h +++ /dev/null @@ -1,31 +0,0 @@ -#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/cxxtest/sample/mock/T/stdlib.h b/cxxtest/sample/mock/T/stdlib.h deleted file mode 100644 index 30306ba22..000000000 --- a/cxxtest/sample/mock/T/stdlib.h +++ /dev/null @@ -1,13 +0,0 @@ -#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/cxxtest/sample/mock/TestDice.h b/cxxtest/sample/mock/TestDice.h deleted file mode 100644 index 35b3b7eec..000000000 --- a/cxxtest/sample/mock/TestDice.h +++ /dev/null @@ -1,62 +0,0 @@ -#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/cxxtest/sample/mock/mock_stdlib.cpp b/cxxtest/sample/mock/mock_stdlib.cpp deleted file mode 100644 index 148a044d2..000000000 --- a/cxxtest/sample/mock/mock_stdlib.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#define CXXTEST_MOCK_TEST_SOURCE_FILE -#include <T/stdlib.h> diff --git a/cxxtest/sample/mock/real_stdlib.cpp b/cxxtest/sample/mock/real_stdlib.cpp deleted file mode 100644 index db02f3a15..000000000 --- a/cxxtest/sample/mock/real_stdlib.cpp +++ /dev/null @@ -1,2 +0,0 @@ -#define CXXTEST_MOCK_REAL_SOURCE_FILE -#include <T/stdlib.h> diff --git a/cxxtest/sample/mock/roll.cpp b/cxxtest/sample/mock/roll.cpp deleted file mode 100644 index 20ea967af..000000000 --- a/cxxtest/sample/mock/roll.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#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/cxxtest/sample/msvc/CxxTest_1_Run.dsp b/cxxtest/sample/msvc/CxxTest_1_Run.dsp deleted file mode 100644 index 6bc00e7f4..000000000 --- a/cxxtest/sample/msvc/CxxTest_1_Run.dsp +++ /dev/null @@ -1,93 +0,0 @@ -# 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/cxxtest/sample/msvc/CxxTest_2_Build.dsp b/cxxtest/sample/msvc/CxxTest_2_Build.dsp deleted file mode 100644 index 04727fd33..000000000 --- a/cxxtest/sample/msvc/CxxTest_2_Build.dsp +++ /dev/null @@ -1,94 +0,0 @@ -# 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/cxxtest/sample/msvc/CxxTest_3_Generate.dsp b/cxxtest/sample/msvc/CxxTest_3_Generate.dsp deleted file mode 100644 index 5bbad94ce..000000000 --- a/cxxtest/sample/msvc/CxxTest_3_Generate.dsp +++ /dev/null @@ -1,93 +0,0 @@ -# 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/cxxtest/sample/msvc/CxxTest_Workspace.dsw b/cxxtest/sample/msvc/CxxTest_Workspace.dsw deleted file mode 100644 index 5dbf84190..000000000 --- a/cxxtest/sample/msvc/CxxTest_Workspace.dsw +++ /dev/null @@ -1,59 +0,0 @@ -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/cxxtest/sample/msvc/FixFiles.bat b/cxxtest/sample/msvc/FixFiles.bat deleted file mode 100644 index fb14a6c49..000000000 --- a/cxxtest/sample/msvc/FixFiles.bat +++ /dev/null @@ -1,212 +0,0 @@ -@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/cxxtest/sample/msvc/Makefile b/cxxtest/sample/msvc/Makefile deleted file mode 100644 index 606004d4c..000000000 --- a/cxxtest/sample/msvc/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# 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/cxxtest/sample/msvc/ReadMe.txt b/cxxtest/sample/msvc/ReadMe.txt deleted file mode 100644 index 816fce45b..000000000 --- a/cxxtest/sample/msvc/ReadMe.txt +++ /dev/null @@ -1,30 +0,0 @@ -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/cxxtest/sample/only.tpl b/cxxtest/sample/only.tpl deleted file mode 100644 index b2a7277cf..000000000 --- a/cxxtest/sample/only.tpl +++ /dev/null @@ -1,33 +0,0 @@ -// -*- 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/cxxtest/sample/parts/Makefile.unix b/cxxtest/sample/parts/Makefile.unix deleted file mode 100644 index 5e6ae4e43..000000000 --- a/cxxtest/sample/parts/Makefile.unix +++ /dev/null @@ -1,39 +0,0 @@ -# -# (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/cxxtest/sample/winddk/Makefile b/cxxtest/sample/winddk/Makefile deleted file mode 100644 index 8bf25333e..000000000 --- a/cxxtest/sample/winddk/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -# Standard DDK Makefile -!include $(NTMAKEENV)\makefile.def diff --git a/cxxtest/sample/winddk/Makefile.inc b/cxxtest/sample/winddk/Makefile.inc deleted file mode 100644 index edc6f8c8c..000000000 --- a/cxxtest/sample/winddk/Makefile.inc +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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/cxxtest/sample/winddk/RunTests.tpl b/cxxtest/sample/winddk/RunTests.tpl deleted file mode 100644 index 917f14b4d..000000000 --- a/cxxtest/sample/winddk/RunTests.tpl +++ /dev/null @@ -1,13 +0,0 @@ -// -*- 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/cxxtest/sample/winddk/SOURCES b/cxxtest/sample/winddk/SOURCES deleted file mode 100644 index dae014888..000000000 --- a/cxxtest/sample/winddk/SOURCES +++ /dev/null @@ -1,46 +0,0 @@ -# -*- 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/cxxtest/sample/yes_no_runner.cpp b/cxxtest/sample/yes_no_runner.cpp deleted file mode 100644 index c32b94cd5..000000000 --- a/cxxtest/sample/yes_no_runner.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// -// 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(); -} |
