add cxxtest to the source tree, external depepdencies are giving me a headache

This commit is contained in:
Thomas Fussell 2017-03-11 14:05:50 -05:00
parent bb600ee1ce
commit 80c7664509
429 changed files with 26973 additions and 51 deletions

View File

@ -23,7 +23,8 @@ set(XLNT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
set(XLNT_INCLUDE_DIR ${XLNT_ROOT_DIR}/include) set(XLNT_INCLUDE_DIR ${XLNT_ROOT_DIR}/include)
set(XLNT_SOURCE_DIR ${XLNT_ROOT_DIR}/source) set(XLNT_SOURCE_DIR ${XLNT_ROOT_DIR}/source)
set(THIRD_PARTY_DIR ${XLNT_ROOT_DIR}/third-party) set(THIRD_PARTY_DIR ${XLNT_ROOT_DIR}/third-party)
add_subdirectory(${THIRD_PARTY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/third-party)
add_subdirectory(${THIRD_PARTY_DIR}/libstudxml ${CMAKE_CURRENT_BINARY_DIR}/third-party/libstudxml)
if(COVERAGE) if(COVERAGE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
@ -127,12 +128,10 @@ else()
endif() endif()
endif() endif()
add_dependencies(xlnt xlnt.third-party)
target_link_libraries(xlnt PRIVATE libstudxml) target_link_libraries(xlnt PRIVATE libstudxml)
target_include_directories(xlnt PUBLIC ${XLNT_INCLUDE_DIR}) target_include_directories(xlnt PUBLIC ${XLNT_INCLUDE_DIR})
target_include_directories(xlnt PRIVATE ${XLNT_SOURCE_DIR}) target_include_directories(xlnt PRIVATE ${XLNT_SOURCE_DIR})
target_link_libraries(xlnt PRIVATE ${ZLIB_LIBRARIRES}) target_link_libraries(xlnt PRIVATE ${ZLIB_LIBRARIES})
target_include_directories(xlnt PRIVATE ${ZLIB_INCLUDE_DIR}) target_include_directories(xlnt PRIVATE ${ZLIB_INCLUDE_DIR})
target_link_libraries(xlnt PRIVATE ${CRYPTOPP_LIBRARIES}) target_link_libraries(xlnt PRIVATE ${CRYPTOPP_LIBRARIES})
target_include_directories(xlnt PRIVATE ${CRYPTOPP_INCLUDE_DIR}) target_include_directories(xlnt PRIVATE ${CRYPTOPP_INCLUDE_DIR})

View File

@ -40,6 +40,10 @@ if(COVERAGE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov --coverage") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lgcov --coverage")
endif() endif()
set(CXXTEST_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../third-party/cxxtest)
set(CXXTEST_INCLUDE_DIR ${CXXTEST_ROOT_DIR})
set(CXXTEST_PYTHON_TESTGEN_EXECUTABLE ${CXXTEST_ROOT_DIR}/bin/cxxtestgen)
add_executable(xlnt.test ${TEST_HELPERS} ${TESTS} ${RUNNER}) add_executable(xlnt.test ${TEST_HELPERS} ${TESTS} ${RUNNER})
target_link_libraries(xlnt.test target_link_libraries(xlnt.test
PRIVATE xlnt PRIVATE xlnt
@ -76,7 +80,6 @@ else()
endif() endif()
find_package(PythonInterp REQUIRED) find_package(PythonInterp REQUIRED)
set(CXXTEST_PYTHON_TESTGEN_EXECUTABLE ${CMAKE_BINARY_DIR}/source/third-party/cxxtest/cxxtest-download-prefix/src/cxxtest-download/bin/cxxtestgen)
add_custom_command(OUTPUT ${RUNNER} add_custom_command(OUTPUT ${RUNNER}
COMMAND ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --runner=ErrorPrinter -o ${RUNNER} ${TESTS} COMMAND ${CXXTEST_PYTHON_TESTGEN_EXECUTABLE} --runner=ErrorPrinter -o ${RUNNER} ${TESTS}

View File

@ -1,8 +0,0 @@
cmake_minimum_required(VERSION 3.2)
project(xlnt.third-party)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/libstudxml)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/cxxtest)
add_custom_target(xlnt.third-party
DEPENDS libstudxml cxxtest-download)

View File

@ -3,13 +3,3 @@ project(cxxtest)
set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
include(ExternalProject)
ExternalProject_Add(cxxtest-download
GIT_REPOSITORY https://github.com/CxxTest/cxxtest
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND "")
set(CXXTEST_ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}/cxxtest-download-prefix/src/cxxtest-download)
set(CXXTEST_INCLUDE_DIR ${CXXTEST_ROOT_DIR})

165
third-party/cxxtest/COPYING vendored Normal file
View File

@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

44
third-party/cxxtest/README vendored Normal file
View File

@ -0,0 +1,44 @@
Overview
--------
CxxTest is a unit testing framework for C++ that is similar in
spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because
it does not require precompiling a CxxTest testing library, it
employs no advanced features of C++ (e.g. RTTI) and it supports a
very flexible form of test discovery.
CxxTest is available under the GNU Lesser General Public Licence (LGPL).
A user guide can be downloaded from http://cxxtest.com.
A Simple Example
----------------
1. Create a test suite header file:
MyTestSuite.h:
#include <cxxtest/TestSuite.h>
class MyTestSuite : public CxxTest::TestSuite
{
public:
void testAddition( void )
{
TS_ASSERT( 1 + 1 > 1 );
TS_ASSERT_EQUALS( 1 + 1, 2 );
}
};
2. Generate the tests file:
# cxxtestgen --error-printer -o tests.cpp MyTestSuite.h
3. Compile and run!
# g++ -o main tests.cpp
# ./main
Running cxxtest tests (1 test).OK!

192
third-party/cxxtest/Versions vendored Normal file
View File

@ -0,0 +1,192 @@
CxxTest Releases
----------------
* Version 4.4 (2014-06-03)
- Fixed compilation error on Windows (MSVC) in XmlFormatter.h (#86)
- Fix to ensure that tearDown() is called (#89)
- Add option run test with a user defined command in scons (#91)
- Use a Python path relative to the cxxtestgen script (#88)
- Add defensive guard in ErrorFormatter.h (#96)
- Fixed bug with "None" appearing in CXXTEST_CPPATH (#99)
- Added CXXTEST_LIBPATH to properly use shared libraries (#100)
- Added guards when XmlFormatter.h data is not initialize (#87)
* Version 4.3 (2013-07-05)
- Changes to assess code coverage of the cxxtestgen command
- Standardizing C++ file formats (using astyle)
- Bug fixes that led to the test runner hanging
- Adding special assertions for floating point values
- Added date to XML output
- Added support for comparison of C strings
* Version 4.2.1 (2013-03-22)
- Fixing documentation of LGPL version
* Version 4.2 (2013-03-16)
- Changes to support test fixtures in namespaces
- Adding logic to support test skipping
- Change to create self-contained HTML documentation
- Fixed inheritance issue in GlobalFixture (#69)
- Update LGPL version
- Changes to try/catch to avoid ambiguities withn catching std::exception (#53)
- Fixed TS_ASSERT_DELTA to work on integer types (#65)
- Changed output format to print world-name (#70)
* Version 4.1 (2012-11-30)
- Added absolute paths to resolve bug when relative path links are provided.
- Bug fix when files contain unicode characters
- Fix for --no-static-init: Changed how non-static tests are created
- Updated user guide to include SCons build system
- Closing out Tigris and SourceForge tickets
- Added valgrind tests.
* Version 4.0.3 (2012-01-07)
- Adding support for Python 2.4 - 3.2
- Various cleanup of CxxTest root directory
- Adding patch that allows the cxxtestgen script to be used when symlinked.
* Version 4.0.2 (2012-01-02)
- Bug fix to enable installation of cxxtestgen without the 'setuptools' package
* Version 4.0.1 (2012-01-01)
- Documentation updates
- Bug fix for installation of cxxtestgen script
* Version 4.0 (2011-12-28)
- Perl is no longer used to support CxxTest scripts. Python is now the only scripting language used by CxxTest.
- The testing scripts have been rewritten using the PyUnit framework.
- The installation process for CxxTest now leverages and integrates with the system Python installation.
- A more comprehensive C++ parser is now available, which supports testing of templates.
- The CxxTest GUI is no longer supported.
- The <<ts_trace,TS_TRACE>> and <<ts_warn,TS_WARN>> macros have the same behavior now.
- CxxTest runners now have a command-line interface that facilitates interactive use of the test runner.
- A new user guide is now available in PDF, HTML and Ebook formats.
* Version 3.10.1 (2004-12-01)
- Improved support for VC7
- Fixed clash with some versions of STL
* Version 3.10.0 (2004-11-20)
- Added mock framework for global functions
- Added TS_ASSERT_THROWS_ASSERT and TS_ASSERT_THROWS_EQUALS
- Added CXXTEST_ENUM_TRAITS
- Improved support for STL classes (vector, map etc.)
- Added support for Digital Mars compiler
- Reduced root/part compilation time and binary size
- Support C++-style commenting of tests
* Version 3.9.1 (2004-01-19)
- Fixed small bug with runner exit code
- Embedded test suites are now deprecated
* Version 3.9.0 (2004-01-17)
- Added TS_TRACE
- Added --no-static-init
- CxxTest::setAbortTestOnFail() works even without --abort-on-fail
* Version 3.8.5 (2004-01-08)
- Added --no-eh
- Added CxxTest::setAbortTestOnFail() and CXXTEST_DEFAULT_ABORT
- Added CxxTest::setMaxDumpSize()
- Added StdioFilePrinter
* Version 3.8.4 (2003-12-31)
- Split distribution into cxxtest and cxxtest-selftest
- Added `sample/msvc/FixFiles.bat'
* Version 3.8.3 (2003-12-24)
- Added TS_ASSERT_PREDICATE
- Template files can now specify where to insert the preamble
- Added a sample Visual Studio workspace in `sample/msvc'
- Can compile in MSVC with warning level 4
- Changed output format slightly
* Version 3.8.1 (2003-12-21)
- Fixed small bug when using multiple --part files.
- Fixed X11 GUI crash when there's no X server.
- Added GlobalFixture::setUpWorld()/tearDownWorld()
- Added leaveOnly(), activateAllTests() and `sample/only.tpl'
- Should now run without warnings on Sun compiler.
* Version 3.8.0 (2003-12-13)
- Fixed bug where `Root.cpp' needed exception handling
- Added TS_ASSERT_RELATION
- TSM_ macros now also tell you what went wrong
- Renamed Win32Gui::free() to avoid clashes
- Now compatible with more versions of Borland compiler
- Improved the documentation
* Version 3.7.1 (2003-09-29)
- Added --version
- Compiles with even more exotic g++ warnings
- Win32 Gui compiles with UNICODE
- Should compile on some more platforms (Sun Forte, HP aCC)
* Version 3.7.0 (2003-09-20)
- Added TS_ASSERT_LESS_THAN_EQUALS
- Minor cleanups
* Version 3.6.1 (2003-09-15)
- Improved QT GUI
- Improved portability some more
* Version 3.6.0 (2003-09-04)
- Added --longlong
- Some portability improvements
* Version 3.5.1 (2003-09-03)
- Major internal rewrite of macros
- Added TS_ASSERT_SAME_DATA
- Added --include option
- Added --part and --root to enable splitting the test runner
- Added global fixtures
- Enhanced Win32 GUI with timers, -keep and -title
- Now compiles with strict warnings
* Version 3.1.1 (2003-08-27)
- Fixed small bug in TS_ASSERT_THROWS_*()
* Version 3.1.0 (2003-08-23)
- Default ValueTraits now dumps value as hex bytes
- Fixed double invocation bug (e.g. TS_FAIL(functionWithSideEffects()))
- TS_ASSERT_THROWS*() are now "abort on fail"-friendly
- Win32 GUI now supports Windows 98 and doesn't need comctl32.lib
* Version 3.0.1 (2003-08-07)
- Added simple GUI for X11, Win32 and Qt
- Added TS_WARN() macro
- Removed --exit-code
- Improved samples
- Improved support for older (pre-std::) compilers
- Made a PDF version of the User's Guide
* Version 2.8.4 (2003-07-21)
- Now supports g++-3.3
- Added --have-eh
- Fixed bug in numberToString()
* Version 2.8.3 (2003-06-30)
- Fixed bugs in cxxtestgen.pl
- Fixed warning for some compilers in ErrorPrinter/StdioPrinter
- Thanks Martin Jost for pointing out these problems!
* Version 2.8.2 (2003-06-10)
- Fixed bug when using CXXTEST_ABORT_TEST_ON_FAIL without standard library
- Added CXXTEST_USER_TRAITS
- Added --abort-on-fail
* Version 2.8.1 (2003-01-16)
- Fixed charToString() for negative chars
* Version 2.8.0 (2003-01-13)
- Added CXXTEST_ABORT_TEST_ON_FAIL for xUnit-like behaviour
- Added `sample/winddk'
- Improved ValueTraits
- Improved output formatter
- Started version history
* Version 2.7.0 (2002-09-29)
- Added embedded test suites
- Major internal improvements

19
third-party/cxxtest/admin/announcement vendored Normal file
View File

@ -0,0 +1,19 @@
We are pleased to announce the updated release of CxxTest 4.4. CxxTest is a unit testing framework for C++ that is similar in spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because it does not require precompiling a CxxTest testing library, it employs no advanced features of C++ (e.g. RTTI) and it supports a very flexible form of test discovery.
This release includes a variety of bug fixes:
- Fixed compilation error on Windows (MSVC) in XmlFormatter.h (#86)
- Fix to ensure that tearDown() is called (#89)
- Add option run test with a user defined command in scons (#91)
- Use a Python path relative to the cxxtestgen script (#88)
- Add defensive guard in ErrorFormatter.h (#96)
- Fixed bug with "None" appearing in CXXTEST_CPPATH (#99)
- Added CXXTEST_LIBPATH to properly use shared libraries (#100)
- Added guards when XmlFormatter.h data is not initialize (#87)
See the CxxTest Home Page (http://cxxtest.com) for documentation and download instructions.
Enjoy!
CxxTest Developer Team
cxxtest-developers@googlegroups.com

View File

@ -0,0 +1,41 @@
#!/bin/bash
export PATH=$WORKSPACE/vpython/bin:$PATH
g++ --version
# Setup virtual Python environment
\rm -Rf vpython
python cxxtest/admin/virtualenv.py vpython
#vpy/scripts/vpy_install
vpython/bin/easy_install nose
vpython/bin/easy_install unittest2
vpython/bin/easy_install ply
vpython/bin/easy_install ordereddict
vpython/bin/easy_install gcovr
vpython/bin/easy_install pyutilib.th
cd cxxtest/python
../../vpython/bin/python setup.py install
# Cleanup test directory
cd ../test
make clean
cd ../..
# Run tests
#export CXXTEST_GCOV_FLAGS='-fprofile-arcs -ftest-coverage'
vpython/bin/nosetests --verbosity=2 --with-xunit --xunit-file=$WORKSPACE/TEST-cxxtest.xml -w $WORKSPACE/cxxtest/test
# Generate code coverage
#cd cxxtest
#../vpython/bin/gcovr -v -r $WORKSPACE/cxxtest -x -o $WORKSPACE/cxxtest/test/coverage.xml --gcov-filter '.*#test#(\.\.|\^)#cxxtest#.*gcov'
echo "DONE"
# Cleanup old gcov files
cd $WORKSPACE
#\rm -f *.gcov cxxtest/*.gcov doc/*.gcov doc/examples/*.gcov
#\rm -f *.gcno cxxtest/*.gcno doc/*.gcno doc/examples/*.gcno
#\rm -f *.gcda cxxtest/*.gcda doc/*.gcda doc/examples/*.gcda
cd $WORKSPACE/cxxtest/test
make clean

37
third-party/cxxtest/admin/cxxtest.spec vendored Normal file
View File

@ -0,0 +1,37 @@
Name: cxxtest
Summary: CxxTest Testing Framework for C++
Version: %{version}
Release: 1
Copyright: LGPL
Group: Development/C++
Source: cxxtest-%{version}.tar.gz
BuildRoot: /tmp/cxxtest-build
BuildArch: noarch
Prefix: /usr
%description
CxxTest is a unit testing framework for C++ that is similar in
spirit to JUnit, CppUnit, and xUnit. CxxTest is easy to use because
it does not require precompiling a CxxTest testing library, it
employs no advanced features of C++ (e.g. RTTI) and it supports a
very flexible form of test discovery.
%prep
%setup -n cxxtest
%build
%install
install -m 755 -d $RPM_BUILD_ROOT/usr/bin $RPM_BUILD_ROOT/usr/include/cxxtest
install -m 755 bin/cxxtestgen $RPM_BUILD_ROOT/usr/bin/
install -m 644 cxxtest/* $RPM_BUILD_ROOT/usr/include/cxxtest/
%clean
rm -rf $RPM_BUILD_ROOT
%files
%attr(-, root, root) %doc README
%attr(-, root, root) %doc sample
%attr(-, root, root) /usr/include/cxxtest
%attr(-, root, root) /usr/bin/cxxtestgen

85
third-party/cxxtest/admin/jenkins_cxxtest vendored Executable file
View File

@ -0,0 +1,85 @@
#!/bin/bash
if test -z "$WORKSPACE"; then
echo "ERROR: \$WORKSPACE not defined"
exit 1
fi
export PATH="$WORKSPACE/vpython/bin:$PATH"
if test -n "$1"; then
PYTHON="$1"
else
PYTHON=python
fi
echo
echo "Building on `hostname`:"
echo
echo " Workspace: ${WORKSPACE}"
echo
echo " Package: ${PACKAGE}"
echo
echo " Environment:"
/usr/bin/env 2>&1 | sort | sed 's/^/ /'
echo
echo " Python:"
${PYTHON} -c 'import sys; sys.stdout.write(sys.version+"\n")' 2>&1 \
| sed 's/^/ /'
PYTHON_VER=`${PYTHON} -c 'import sys; sys.stdout.write(str(sys.version_info[0]))'`
echo
# The following executables are required (missing app yields build failure)
for app in gcc; do
which $app || exit 1
echo " $app:"
$app --version 2>&1 | grep -v '^$' | sed 's/^/ /' || exit 1
echo
done
# Setup virtual Python environment
\rm -Rf vpython
tmp=2.6
if [ "yes" = "$(echo | awk "($PYTHON_VER < $tmp) { print \"yes\"; }")" ]; then
"$PYTHON" "$WORKSPACE"/cxxtest/admin/virtualenv_1.7.py "$WORKSPACE"/vpython || exit 1
else
"$PYTHON" "$WORKSPACE"/cxxtest/admin/virtualenv.py "$WORKSPACE"/vpython || exit 1
fi
vpython/bin/easy_install nose
if test "$PYTHON_VER" -gt 2; then
vpython/bin/easy_install unittest2py3k
#vpython/bin/pip install unittest2py3k
else
vpython/bin/easy_install unittest2
fi
vpython/bin/easy_install ply
vpython/bin/easy_install ordereddict
vpython/bin/easy_install gcovr
vpython/bin/easy_install coverage
vpython/bin/easy_install pyutilib.th
cd "$WORKSPACE"/cxxtest/python
"$WORKSPACE"/vpython/bin/python setup.py develop
# Cleanup test directories
cd "$WORKSPACE"/cxxtest/test
make clean
cd "$WORKSPACE"/cxxtest/doc
make clean
cd "$WORKSPACE"
# Run tests
export CXXTEST_GCOV_FLAGS='-fprofile-arcs -ftest-coverage'
vpython/bin/nosetests --verbosity=2 -w "$WORKSPACE"/cxxtest \
--with-coverage --with-xunit --xunit-file="$WORKSPACE"/TEST-cxxtest.xml \
|| echo "(INFO) nosetests returned non-zero return code"
# Generate Python code coverage
vpython/bin/coverage xml --omit="$WORKSPACE/vpython/lib/*,$WORKSPACE/cxxtest/test/*,$WORKSPACE/cxxtest/doc/examples/*" -o $WORKSPACE/cxxtest/test/coverage.xml
# Generate C++ code coverage
cd "$WORKSPACE"/cxxtest
"$WORKSPACE"/vpython/bin/gcovr -v -d -r "$WORKSPACE"/cxxtest \
-x -o "$WORKSPACE"/cxxtest/coverage.xml \
--gcov-filter '.*#test#(\.\.|\^)#cxxtest#.*gcov'
echo "DONE"

2581
third-party/cxxtest/admin/virtualenv.py vendored Executable file

File diff suppressed because it is too large Load Diff

2102
third-party/cxxtest/admin/virtualenv_1.7.py vendored Executable file

File diff suppressed because it is too large Load Diff

18
third-party/cxxtest/bin/cxxtestgen vendored Executable file
View File

@ -0,0 +1,18 @@
#! /usr/bin/env python
#
# The CxxTest driver script, which uses the cxxtest Python package.
#
import sys
import os
from os.path import realpath, dirname
if sys.version_info < (3,0):
sys.path.insert(0, dirname(dirname(realpath(__file__)))+os.sep+'python')
else:
sys.path.insert(0, dirname(dirname(realpath(__file__)))+os.sep+'python'+os.sep+'python3')
sys.path.append(".")
import cxxtest
cxxtest.main(sys.argv)

View File

@ -0,0 +1,3 @@
@echo off
rem Just run the python script
python %0 %*

View File

@ -0,0 +1,19 @@
This file is meant to be a full credit of the people who helped make the CxxTest
builder what it is today.
Current maintainer:
Gašper Ažman (gasper dot azman at gmail.com)
Original author:
Gašper Ažman
Additional patches and tests:
Diego Nieto Cid
Edmundo López Bobeda
John Darby Mitchell
Pavol Juhas
Other helpful suggestions:
John Darby Mitchell

View File

@ -0,0 +1,400 @@
# coding=UTF-8
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
#
# == Preamble ==
# Authors of this script are in the Authors file in the same directory as this
# script.
#
# Maintainer: Gašper Ažman <gasper.azman@gmail.com>
#
# This file is maintained as a part of the CxxTest test suite.
#
# == About ==
#
# This builder correctly tracks dependencies and supports just about every
# configuration option for CxxTest that I can think of. It automatically
# defines a target "check" (configurable), so all tests can be run with a
# % scons check
# This will first compile and then run the tests.
#
# The default configuration assumes that cxxtest is located at the base source
# directory (where SConstruct is), that the cxxtestgen is under
# cxxtest/bin/cxxtestgen and headers are in cxxtest/cxxtest/. The
# header include path is automatically added to CPPPATH. It, however, can also
# recognise that cxxtest is installed system-wide (based on redhat's RPM).
#
# For a list of environment variables and their defaults, see the generate()
# function.
#
# This should be in a file called cxxtest.py somewhere in the scons toolpath.
# (default: #/site_scons/site_tools/)
#
# == Usage: ==
#
# For configuration options, check the comment of the generate() function.
#
# This builder has a variety of different possible usages, so bear with me.
#
# env.CxxTest('target')
# The simplest of them all, it models the Program call. This sees if target.t.h
# is around and passes it through the cxxtestgen and compiles it. Might only
# work on unix though, because target can't have a suffix right now.
#
# env.CxxTest(['target.t.h'])
# This compiles target.t.h as in the previous example, but now sees that it is a
# source file. It need not have the same suffix as the env['CXXTEST_SUFFIX']
# variable dictates. The only file provided is taken as the test source file.
#
# env.CxxTest(['test1.t.h','test1_lib.cpp','test1_lib2.cpp','test2.t.h',...])
# You may also specify multiple source files. In this case, the 1st file that
# ends with CXXTEST_SUFFIX (default: .t.h) will be taken as the default test
# file. All others will be run with the --part switch and linked in. All files
# *not* having the right suffix will be passed to the Program call verbatim.
#
# In the last two cases, you may also specify the desired name of the test as
# the 1st argument to the function. This will result in the end executable
# called that. Normal Program builder rules apply.
#
from SCons.Script import *
from SCons.Builder import Builder
from SCons.Util import PrependPath, unique, uniquer
import os
# A warning class to notify users of problems
class ToolCxxTestWarning(SCons.Warnings.Warning):
pass
SCons.Warnings.enableWarningClass(ToolCxxTestWarning)
def accumulateEnvVar(dicts, name, default = []):
"""
Accumulates the values under key 'name' from the list of dictionaries dict.
The default value is appended to the end list if 'name' does not exist in
the dict.
"""
final = []
for d in dicts:
final += Split(d.get(name, default))
return final
def multiget(dictlist, key, default = None):
"""
Takes a list of dictionaries as its 1st argument. Checks if the key exists
in each one and returns the 1st one it finds. If the key is found in no
dictionaries, the default is returned.
"""
for dict in dictlist:
if dict.has_key(key):
return dict[key]
else:
return default
def envget(env, key, default=None):
"""Look in the env, then in os.environ. Otherwise same as multiget."""
return multiget([env, os.environ], key, default)
def prepend_ld_library_path(env, overrides, **kwargs):
"""Prepend LD_LIBRARY_PATH with LIBPATH to run successfully programs that
were linked against local shared libraries."""
# make it unique but preserve order ...
libpath = uniquer(Split(kwargs.get('CXXTEST_LIBPATH', [])) +
Split(env.get( 'CXXTEST_LIBPATH', [])))
if len(libpath) > 0:
libpath = env.arg2nodes(libpath, env.fs.Dir)
platform = env.get('PLATFORM','')
if platform == 'win32':
var = 'PATH'
else:
var = 'LD_LIBRARY_PATH'
eenv = overrides.get('ENV', env['ENV'].copy())
canonicalize = lambda p : p.abspath
eenv[var] = PrependPath(eenv.get(var,''), libpath, os.pathsep, 1, canonicalize)
overrides['ENV'] = eenv
return overrides
def UnitTest(env, target, source = [], **kwargs):
"""
Prepares the Program call arguments, calls Program and adds the result to
the check target.
"""
# get the c and cxx flags to process.
ccflags = Split( multiget([kwargs, env, os.environ], 'CCFLAGS' ))
cxxflags = Split( multiget([kwargs, env, os.environ], 'CXXFLAGS'))
# get the removal c and cxx flags
cxxremove = set( Split( multiget([kwargs, env, os.environ],'CXXTEST_CXXFLAGS_REMOVE')))
ccremove = set( Split( multiget([kwargs, env, os.environ],'CXXTEST_CCFLAGS_REMOVE' )))
# remove the required flags
ccflags = [item for item in ccflags if item not in ccremove]
cxxflags = [item for item in cxxflags if item not in cxxremove]
# fill the flags into kwargs
kwargs["CXXFLAGS"] = cxxflags
kwargs["CCFLAGS"] = ccflags
test = env.Program(target, source = source, **kwargs)
testCommand = multiget([kwargs, env, os.environ], 'CXXTEST_COMMAND')
if testCommand:
testCommand = testCommand.replace('%t', test[0].abspath)
else:
testCommand = test[0].abspath
if multiget([kwargs, env, os.environ], 'CXXTEST_SKIP_ERRORS', False):
runner = env.Action(testCommand, exitstatfunc=lambda x:0)
else:
runner = env.Action(testCommand)
overrides = prepend_ld_library_path(env, {}, **kwargs)
cxxtest_target = multiget([kwargs, env], 'CXXTEST_TARGET')
env.Alias(cxxtest_target, test, runner, **overrides)
env.AlwaysBuild(cxxtest_target)
return test
def isValidScriptPath(cxxtestgen):
"""check keyword arg or environment variable locating cxxtestgen script"""
if cxxtestgen and os.path.exists(cxxtestgen):
return True
else:
SCons.Warnings.warn(ToolCxxTestWarning,
"Invalid CXXTEST environment variable specified!")
return False
def defaultCxxTestGenLocation(env):
return os.path.join(
envget(env, 'CXXTEST_CXXTESTGEN_DEFAULT_LOCATION'),
envget(env, 'CXXTEST_CXXTESTGEN_SCRIPT_NAME')
)
def findCxxTestGen(env):
"""locate the cxxtestgen script by checking environment, path and project"""
# check the SCons environment...
# Then, check the OS environment...
cxxtest = envget(env, 'CXXTEST', None)
# check for common passing errors and provide diagnostics.
if isinstance(cxxtest, (list, tuple, dict)):
SCons.Warnings.warn(
ToolCxxTestWarning,
"The CXXTEST variable was specified as a list."
" This is not supported. Please pass a string."
)
if cxxtest:
try:
#try getting the absolute path of the file first.
# Required to expand '#'
cxxtest = env.File(cxxtest).abspath
except TypeError:
try:
#maybe only the directory was specified?
cxxtest = env.File(
os.path.join(cxxtest, defaultCxxTestGenLocation(env)
)).abspath
except TypeError:
pass
# If the user specified the location in the environment,
# make sure it was correct
if isValidScriptPath(cxxtest):
return os.path.realpath(cxxtest)
# No valid environment variable found, so...
# Next, check the path...
# Next, check the project
check_path = os.path.join(
envget(env, 'CXXTEST_INSTALL_DIR'),
envget(env, 'CXXTEST_CXXTESTGEN_DEFAULT_LOCATION'))
cxxtest = (env.WhereIs(envget(env, 'CXXTEST_CXXTESTGEN_SCRIPT_NAME')) or
env.WhereIs(envget(env, 'CXXTEST_CXXTESTGEN_SCRIPT_NAME'),
path=[Dir(check_path).abspath]))
if cxxtest:
return cxxtest
else:
# If we weren't able to locate the cxxtestgen script, complain...
SCons.Warnings.warn(
ToolCxxTestWarning,
"Unable to locate cxxtestgen in environment, path or"
" project!\n"
"Please set the CXXTEST variable to the path of the"
" cxxtestgen script"
)
return None
def findCxxTestHeaders(env):
searchfile = 'TestSuite.h'
cxxtestgen_pathlen = len(defaultCxxTestGenLocation(env))
default_path = Dir(envget(env,'CXXTEST_INSTALL_DIR')).abspath
os_cxxtestgen = os.path.realpath(File(env['CXXTEST']).abspath)
alt_path = os_cxxtestgen[:-cxxtestgen_pathlen]
searchpaths = [default_path, alt_path]
foundpaths = []
for p in searchpaths:
if os.path.exists(os.path.join(p, 'cxxtest', searchfile)):
foundpaths.append(p)
return foundpaths
def generate(env, **kwargs):
"""
Keyword arguments (all can be set via environment variables as well):
CXXTEST - the path to the cxxtestgen script.
Default: searches SCons environment, OS environment,
path and project in that order. Instead of setting this,
you can also set CXXTEST_INSTALL_DIR
CXXTEST_RUNNER - the runner to use. Default: ErrorPrinter
CXXTEST_OPTS - other options to pass to cxxtest. Default: ''
CXXTEST_SUFFIX - the suffix of the test files. Default: '.t.h'
CXXTEST_TARGET - the target to append the tests to. Default: check
CXXTEST_COMMAND - the command that will be executed to run the test,
%t will be replace with the test executable.
Can be used for example for MPI or valgrind tests.
Default: %t
CXXTEST_CXXFLAGS_REMOVE - the flags that cxxtests can't compile with,
or give lots of warnings. Will be stripped.
Default: -pedantic -Weffc++
CXXTEST_CCFLAGS_REMOVE - the same thing as CXXTEST_CXXFLAGS_REMOVE, just for
CCFLAGS. Default: same as CXXFLAGS.
CXXTEST_PYTHON - the path to the python binary.
Default: searches path for python
CXXTEST_SKIP_ERRORS - set to True to continue running the next test if one
test fails. Default: False
CXXTEST_CPPPATH - If you do not want to clutter your global CPPPATH with the
CxxTest header files and other stuff you only need for
your tests, this is the variable to set. Behaves as
CPPPATH does.
CXXTEST_LIBPATH - If your test is linked to shared libraries which are
outside of standard directories. This is used as LIBPATH
when compiling the test program and to modify
LD_LIBRARY_PATH (or PATH on win32) when running the
program.
CXXTEST_INSTALL_DIR - this is where you tell the builder where CxxTest is
installed. The install directory has cxxtest,
python, docs and other subdirectories.
... and all others that Program() accepts, like CPPPATH etc.
"""
print "Loading CxxTest tool..."
#
# Expected behaviour: keyword arguments override environment variables;
# environment variables override default settings.
#
env.SetDefault( CXXTEST_RUNNER = 'ErrorPrinter' )
env.SetDefault( CXXTEST_OPTS = '' )
env.SetDefault( CXXTEST_SUFFIX = '.t.h' )
env.SetDefault( CXXTEST_TARGET = 'check' )
env.SetDefault( CXXTEST_CPPPATH = ['#'] )
env.SetDefault( CXXTEST_PYTHON = env.WhereIs('python') )
env.SetDefault( CXXTEST_SKIP_ERRORS = False )
env.SetDefault( CXXTEST_CXXFLAGS_REMOVE =
['-pedantic','-Weffc++','-pedantic-errors'] )
env.SetDefault( CXXTEST_CCFLAGS_REMOVE =
['-pedantic','-Weffc++','-pedantic-errors'] )
env.SetDefault( CXXTEST_INSTALL_DIR = '#/cxxtest/' )
# this one's not for public use - it documents where the cxxtestgen script
# is located in the CxxTest tree normally.
env.SetDefault( CXXTEST_CXXTESTGEN_DEFAULT_LOCATION = 'bin' )
# the cxxtestgen script name.
env.SetDefault( CXXTEST_CXXTESTGEN_SCRIPT_NAME = 'cxxtestgen' )
#Here's where keyword arguments are applied
apply(env.Replace, (), kwargs)
#If the user specified the path to CXXTEST, make sure it is correct
#otherwise, search for and set the default toolpath.
if (not kwargs.has_key('CXXTEST') or not isValidScriptPath(kwargs['CXXTEST']) ):
env["CXXTEST"] = findCxxTestGen(env)
# find and add the CxxTest headers to the path.
env.AppendUnique( CXXTEST_CPPPATH = findCxxTestHeaders(env) )
cxxtest = env['CXXTEST']
if cxxtest:
#
# Create the Builder (only if we have a valid cxxtestgen!)
#
cxxtest_builder = Builder(
action =
[["$CXXTEST_PYTHON",cxxtest,"--runner=$CXXTEST_RUNNER",
"$CXXTEST_OPTS","$CXXTEST_ROOT_PART","-o","$TARGET","$SOURCE"]],
suffix = ".cpp",
src_suffix = '$CXXTEST_SUFFIX'
)
else:
cxxtest_builder = (lambda *a: sys.stderr.write("ERROR: CXXTESTGEN NOT FOUND!"))
def CxxTest(env, target, source = None, **kwargs):
"""Usage:
The function is modelled to be called as the Program() call is:
env.CxxTest('target_name') will build the test from the source
target_name + env['CXXTEST_SUFFIX'],
env.CxxTest('target_name', source = 'test_src.t.h') will build the test
from test_src.t.h source,
env.CxxTest('target_name, source = ['test_src.t.h', other_srcs]
builds the test from source[0] and links in other files mentioned in
sources,
You may also add additional arguments to the function. In that case, they
will be passed to the actual Program builder call unmodified. Convenient
for passing different CPPPATHs and the sort. This function also appends
CXXTEST_CPPPATH to CPPPATH. It does not clutter the environment's CPPPATH.
"""
if (source == None):
suffix = multiget([kwargs, env, os.environ], 'CXXTEST_SUFFIX', "")
source = [t + suffix for t in target]
sources = Flatten(Split(source))
headers = []
linkins = []
for l in sources:
# check whether this is a file object or a string path
try:
s = l.abspath
except AttributeError:
s = l
if s.endswith(multiget([kwargs, env, os.environ], 'CXXTEST_SUFFIX', None)):
headers.append(l)
else:
linkins.append(l)
deps = []
if len(headers) == 0:
if len(linkins) != 0:
# the 1st source specified is the test
deps.append(env.CxxTestCpp(linkins.pop(0), **kwargs))
else:
deps.append(env.CxxTestCpp(headers.pop(0), **kwargs))
deps.extend(
[env.CxxTestCpp(header, CXXTEST_RUNNER = 'none',
CXXTEST_ROOT_PART = '--part', **kwargs)
for header in headers]
)
deps.extend(linkins)
kwargs['CPPPATH'] = unique(
Split(kwargs.get('CPPPATH', [])) +
Split(env.get( 'CPPPATH', [])) +
Split(kwargs.get('CXXTEST_CPPPATH', [])) +
Split(env.get( 'CXXTEST_CPPPATH', []))
)
kwargs['LIBPATH'] = unique(
Split(kwargs.get('LIBPATH', [])) +
Split(env.get( 'LIBPATH', [])) +
Split(kwargs.get('CXXTEST_LIBPATH', [])) +
Split(env.get( 'CXXTEST_LIBPATH', []))
)
return UnitTest(env, target, source = deps, **kwargs)
env.Append( BUILDERS = { "CxxTest" : CxxTest, "CxxTestCpp" : cxxtest_builder } )
def exists(env):
return os.path.exists(env['CXXTEST'])

View File

@ -0,0 +1,2 @@
Tests if the 'default environment' defaults are sane and work out of the box.
by: Gašper Ažman

View File

@ -0,0 +1,10 @@
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest']
)
env['CXXTEST_SKIP_ERRORS'] = True
env.CxxTest(['src/ThrowNoStd.h'])
env.CxxTest(['src/AborterNoThrow.h'])
env.CxxTest(['src/Comments.h'])

View File

@ -0,0 +1,17 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
expect_success = True
type = 'scons'
links = {
'cxxtest': '../../../../',
'src' : '../../../../test/'
}

View File

@ -0,0 +1,2 @@
Tests if cxxtest behaves correctly if no sources are given.
by: Gašper Ažman

View File

@ -0,0 +1,4 @@
env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
env.CxxTest('test_bar')
env.CxxTest('test_foo')

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}

View File

@ -0,0 +1,12 @@
/**
* @file requirement.cpp
* Implementation of the requirement function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:09:42 AM
*/
bool call_a_requirement() {
return true;
}

View File

@ -0,0 +1,23 @@
#ifndef TEST_BAR_T_H
#define TEST_BAR_T_H
/**
* @file test_bar.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:04:06 AM
*/
#include <cxxtest/TestSuite.h>
#include "requirement.hpp"
class TestBar : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif

View File

@ -0,0 +1,23 @@
#ifndef TEST_FOO_T_H
#define TEST_FOO_T_H
/**
* @file test_foo.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:02:06 AM
*/
#include "requirement.hpp"
#include <cxxtest/TestSuite.h>
class TestFoo : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif

View File

@ -0,0 +1,212 @@
#!/usr/bin/env python
# vim: fileencoding=utf-8
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
from __future__ import print_function
import os, sys
from os.path import isdir, isfile, islink, join
from optparse import OptionParser
from subprocess import check_call, CalledProcessError, PIPE
options = None
args = []
available_types = set(['scons'])
tool_stdout = PIPE
def main():
global options
global args
global tool_stdout
"""Parse the options and execute the program."""
usage = \
"""Usage: %prog [options] [test1 [test2 [...]]]
If you provide one or more tests, this will run the provided tests.
Otherwise, it will look for tests in the current directory and run them all.
"""
# option parsing
parser = OptionParser(usage)
parser.set_defaults(
action='run',
verbose=True)
parser.add_option("-c", "--clean",
action='store_const', const='clean', dest='action',
help="deletes any generated files in the tests")
parser.add_option("--run",
action='store_const', const='run', dest='action',
help="sets up the environment, compiles and runs the tests")
parser.add_option("-v", "--verbose",
action='store_true', dest='verbose',
help="spew out more details")
parser.add_option("-q", "--quiet",
action='store_false', dest='verbose',
help="spew out only success/failure of tests")
parser.add_option("--target-dir",
dest='target_dir', action='store', default='./',
help='target directory to look for tests in. default: %default')
parser.add_option("--debug",
dest='debug', action='store_true', default=False,
help='turn on debug output.')
(options, args) = parser.parse_args()
if options.debug or options.verbose:
tool_stdout = None
# gather the tests
tests = []
if len(args) == 0:
tests = crawl_tests(options.target_dir)
else:
tests = args
tests = purge_tests(tests)
# run the tests
if options.action == 'run':
for t in tests:
run_test(t)
elif options.action == 'clean':
for t in tests:
clean_test(t)
def crawl_tests(target):
"""Gather the directories in the test directory."""
files = os.listdir(target)
return [f for f in files if isdir(f) and f[0] != '.']
def purge_tests(dirs):
"""Look at the test candidates and purge those that aren't from the list"""
tests = []
for t in dirs:
if isfile(join(t, 'TestDef.py')):
tests.append(t)
else:
warn("{0} is not a test (missing TestDef.py file).".format(t))
return tests
def warn(msg):
"""A general warning function."""
if options.verbose:
print('[Warn]: ' + msg, file=sys.stderr)
def notice(msg):
"""A general print function."""
if options.verbose:
print(msg)
def debug(msg):
"""A debugging function"""
if options.debug:
print(msg)
def run_test(t):
"""Runs the test in directory t."""
opts = read_opts(t)
notice("-----------------------------------------------------")
notice("running test '{0}':\n".format(t))
readme = join(t, 'README')
if isfile(readme):
notice(open(readme).read())
notice("")
if opts['type'] not in available_types:
warn('{0} is not a recognised test type in {1}'.format(opts['type'], t))
return
if not opts['expect_success']:
warn("tests that fail intentionally are not yet supported.")
return
# set up the environment
setup_env(t, opts)
# run the test
try:
if opts['type'] == 'scons':
run_scons(t, opts)
except RuntimeError as e:
print("Test {0} failed.".format(t))
return
if not options.verbose:
print('.', end='')
sys.stdout.flush()
else:
print("test '{0}' successful.".format(t))
def read_opts(t):
"""Read the test options and return them."""
opts = {
'expect_success' : True,
'type' : 'scons',
'links' : {}
}
f = open(join(t, "TestDef.py"))
exec(f.read(), opts)
return opts
def setup_env(t, opts):
"""Set up the environment for the test."""
# symlinks
links = opts['links']
for link in links:
frm = links[link]
to = join(t, link)
debug("Symlinking {0} to {1}".format(frm, to))
if islink(to):
os.unlink(to)
os.symlink(frm, to)
def teardown_env(t, opts):
"""Remove all files generated for the test."""
links = opts['links']
for link in links:
to = join(t, link)
debug('removing link {0}'.format(to))
os.unlink(to)
def clean_test(t):
"""Remove all generated files."""
opts = read_opts(t)
notice("cleaning test {0}".format(t))
if opts['type'] == 'scons':
setup_env(t, opts) # scons needs the environment links to work
clean_scons(t, opts)
teardown_env(t, opts)
def clean_scons(t, opts):
"""Make scons clean after itself."""
cwd = os.getcwd()
os.chdir(t)
try:
check_call(['scons', '--clean'], stdout=tool_stdout, stderr=None)
except CalledProcessError as e:
warn("SCons failed with error {0}".format(e.returncode))
os.chdir(cwd)
sconsign = join(t, '.sconsign.dblite')
if isfile(sconsign):
os.unlink(sconsign)
def run_scons(t, opts):
"""Run scons test."""
cwd = os.getcwd()
os.chdir(t)
try:
check_call(['scons', '--clean'], stdout=tool_stdout)
check_call(['scons', '.'], stdout=tool_stdout)
check_call(['scons', 'check'], stdout=tool_stdout)
except CalledProcessError as e:
os.chdir(cwd) # clean up
raise e
os.chdir(cwd)
if __name__ == "__main__":
main()
if not options.verbose:
print() # quiet doesn't output newlines.

View File

@ -0,0 +1,3 @@
Tests whether expanding '#' to the top-level directory works as intended in
scons.
by: Gašper Ažman

View File

@ -0,0 +1,10 @@
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST='./../../../../bin/cxxtestgen'
)
env['CXXTEST_SKIP_ERRORS'] = True
env.CxxTest(['src/ThrowNoStd.h'])
env.CxxTest(['src/AborterNoThrow.h'])
env.CxxTest(['src/Comments.h'])

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'src' : '../../../../test'}

View File

@ -0,0 +1,2 @@
Tests whether we can swallow file nodes as sources as well as strings.
by: Gašper Ažman

View File

@ -0,0 +1,3 @@
env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
env.CxxTest('joint_tests',[Glob('src/*.t.h'), 'src/requirement.cpp'])

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}

View File

@ -0,0 +1,14 @@
/**
* @file requirement.cpp
* Implementation of the requirement function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:09:42 AM
*/
#include "requirement.h"
bool call_a_requirement() {
return true;
}

View File

@ -0,0 +1,14 @@
#ifndef REQUIREMENT_H
#define REQUIREMENT_H
/**
* @file requirement.h
* Prototype for the call_a_requirement() function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:08:35 AM
*/
bool call_a_requirement();
#endif

View File

@ -0,0 +1,23 @@
#ifndef TEST_BAR_T_H
#define TEST_BAR_T_H
/**
* @file test_bar.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:04:06 AM
*/
#include <cxxtest/TestSuite.h>
#include "requirement.h"
class TestBar : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif

View File

@ -0,0 +1,23 @@
#ifndef TEST_FOO_T_H
#define TEST_FOO_T_H
/**
* @file test_foo.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:02:06 AM
*/
#include "requirement.h"
#include <cxxtest/TestSuite.h>
class TestFoo : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif

View File

@ -0,0 +1,2 @@
Test for various things cxxtest failed to do, but now does.
by: Edmundo López B.

View File

@ -0,0 +1,35 @@
# What I want to do is the following:
# I have my class files ending with .cc and
# the main file ending with .cpp. This way it
# very easy to do the following line just to
# have all sources in that variable
import os
mySrc = Glob("*.cc")
myFlags = ['-I.']
myEnv = Environment( ENV = os.environ, tools = ['default', \
'cxxtest'], toolpath=['../../'])
# Here is the first problem I corrected:
# Flags won't be correctly recognized by cxxtest
myEnv.Replace(CXXFLAGS = myFlags)
# Then I want to convert those sources to objects
myObjs = myEnv.Object(mySrc)
# Having the objects I can create my program
# this way:
myEnv.Program('hello', ['main.cpp'] + myObjs)
# Now I want to do the same thing with the tests
# target
# With the non corrected version you'll get 2 errors:
# The CXXFLAGS are not set correctly
# It won't even accept this construction, which as you see
# works perfectly with Program (and CxxTest should work like it)
myEnv.CxxTest('helloTest', ['hellotest.t.h'] + myObjs)

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}

View File

@ -0,0 +1,22 @@
/**
* \file
* Implementation of class.
*/
/****************************************************
* Author: Edmundo LOPEZ
* email: lopezed5@etu.unige.ch
*
* This code was written as a part of my bachelor
* thesis at the University of Geneva.
*
* $Id$
*
* **************************************************/
#include <hello.hh>
int
Hello::foo(int x, int y)
{
return x + y;
}

View File

@ -0,0 +1,15 @@
/**
* \file
* File containing a class
*/
/****************************************************
* Author: Edmundo LOPEZ
* email: lopezed5@etu.unige.ch
*
* **************************************************/
class Hello
{
public:
int foo(int x, int y);
};

View File

@ -0,0 +1,23 @@
/**
* \file
* The test file.
*/
/****************************************************
* Author: Edmundo LOPEZ
* email: lopezed5@etu.unige.ch
*
* **************************************************/
#include <cxxtest/TestSuite.h>
#include <hello.hh>
class helloTestSuite : public CxxTest::TestSuite
{
public:
void testFoo()
{
Hello h;
TS_ASSERT_EQUALS (h.foo(2,2), 4);
}
};

View File

@ -0,0 +1,18 @@
/**
* \file
* Main function comes here.
*/
/****************************************************
* Author: Edmundo LOPEZ
* email: lopezed5@etu.unige.ch
*
* **************************************************/
#include <hello.hh>
#include <iostream>
int main (int argc, char *argv[])
{
Hello h;
std::cout << h.foo(2,3) << std::endl;
}

View File

@ -0,0 +1,3 @@
Tests:
- if CXXTEST_CXXFLAGS_REMOVE and CXXTEST_CCFLAGS_REMOVE flags work,
- if CCFLAGS and CXXFLAGS vars work.

View File

@ -0,0 +1,12 @@
flags = '-pedantic-errors -Weffc++ -Wall -Wextra -ansi'
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CCFLAGS=flags,
CXXFLAGS=flags,
CXXTEST_CXXFLAGS_REMOVE=['-pedantic-errors','-Weffc++','-Wextra','-Wall','-W'],
CXXTEST_CCFLAGS_REMOVE=['-pedantic-errors','-Weffc++','-Wextra','-Wall','-W']
)
env.CxxTest(['src/not-with-pedantic.h'])
env.CxxTest(['src/only_with_ansi.t.h'])

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}

View File

@ -0,0 +1,20 @@
/**
* @file not-with-pedantic.h
* Compiles, but not with -pedantic.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-09-30 13:33:50
*/
#include <cxxtest/TestSuite.h>
class TestPedantic : public CxxTest::TestSuite
{
public:
void testPedanticPresent() {
TS_ASSERT(true);
int f = (true)?:5;
}
};

View File

@ -0,0 +1,22 @@
/**
* @file only_with_ansi.t.h
* This test only runs correctly if -ansi was supplied as a g++ switch.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2009-02-11 06:26:59 PM
*/
#include <cxxtest/TestSuite.h>
class TestAnsi : public CxxTest::TestSuite
{
public:
void testAnsiPresent() {
#ifdef __STRICT_ANSI__
TS_ASSERT(true);
#else
TS_ASSERT(false);
#endif
}
};

View File

@ -0,0 +1,5 @@
This test tests whether variables that are put into the environment after it has
been initialised work as expected.
If they do not, -pedantic-errors will appear in the gcc commandline and the
compilation WILL FAIL, failing the test.

View File

@ -0,0 +1,16 @@
flags = '-Weffc++ -Wall -Wextra -std=gnu++0x'
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CCFLAGS = Split(flags) + ['-pedantic-errors'],
CXXFLAGS = Split(flags) + ['-pedantic-errors']
)
env['CXXTEST_CXXFLAGS_REMOVE']=['-Weffc++','-Wextra','-Wall','-W']
env['CXXTEST_CCFLAGS_REMOVE']='-Weffc++ -Wextra -Wall -W'
env['CCFLAGS'] = flags
env['CXXFLAGS'] = flags
env['CXXTEST_SKIP_ERRORS'] = True
env.CxxTest(['src/not-with-pedantic.h'])

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}

View File

@ -0,0 +1,19 @@
/**
* @file not-with-pedantic.h
* Compiles, but not with -pedantic.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-09-30 13:33:50
*/
#include <cxxtest/TestSuite.h>
class TestPedantic : public CxxTest::TestSuite
{
public:
void testPedanticPresent() {
int f = (true)?:5;
}
};

View File

@ -0,0 +1,2 @@
Test whether we can run program that depends on (shared) libraries that we know
but they are outside of standard load path.

View File

@ -0,0 +1,3 @@
env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
SConscript(['src/SConscript', 'test/SConscript'], exports = ['env'])

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}

View File

@ -0,0 +1,3 @@
Import('env')
env.SharedLibrary('foo', 'foo.cpp')

View File

@ -0,0 +1,4 @@
int foo()
{
return 0;
}

View File

@ -0,0 +1,2 @@
Import('env')
env.CxxTest('test.t.h', LIBS = ['foo'], CXXTEST_LIBPATH = ['../src'])

View File

@ -0,0 +1,12 @@
// test/test.t.h
#include <cxxtest/TestSuite.h>
extern int foo();
class FooTestSuite1 : public CxxTest::TestSuite
{
public:
void testFoo(void)
{
TS_ASSERT_EQUALS(foo(), 0);
}
};

View File

@ -0,0 +1,3 @@
Test whether we can run program that depends on (shared) libraries that we know
but they are outside of standard load path. Test whether multiple test runners
do not alter each other.

View File

@ -0,0 +1,3 @@
env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
SConscript(['src1/SConscript', 'src2/SConscript', 'test/SConscript'], exports = ['env'])

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}

View File

@ -0,0 +1,3 @@
Import('env')
env.SharedLibrary('foo', 'foo.cpp')

View File

@ -0,0 +1,4 @@
int foo()
{
return 0;
}

View File

@ -0,0 +1,3 @@
Import('env')
env.SharedLibrary('bar', 'bar.cpp')

View File

@ -0,0 +1,4 @@
int bar()
{
return 0;
}

View File

@ -0,0 +1,5 @@
Import('env')
env.CxxTest('test1.t.h', LIBS = ['foo'], CXXTEST_LIBPATH = ['../src1'], CXXTEST_TARGET = 'check-1')
env.CxxTest('test2.t.h', LIBS = ['bar'], CXXTEST_LIBPATH = ['../src2'], CXXTEST_TARGET = 'check-2')
env.Alias('check', ['check-1', 'check-2'])
env.AlwaysBuild('check')

View File

@ -0,0 +1,12 @@
// test/test.t.h
#include <cxxtest/TestSuite.h>
extern int foo();
class FooTestSuite1 : public CxxTest::TestSuite
{
public:
void testFoo(void)
{
TS_ASSERT_EQUALS(foo(), 0);
}
};

View File

@ -0,0 +1,12 @@
// test/test.t.h
#include <cxxtest/TestSuite.h>
extern int bar();
class BarTestSuite1 : public CxxTest::TestSuite
{
public:
void testBar(void)
{
TS_ASSERT_EQUALS(bar(), 0);
}
};

View File

@ -0,0 +1,8 @@
env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
env.CxxTest('joint_tests',
Split('src/test_foo.t.h '
'src/test_bar.t.h '
'src/requirement.cpp'
)
)

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}

View File

@ -0,0 +1,14 @@
/**
* @file requirement.cpp
* Implementation of the requirement function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:09:42 AM
*/
#include "requirement.h"
bool call_a_requirement() {
return true;
}

View File

@ -0,0 +1,14 @@
#ifndef REQUIREMENT_H
#define REQUIREMENT_H
/**
* @file requirement.h
* Prototype for the call_a_requirement() function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:08:35 AM
*/
bool call_a_requirement();
#endif

View File

@ -0,0 +1,23 @@
#ifndef TEST_BAR_T_H
#define TEST_BAR_T_H
/**
* @file test_bar.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:04:06 AM
*/
#include <cxxtest/TestSuite.h>
#include "requirement.h"
class TestBar : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif

View File

@ -0,0 +1,23 @@
#ifndef TEST_FOO_T_H
#define TEST_FOO_T_H
/**
* @file test_foo.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:02:06 AM
*/
#include "requirement.h"
#include <cxxtest/TestSuite.h>
class TestFoo : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif

View File

@ -0,0 +1,9 @@
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST_INSTALL_DIR = '../../../../',
CPPPATH = ['src/cpppathdir/']
)
env.CxxTest(['src/cpppath.t.h'])

View File

@ -0,0 +1,25 @@
#ifndef CPPPATH_T_H
#define CPPPATH_T_H
/**
* @file cpppath.t.h
* This file needs the include in the include dir.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:16:46 AM
*/
// actual path cpppathdir/include.h
#include "include.h"
#include <cxxtest/TestSuite.h>
class CppPathTest : public CxxTest::TestSuite
{
public:
void test_i_need_me_exists() {
TS_ASSERT(i_need_me() == 0);
}
};
#endif

View File

@ -0,0 +1,16 @@
#ifndef INCLUDE_H
#define INCLUDE_H
/**
* @file include.h
* Include file for this test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:15:40 AM
*/
int i_need_me() {
return 0;
}
#endif

View File

@ -0,0 +1,10 @@
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST_INSTALL_DIR = '../../../../'
)
env['CXXTEST_SKIP_ERRORS'] = True
env.CxxTest(['src/ThrowNoStd.h'])
env.CxxTest(['src/AborterNoThrow.h'])
env.CxxTest(['src/Comments.h'])

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'src' : '../../../../test/'}

View File

@ -0,0 +1,8 @@
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST_INSTALL_DIR = '../../../../',
)
env.CxxTest(['src/failtest.t.h'], CPPPATH=['#'], CXXTEST_RUNNER="CrazyRunner")

View File

@ -0,0 +1,16 @@
#ifndef __cxxtest_CrazyRunner_h__
#define __cxxtest_CrazyRunner_h__
/*
* This is not a proper runner. Just a simple class that looks like one.
*/
namespace CxxTest {
class CrazyRunner {
public:
int run() { return 0; }
void process_commandline(int argc, char** argv) { }
};
}
#endif

View File

@ -0,0 +1,23 @@
#ifndef FAILTEST_T_H
#define FAILTEST_T_H
/**
* @file failtest.t.h
* This test will succed only with a CrazyRunner.
*
* @author
* @version 1.0
* @since jue ago 28 14:18:57 ART 2008
*/
#include <cxxtest/TestSuite.h>
class CppPathTest : public CxxTest::TestSuite
{
public:
void test_i_will_fail() {
TS_ASSERT(false);
}
};
#endif

View File

@ -0,0 +1,2 @@
Tests whether we can swallow recursively supplied sources - a list of lists, for
instance.

View File

@ -0,0 +1,3 @@
env = Environment(toolpath=['../../'],tools=['default','cxxtest'])
env.CxxTest('joint_tests',['src/test_foo.t.h',['src/test_bar.t.h','src/requirement.cpp']])

View File

@ -0,0 +1,10 @@
#-------------------------------------------------------------------------
# CxxTest: A lightweight C++ unit testing library.
# Copyright (c) 2008 Sandia Corporation.
# This software is distributed under the LGPL License v3
# For more information, see the COPYING file in the top CxxTest directory.
# Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
# the U.S. Government retains certain rights in this software.
#-------------------------------------------------------------------------
links = {'cxxtest' : '../../../../'}

View File

@ -0,0 +1,14 @@
/**
* @file requirement.cpp
* Implementation of the requirement function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:09:42 AM
*/
#include "requirement.h"
bool call_a_requirement() {
return true;
}

View File

@ -0,0 +1,14 @@
#ifndef REQUIREMENT_H
#define REQUIREMENT_H
/**
* @file requirement.h
* Prototype for the call_a_requirement() function.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:08:35 AM
*/
bool call_a_requirement();
#endif

View File

@ -0,0 +1,23 @@
#ifndef TEST_BAR_T_H
#define TEST_BAR_T_H
/**
* @file test_bar.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:04:06 AM
*/
#include <cxxtest/TestSuite.h>
#include "requirement.h"
class TestBar : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif

View File

@ -0,0 +1,23 @@
#ifndef TEST_FOO_T_H
#define TEST_FOO_T_H
/**
* @file test_foo.t.h
* Test one for the joint test ehm, test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-29 10:02:06 AM
*/
#include "requirement.h"
#include <cxxtest/TestSuite.h>
class TestFoo : public CxxTest::TestSuite
{
public:
void test_foo() {
TS_ASSERT(call_a_requirement());
}
};
#endif

View File

@ -0,0 +1,9 @@
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST_INSTALL_DIR = '../../../../',
CPPPATH = 'src/cpppathdir/'
)
env.CxxTest(['src/cpppath.t.h'])

View File

@ -0,0 +1,25 @@
#ifndef CPPPATH_T_H
#define CPPPATH_T_H
/**
* @file cpppath.t.h
* This file needs the include in the include dir.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:16:46 AM
*/
// actual path cpppathdir/include.h
#include "include.h"
#include <cxxtest/TestSuite.h>
class CppPathTest : public CxxTest::TestSuite
{
public:
void test_i_need_me_exists() {
TS_ASSERT(i_need_me() == 0);
}
};
#endif

View File

@ -0,0 +1,16 @@
#ifndef INCLUDE_H
#define INCLUDE_H
/**
* @file include.h
* Include file for this test.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:15:40 AM
*/
int i_need_me() {
return 0;
}
#endif

View File

@ -0,0 +1,9 @@
env = Environment(
toolpath=['../../'],
tools=['default','cxxtest'],
CXXTEST_INSTALL_DIR = '../../../../',
CPPPATH = ['src/cpppathdir/']
)
env.CxxTest('src/cpppath')

View File

@ -0,0 +1,25 @@
#ifndef CPPPATH_T_H
#define CPPPATH_T_H
/**
* @file cpppath.t.h
* This file needs the include in the include dir.
*
* @author Gašper Ažman (GA), gasper.azman@gmail.com
* @version 1.0
* @since 2008-08-28 11:16:46 AM
*/
// actual path cpppathdir/include.h
#include "include.h"
#include <cxxtest/TestSuite.h>
class CppPathTest : public CxxTest::TestSuite
{
public:
void test_i_need_me_exists() {
TS_ASSERT(i_need_me() == 0);
}
};
#endif

Some files were not shown because too many files have changed in this diff Show More