Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update the cxxtest contrib package to the latest version #398

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contrib/cxxtest/README
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ MyTestSuite.h:

#include <cxxtest/TestSuite.h>

class MyTestSuite : public CxxTest::TestSuite
class MyTestSuite : public CxxTest::TestSuite
{
public:
void testAddition( void )
Expand Down
1 change: 1 addition & 0 deletions contrib/cxxtest/cxxtest/Descriptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define __cxxtest__Descriptions_cpp__

#include <cxxtest/Descriptions.h>
#include <cxxtest/ValueTraits.h>

namespace CxxTest
{
Expand Down
17 changes: 8 additions & 9 deletions contrib/cxxtest/cxxtest/ErrorFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,33 +130,31 @@ class ErrorFormatter : public TestListener

void trace(const char *file, int line, const char *expression)
{
stop(file, line) << "Trace: " <<
expression << endl;
stop(file, line) << "Trace: " << (expression ? expression : "") << endl;
}

void warning(const char *file, int line, const char *expression)
{
stop(file, line) << _warningString << ": " <<
expression << endl;
(expression ? expression : "") << endl;
}

void skippedTest(const char *file, int line, const char *expression)
{
if(expression && strlen(expression) > 0)
stop(file, line) << _warningString << ": Test skipped: " <<
expression << endl;
stop(file, line) << _warningString << ": Test skipped: " <<
(expression ? expression : "") << endl;
}

void failedTest(const char *file, int line, const char *expression)
{
stop(file, line) << _errorString << ": Test failed: " <<
expression << endl;
(expression ? expression : "") << endl;
}

void failedAssert(const char *file, int line, const char *expression)
{
stop(file, line) << _errorString << ": Assertion failed: " <<
expression << endl;
(expression ? expression : "") << endl;
}

void failedAssertEquals(const char *file, int line,
Expand Down Expand Up @@ -185,7 +183,8 @@ class ErrorFormatter : public TestListener
const char* explanation
)
{
stop(file, line) << _errorString << ": " << explanation << endl;
stop(file, line) << _errorString << ": " <<
(explanation ? explanation : "") << endl;
}

void failedAssertDelta(const char *file, int line,
Expand Down
2 changes: 2 additions & 0 deletions contrib/cxxtest/cxxtest/LinkedList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
#define __cxxtest__LinkedList_cpp__

#include <cxxtest/LinkedList.h>
#include <cxxtest/GlobalFixture.h>
#include <cxxtest/RealDescriptions.h>

namespace CxxTest
{
Expand Down
4 changes: 2 additions & 2 deletions contrib/cxxtest/cxxtest/Mock.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,14 @@ namespace dummy_mock_ns {}
{ \
CXXTEST_MOCK_NAMESPACE::Base_##MOCK::current().NAME CALL; \
} \

//
// Error for calling mock function w/o object
//
#define __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ) \
TS_FAIL( CXXTEST_MOCK_NAMESPACE_STR #NAME #ARGS " called with no " \
CXXTEST_MOCK_NAMESPACE_STR "Base_" #NAME " object" ); \

#define CXXTEST_MOCK_NAMESPACE_STR __CXXTEST_STR(CXXTEST_MOCK_NAMESPACE) "::"
#define __CXXTEST_STR(X) __CXXTEST_XSTR(X)
#define __CXXTEST_XSTR(X) #X
Expand Down
64 changes: 64 additions & 0 deletions contrib/cxxtest/cxxtest/TestSuite.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,70 @@ struct differs
}
};

template<>
struct differs<const char*, const char*>
{
static bool test(const char *x, const char *y)
{
if ((x != 0) && (y != 0))
{
return (CXXTEST_STD(strcmp(x, y)) != 0);
}
else
{
return (x != y);
}
}
};

template<>
struct differs<char*, char*>
{
static bool test(char *x, char *y)
{
if ((x != 0) && (y != 0))
{
return (CXXTEST_STD(strcmp(x, y)) != 0);
}
else
{
return (x != y);
}
}
};

template<>
struct differs<const char*, char*>
{
static bool test(const char *x, char *y)
{
if ((x != 0) && (y != 0))
{
return (CXXTEST_STD(strcmp(x, y)) != 0);
}
else
{
return (x != y);
}
}
};

template<>
struct differs<char*, const char*>
{
static bool test(char *x, const char *y)
{
if ((x != 0) && (y != 0))
{
return (CXXTEST_STD(strcmp(x, y)) != 0);
}
else
{
return (x != y);
}
}
};

template<class X, class Y>
void doAssertDiffers(const char *file, int line,
const char *xExpr, X x,
Expand Down
8 changes: 4 additions & 4 deletions contrib/cxxtest/cxxtest/ValueTraits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void ValueTraits<const double>::hugeNumber(double t)
s = copyString(s, ".");
s = doubleToString(t, s, 1, DIGITS_ON_RIGHT);
s = copyString(s, "E");
s = numberToString(requiredDigitsOnLeft(t) - 1, s);
numberToString(requiredDigitsOnLeft(t) - 1, s);
}

void ValueTraits<const double>::normalNumber(double t)
Expand All @@ -171,17 +171,17 @@ void ValueTraits<const double>::nonFiniteNumber(double t)
char *s = _asString;
if (t != t)
{
s = copyString(s, "nan");
copyString(s, "nan");
}
//else if ( t == 1.0/0.0 )
else if (t >= HUGE_VAL)
{
s = copyString(s, "-inf");
copyString(s, "-inf");
}
else if (t <= -HUGE_VAL)
{
//else if ( t == -1.0/0.0 )
s = copyString(s, "inf");
copyString(s, "inf");
}
}

Expand Down
6 changes: 3 additions & 3 deletions contrib/cxxtest/cxxtest/XmlFormatter.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ class XmlFormatter : public TestListener
std::string retVal;
const time_t now(time(NULL));
char current_date_string[27];

#ifdef WIN32
if (ctime_s(current_date_string, sizeof(current_date_string)-1, &now) == 0)
{
Expand All @@ -607,11 +607,11 @@ class XmlFormatter : public TestListener
}
#else
const size_t n = strlen(ctime_r(&now, current_date_string));
if (n)
if (n)
{
current_date_string[n-1] = '\0'; // remove the ending \n
retVal = current_date_string;
}
}
#endif
return retVal;
}
Expand Down
2 changes: 1 addition & 1 deletion contrib/cxxtest/doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ A2X_OPTS := -a toc -a icons -L -d article -v --xsltproc-opts "$(XSLTPROC_OP

all: guide.html guide.pdf guide.epub

manpages:
manpages:
cd man; ./create_manpage;
cd man; asciidoc -v -d manpage ./cxxtestgen.1.txt

Expand Down
42 changes: 21 additions & 21 deletions contrib/cxxtest/doc/epub/README
Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,50 @@
These are XSL stylesheets for transforming DocBook XML document
instances into .epub format.

.epub is an open standard of the The International Digital Publishing Forum (IDPF),
a the trade and standards association for the digital publishing industry.
.epub is an open standard of the The International Digital Publishing Forum (IDPF),
a the trade and standards association for the digital publishing industry.

An alpha-quality reference implementation (dbtoepub) for a DocBook to .epub
converter (written in Ruby) is available under bin/.
An alpha-quality reference implementation (dbtoepub) for a DocBook to .epub
converter (written in Ruby) is available under bin/.

From http://idpf.org
What is EPUB, .epub, OPS/OCF & OEB?

".epub" is the file extension of an XML format for reflowable digital
books and publications. ".epub" is composed of three open standards,
the Open Publication Structure (OPS), Open Packaging Format (OPF) and
Open Container Format (OCF), produced by the IDPF. "EPUB" allows
publishers to produce and send a single digital publication file
through distribution and offers consumers interoperability between
software/hardware for unencrypted reflowable digital books and other
publications. The Open eBook Publication Structure or "OEB",
originally produced in 1999, is the precursor to OPS.
".epub" is the file extension of an XML format for reflowable digital
books and publications. ".epub" is composed of three open standards,
the Open Publication Structure (OPS), Open Packaging Format (OPF) and
Open Container Format (OCF), produced by the IDPF. "EPUB" allows
publishers to produce and send a single digital publication file
through distribution and offers consumers interoperability between
software/hardware for unencrypted reflowable digital books and other
publications. The Open eBook Publication Structure or "OEB",
originally produced in 1999, is the precursor to OPS.

----------------------------------------------------------------------
.epub Constraints
.epub Constraints
----------------------------------------------------------------------

.epub does not support all of the image formats that DocBook supports.
When an image is available in an accepted format, it will be used. The
accepted @formats are: 'GIF','GIF87a','GIF89a','JPEG','JPG','PNG','SVG'
A mime-type for the image will be guessed from the file extension,
A mime-type for the image will be guessed from the file extension,
which may not work if your file extensions are non-standard.

Non-supported elements:
* <mediaobjectco>
* <inlinegraphic>, <graphic>, <textdata>, <imagedata> with text/XML
* <mediaobjectco>
* <inlinegraphic>, <graphic>, <textdata>, <imagedata> with text/XML
@filerefs
* <olink>
* <cmdsynopsis> in lists (generic XHTML rendering inability)
* <footnote><para><programlisting> (just make your programlistings
* <footnote><para><programlisting> (just make your programlistings
siblings, rather than descendents of paras)

----------------------------------------------------------------------
dbtoepub Reference Implementation
----------------------------------------------------------------------

An alpha-quality DocBook to .epub conversion program, dbtoepub, is provided
in bin/dbtoepub.
in bin/dbtoepub.

This tool requires:
- 'xsltproc' in your PATH
Expand All @@ -65,7 +65,7 @@ $ dbtoepub --help

.epub is defined by the IDPF at www.idpf.org and is made up of 3 standards:
- Open Publication Structure (OPS)
- Open Packaging Format (OPF)
- Open Packaging Format (OPF)
- Open Container Format (OCF)

Specific options:
Expand All @@ -78,7 +78,7 @@ $ dbtoepub --help
Validation
----------------------------------------------------------------------

The epubcheck project provides limited validation for .epub documents.
The epubcheck project provides limited validation for .epub documents.
See http://code.google.com/p/epubcheck/ for details.

----------------------------------------------------------------------
Expand Down
12 changes: 6 additions & 6 deletions contrib/cxxtest/doc/epub/bin/dbtoepub
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/usr/bin/env ruby
# This program converts DocBook documents into .epub files.
#
#
# Usage: dbtoepub [OPTIONS] [DocBook Files]
#
# .epub is defined by the IDPF at www.idpf.org and is made up of 3 standards:
# - Open Publication Structure (OPS)
# - Open Packaging Format (OPF)
# - Open Packaging Format (OPF)
# - Open Container Format (OCF)
#
# Specific options:
Expand Down Expand Up @@ -43,7 +43,7 @@ opts.banner = "Usage: #{File.basename($0)} [OPTIONS] [DocBook Files]

.epub is defined by the IDPF at www.idpf.org and is made up of 3 standards:
- Open Publication Structure (OPS)
- Open Packaging Format (OPF)
- Open Packaging Format (OPF)
- Open Container Format (OCF)

Specific options:"
Expand All @@ -68,9 +68,9 @@ db_files.each {|docbook_file|

if output_file
epub_file = output_file
else
else
epub_file = File.basename(docbook_file, ".xml") + ".epub"
end
end
puts "Rendering DocBook file #{docbook_file} to #{epub_file}" if verbose
e.render_to_file(epub_file)
}
}
Loading
Loading