Initial commit

This commit is contained in:
Bassem Girgis
2018-12-20 17:34:07 -06:00
parent 7a2d899662
commit 81b4b9e273
34743 changed files with 5940233 additions and 0 deletions

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

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