Skip to content

Commit

Permalink
Initial revision
Browse files Browse the repository at this point in the history
  • Loading branch information
orenmnero committed Oct 16, 2002
0 parents commit 3b4df17
Show file tree
Hide file tree
Showing 1,330 changed files with 245,721 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Oren Miller <[email protected]>
107 changes: 107 additions & 0 deletions CPPTest/Exception.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
#ifndef I_CPPTEST_EXCEPTION_H
#define I_CPPTEST_EXCEPTION_H

#include <stdexcept>
#include <string>
#undef assert
#include <vector>

namespace CPPTest
{
class Exception : public std::exception
{
public:

Exception()
: m_test("unknown"), m_file("unknown"), m_line(0), m_isError(false)
{
}

Exception( const std::exception& exception )
: m_test("unknown"), m_file("unknown"), m_line(0),
m_what(exception.what()), m_isError(false)
{
}

Exception( std::string test, std::string message, int line = 0,
std::string file = "unknown" )
: m_test(test), m_file(file), m_line(line), m_what(message.c_str()),
m_isError(false)
{
}

Exception( const Exception& exception )
: m_test(exception.m_test), m_file(exception.m_file),
m_line(exception.m_line), m_what(exception.what()),
m_isError(exception.m_isError)
{
}

int getLine() const
{
return m_line;
}

const std::string& getTest() const
{
return m_test;
}

const std::string& getFile() const
{
return m_file;
}

virtual const char* what() const throw()
{
return m_what.c_str();
}

const bool isError() const { return m_isError; }
void setError(bool e) { m_isError = e; }

virtual ~Exception() throw() {}

private:
std::string m_test;
std::string m_file;
int m_line;
std::string m_what;


bool m_isError;
};

typedef std::vector<Exception> Exceptions;
#if defined(HAVE_CPLUS_DEMANGLE)

} // namespace CPPTest

extern "C"
const char*
cplus_demangle(const char*, int);

namespace CPPTest {

#define assert(condition)\
if(!(condition))\
{\
const type_info& type = typeid(*this); \
std::string stypename("_Z"); \
stypename += type.name(); \
const char* dmtypename = cplus_demangle(type.name(), 0); \
if (!dmtypename) \
dmtypename = cplus_demangle(stypename.c_str(), 0); \
throw CPPTest::Exception(std::string(dmtypename? dmtypename: stypename + " [demangle failed]"), (#condition), __LINE__, __FILE__);\
}
#else
#define assert(condition)\
if(!(condition))\
{\
const type_info& type = typeid(*this);\
throw CPPTest::Exception((std::string) type.name(), (#condition), __LINE__, __FILE__);\
}
#endif
} // namespace CPPTest

#endif //I_CPPTEST_EXCEPTION_H
8 changes: 8 additions & 0 deletions CPPTest/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
EXTRA_DIST = \
Exception.h \
Test.h \
TestCase.h \
TestDisplay.h \
TestStandardOutputDisplay.h \
TestSuite.h \
TestXMLFileOutputDisplay.h
198 changes: 198 additions & 0 deletions CPPTest/Makefile.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am

# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.


SHELL = @SHELL@

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@

bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include

DESTDIR =

pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@

top_builddir = ..

ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@

NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AS = @AS@
CC = @CC@
CFLAGS = @CFLAGS@
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@
DLLTOOL = @DLLTOOL@
JNI_CFLAGS = @JNI_CFLAGS@
LEX = @LEX@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
MYSQL_CFLAGS = @MYSQL_CFLAGS@
MYSQL_LIBS = @MYSQL_LIBS@
MYSQL_PREFIX = @MYSQL_PREFIX@
OBJDUMP = @OBJDUMP@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
RUBYDIR = @RUBYDIR@
STLPORT_CFLAGS = @STLPORT_CFLAGS@
STLPORT_LIBS = @STLPORT_LIBS@
STLPORT_PREFIX = @STLPORT_PREFIX@
VERSION = @VERSION@
XML2_CONFIG = @XML2_CONFIG@
XML_CFLAGS = @XML_CFLAGS@
XML_CONFIG = @XML_CONFIG@
XML_LIBS = @XML_LIBS@

EXTRA_DIST = Exception.h Test.h TestCase.h TestDisplay.h TestStandardOutputDisplay.h TestSuite.h TestXMLFileOutputDisplay.h

mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
DIST_COMMON = Makefile.am Makefile.in


DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)

TAR = gtar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign CPPTest/Makefile

Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES)
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status

tags: TAGS
TAGS:


distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)

subdir = CPPTest

distdir: $(DISTFILES)
here=`cd $(top_builddir) && pwd`; \
top_distdir=`cd $(top_distdir) && pwd`; \
distdir=`cd $(distdir) && pwd`; \
cd $(top_srcdir) \
&& $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --foreign CPPTest/Makefile
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am

install-data-am:
install-data: install-data-am

install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:


mostlyclean-generic:

clean-generic:

distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*

maintainer-clean-generic:
mostlyclean-am: mostlyclean-generic

mostlyclean: mostlyclean-am

clean-am: clean-generic mostlyclean-am

clean: clean-am

distclean-am: distclean-generic clean-am
-rm -f libtool

distclean: distclean-am

maintainer-clean-am: maintainer-clean-generic distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."

maintainer-clean: maintainer-clean-am

.PHONY: tags distdir info-am info dvi-am dvi check check-am \
installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean


# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
Loading

0 comments on commit 3b4df17

Please sign in to comment.