From f850dcc5def076734d10f828a730c65348d1071c Mon Sep 17 00:00:00 2001 From: James Shen <46590537+JamesJieranShen@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:03:37 -0500 Subject: [PATCH] rattest QOL update + centroid test (#214) * ignore test outputs * Install rattest to install/bin directly. * Add local / absolute experiment to ratdb path, mainly for testing purposes. * update documentation * (attempt to) revive fitcentroid test * add cformat to test scripts * remove old files * add basic ANSI color code for test output * move template back to workflow root * clean up fitcentroid code * add validity guard to fitcentroid test * update fitcentroid test to remove low energy runs --- ...sts-workflow.yml => rattests-template.yml} | 2 +- .github/workflows/rattests.yml | 8 +- .gitignore | 5 + CMakeLists.txt | 3 + cformat.sh | 2 +- doc/users_guide/rattest.rst | 11 +- python/rattest/__init__.py | 6 +- python/rattest/datafile.py | 89 --- python/rattest/task.py | 109 ---- src/geo/src/DetectorConstruction.cc | 12 +- test/SConstruct | 43 -- test/TestDB.hh | 122 ---- test/TestDBMessenger.hh | 48 -- test/TestLog.hh | 47 -- test/cxxtest/Descriptions.cpp | 51 -- test/cxxtest/Descriptions.h | 74 --- test/cxxtest/DummyDescriptions.cpp | 47 -- test/cxxtest/DummyDescriptions.h | 76 --- test/cxxtest/ErrorFormatter.h | 281 --------- test/cxxtest/ErrorPrinter.h | 55 -- test/cxxtest/Flags.h | 121 ---- test/cxxtest/GlobalFixture.cpp | 21 - test/cxxtest/GlobalFixture.h | 30 - test/cxxtest/Gui.h | 178 ------ test/cxxtest/LinkedList.cpp | 118 ---- test/cxxtest/LinkedList.h | 65 -- test/cxxtest/Mock.h | 350 ----------- test/cxxtest/ParenPrinter.h | 21 - test/cxxtest/QtGui.h | 271 -------- test/cxxtest/RealDescriptions.cpp | 240 ------- test/cxxtest/RealDescriptions.h | 223 ------- test/cxxtest/Root.cpp | 18 - test/cxxtest/SelfTest.h | 7 - test/cxxtest/StdHeaders.h | 25 - test/cxxtest/StdValueTraits.h | 229 ------- test/cxxtest/StdioFilePrinter.h | 41 -- test/cxxtest/StdioPrinter.h | 22 - test/cxxtest/TeeListener.h | 182 ------ test/cxxtest/TestListener.h | 70 --- test/cxxtest/TestRunner.h | 125 ---- test/cxxtest/TestSuite.cpp | 96 --- test/cxxtest/TestSuite.h | 512 --------------- test/cxxtest/TestTracker.cpp | 180 ------ test/cxxtest/TestTracker.h | 114 ---- test/cxxtest/ValueTraits.cpp | 124 ---- test/cxxtest/ValueTraits.h | 377 ----------- test/cxxtest/Win32Gui.h | 531 ---------------- test/cxxtest/X11Gui.h | 327 ---------- test/cxxtest/YesNoRunner.h | 29 - test/cxxtestgen.pl | 551 ---------------- test/cxxtestgen.py | 593 ------------------ .../acrylic_attenuation/acrylic_attenuation.C | 32 +- test/full/fitcentroid/cylinder/PMTINFO.ratdb | 13 + test/full/fitcentroid/cylinder/cylinder.geo | 58 ++ test/full/fitcentroid/fitcentroid.C | 37 +- test/full/fitcentroid/fitcentroid.mac | 13 +- test/full/fitcentroid/standard.root | Bin 0 -> 8109 bytes test/full/geoprint/geoprint.C | 8 +- test/test.ratdb | 41 -- test/test2.ratdb | 35 -- test/testsimple.geo | 101 --- 61 files changed, 155 insertions(+), 7065 deletions(-) rename .github/workflows/{rattests-workflow.yml => rattests-template.yml} (92%) delete mode 100644 python/rattest/datafile.py delete mode 100644 python/rattest/task.py delete mode 100644 test/SConstruct delete mode 100644 test/TestDB.hh delete mode 100644 test/TestDBMessenger.hh delete mode 100644 test/TestLog.hh delete mode 100644 test/cxxtest/Descriptions.cpp delete mode 100644 test/cxxtest/Descriptions.h delete mode 100644 test/cxxtest/DummyDescriptions.cpp delete mode 100644 test/cxxtest/DummyDescriptions.h delete mode 100644 test/cxxtest/ErrorFormatter.h delete mode 100644 test/cxxtest/ErrorPrinter.h delete mode 100644 test/cxxtest/Flags.h delete mode 100644 test/cxxtest/GlobalFixture.cpp delete mode 100644 test/cxxtest/GlobalFixture.h delete mode 100644 test/cxxtest/Gui.h delete mode 100644 test/cxxtest/LinkedList.cpp delete mode 100644 test/cxxtest/LinkedList.h delete mode 100644 test/cxxtest/Mock.h delete mode 100644 test/cxxtest/ParenPrinter.h delete mode 100644 test/cxxtest/QtGui.h delete mode 100644 test/cxxtest/RealDescriptions.cpp delete mode 100644 test/cxxtest/RealDescriptions.h delete mode 100644 test/cxxtest/Root.cpp delete mode 100644 test/cxxtest/SelfTest.h delete mode 100644 test/cxxtest/StdHeaders.h delete mode 100644 test/cxxtest/StdValueTraits.h delete mode 100644 test/cxxtest/StdioFilePrinter.h delete mode 100644 test/cxxtest/StdioPrinter.h delete mode 100644 test/cxxtest/TeeListener.h delete mode 100644 test/cxxtest/TestListener.h delete mode 100644 test/cxxtest/TestRunner.h delete mode 100644 test/cxxtest/TestSuite.cpp delete mode 100644 test/cxxtest/TestSuite.h delete mode 100644 test/cxxtest/TestTracker.cpp delete mode 100644 test/cxxtest/TestTracker.h delete mode 100644 test/cxxtest/ValueTraits.cpp delete mode 100644 test/cxxtest/ValueTraits.h delete mode 100644 test/cxxtest/Win32Gui.h delete mode 100644 test/cxxtest/X11Gui.h delete mode 100644 test/cxxtest/YesNoRunner.h delete mode 100755 test/cxxtestgen.pl delete mode 100755 test/cxxtestgen.py create mode 100644 test/full/fitcentroid/cylinder/PMTINFO.ratdb create mode 100644 test/full/fitcentroid/cylinder/cylinder.geo create mode 100644 test/full/fitcentroid/standard.root delete mode 100644 test/test.ratdb delete mode 100644 test/test2.ratdb delete mode 100644 test/testsimple.geo diff --git a/.github/workflows/rattests-workflow.yml b/.github/workflows/rattests-template.yml similarity index 92% rename from .github/workflows/rattests-workflow.yml rename to .github/workflows/rattests-template.yml index 9718d6d0..86b30fa4 100644 --- a/.github/workflows/rattests-workflow.yml +++ b/.github/workflows/rattests-template.yml @@ -24,7 +24,7 @@ jobs: run: | source /ratpac-setup/env.sh source ../ratpac2/ratpac.sh - python3 $RATSHARE/python/rattest.py -t test/full/${{ inputs.rattest-name }} + rattest -t test/full/${{ inputs.rattest-name }} id: test continue-on-error: true - name: upload-result diff --git a/.github/workflows/rattests.yml b/.github/workflows/rattests.yml index 018c39f8..3a565828 100644 --- a/.github/workflows/rattests.yml +++ b/.github/workflows/rattests.yml @@ -31,6 +31,12 @@ jobs: acrylic_attenuation: needs: build - uses: ./.github/workflows/rattests-workflow.yml + uses: ./.github/workflows/rattests-template.yml with: rattest-name: acrylic_attenuation + + fitcentroid: + needs: build + uses: ./.github/workflows/rattests-template.yml + with: + rattest-name: fitcentroid diff --git a/.gitignore b/.gitignore index b0df4806..b0c3b6a7 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ src/core/Config.hh *.log *.root +!test/full/*/standard.root *.heprep .DS_Store *.gif @@ -35,3 +36,7 @@ doc/doxygen .pytest_cache* ratpac.*sh RatpacConfig.cmake + +# rattest outputs +test/full/*/*.png +test/full/*/*.html diff --git a/CMakeLists.txt b/CMakeLists.txt index 677517ab..e0673156 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -139,6 +139,9 @@ install(DIRECTORY models/ DESTINATION ${RATSHARE}/models install(DIRECTORY python/ DESTINATION ${RATSHARE}/python PATTERN "python/*") +# Install rattest executable +install(PROGRAMS python/rattest.py DESTINATION bin RENAME rattest) + # Install the macro files install(DIRECTORY macros/ DESTINATION ${RATSHARE}/macros PATTERN "macros/*") diff --git a/cformat.sh b/cformat.sh index 699bb9fa..f146cc0e 100755 --- a/cformat.sh +++ b/cformat.sh @@ -11,7 +11,7 @@ fi echo "Checking formatting..." changes=0 -for file in $(find ./src \( -name "*.cc" -o -name "*.hh" -o -name "*.icc" -o -name "*.cpp" -o -name "*.hpp" \)); do +for file in $(find ./src ./test \( -name "*.cc" -o -name "*.hh" -o -name "*.icc" -o -name "*.cpp" -o -name "*.hpp" -o -name "*.C" \)); do retval=$(clang-format -style=file -n -Werror $file) if [ $? -eq 1 ]; then echo "Formatting $file" diff --git a/doc/users_guide/rattest.rst b/doc/users_guide/rattest.rst index f5b02975..93dbcfb0 100644 --- a/doc/users_guide/rattest.rst +++ b/doc/users_guide/rattest.rst @@ -8,7 +8,7 @@ Rattest is a framework for creating unit and functional tests for RAT. These tes At minimum, a test consists of a RAT macro and a ROOT macro -- the Monte Carlo and the analysis. New (simplified) geometries, modified RATDB databases, etc. can also be included. When run, these tests are compared to a standard via a KS test, and a web page is created with histograms (standard and current) and KS test results. The standard RAT logs and output ROOT file is also available for analysis. -The existing rattests are included with the standard RAT distribution, in `$RATSHARE/test/`, with the functional tests in `$RATSHARE/test/full/`. To run a single test, `cd` to the test directory and simply run `python3 $RATSHARE/python/rattest.py ` where `` corresponds to a folder in `$RATSHARE/test/full`. Rattest will iterate through the directory structure to find the test, run the RAT macro, run the ROOT macro on the output, and generate a report page. +The existing rattests are included with the standard RAT distribution, in `$RATSHARE/test/`, with the functional tests in `$RATSHARE/test/full/`. To run a single test, `cd` to the test directory and simply run `rattest ` where `` corresponds to a folder in `$RATSHARE/test/full`. Rattest will iterate through the directory structure to find the test, run the RAT macro, run the ROOT macro on the output, and generate a report page. The `rattest.py` script takes the following options:: @@ -108,6 +108,11 @@ Keep things as simple as possible, and turn off as many options as possible. The /run/beamOn 500 +You can also create a custom rat "experiment" in the test directory. This experiment can include any custom ratdb tables you want. +You can tell rat to use this experiment by adding the line:: + + /rat/db/set DETECTOR experiment "cylinder" + 5. Write a ROOT macro The ROOT macro should create a histogram that captures the benchmark you are looking for. It should consist of a single `void` function with the same name as the macro ie `acrylic_attentuation(std::string event_file, std::string outfile)`. `rattest` will automatically fill in the function arguments when it calls the root macro. @@ -142,8 +147,8 @@ The ROOT macro from `acrylic_attenuation`:: 7. Create a standard - From the test directory, run `python3 rattest.py -u [your test name]`. This will create the file `standard.root`, which will be the basis for comparison until the next time you run `rattest` with the `-u` option. Take a look at `results.html` to see how things worked out. + From the test directory, run `rattest -u [your test name]`. This will create the file `standard.root`, which will be the basis for comparison until the next time you run `rattest` with the `-u` option. Take a look at `results.html` to see how things worked out. -This is pretty much it. If you run `python3 rattest.py [your test name]` again, you should get a results page (which will open in your default browser unless you specified the `-t` option) with very similar results. +This is pretty much it. If you run `rattest [your test name]` again, you should get a results page (which will open in your default browser unless you specified the `-t` option) with very similar results. If you think the test is useful to others, commit it to the RAT repository with svn. Be sure to commit only the `rattest.config`, RAT and ROOT macro, any geometry or RATDB files, and `standard.root`. diff --git a/python/rattest/__init__.py b/python/rattest/__init__.py index 256edba3..58430df2 100644 --- a/python/rattest/__init__.py +++ b/python/rattest/__init__.py @@ -126,7 +126,7 @@ def run(self, regen_mc=False, regen_plots=False, html=None): Run a full RAT test, including simulation and the ROOT macro. Includes writing results to the HTML file, if option is specified. ''' - print('=' * 5 + ' Run Test: {} '.format(self.name) + '=' * 5) + print("\033[1;35m" + '=' * 5 + ' Run Test: {} '.format(self.name) + '=' * 5 + "\033[0m") self._do_run(regen_mc=regen_mc, regen_plots=regen_plots) if html: @@ -248,7 +248,7 @@ def compare_hists(self, master_fname, current_fname, html=None): prob = m_obj.KolmogorovTest(c_obj) if m_obj.GetEntries() == 0 and c_obj.GetEntries() == 0: prob = 1 - print("Comparing {}: {}".format(objname, c_obj.GetTitle())) + print("\033[1;34mComparing {}: {}\033[0m".format(objname, c_obj.GetTitle())) #Require a perfect match if desired, else test against critical_probability if self.KS_threshold == 1.0: @@ -264,7 +264,7 @@ def compare_hists(self, master_fname, current_fname, html=None): success = False overall_success = False - success_message = "SUCCESS" if (success and overall_success) else "FAILURE" + success_message = "\033[1;32mSUCCESS\033[0m" if (success and overall_success) else "\033[1;31mFAILURE\033[0m" print(" {}: KS prob = {}".format(success_message, prob)) plotfile = os.path.join(self.testdir, objname + '.png') diff --git a/python/rattest/datafile.py b/python/rattest/datafile.py deleted file mode 100644 index 4a46b425..00000000 --- a/python/rattest/datafile.py +++ /dev/null @@ -1,89 +0,0 @@ -import sys, glob, os.path, re, time, shelve - -def load_local_config(): - '''load variables from local_config file and return as dict.''' - local_config = {} - try: - exec file('local_config') in globals(), local_config - except IOError, e: - if e.errno == 2: - print '''Local configuration file does not exist. Please run: - - cp local_config.orig local_config - -and edit it to specify your system settings.''' - else: - print 'Error accessing local_config:', e - sys.exit() - - return local_config - -def load_datasets(search_dir='data'): - 'Collect dataset descriptions' - datasets = {} - for ds_descfile in glob.glob(os.path.join(search_dir, '*', 'Dataset')): - # Extract short name from path - ds_name = re.match('data/(.+)/Dataset', ds_descfile).group(1) - - # load variables from file into ds_param - ds_param = {} - exec file(ds_descfile) in globals(), ds_param - - # Add directory - ds_param['dir'] = os.path.dirname(ds_descfile) - - datasets[ds_name] = ds_param - - return datasets - -def load_runfile(filename, create=False): - '''Load test run database. - - If create==False, this function will test for the existence of the file and - return None if it is not present. - - If create==True and filename==None, a new filename is generated to contain - the testrun data. Otherwise, filename is returned.''' - - if not filename: - if create: - filename = time.strftime('log/%Y%m%d-*') - candidates = glob.glob(filename) - candidates.sort() - - if len(candidates) == 0: - filename = time.strftime('log/%Y%m%d-00') - else: - last_index = int(candidates[-1][-2:]) - filename = time.strftime('log/%Y%m%d') + '-%02d'%(last_index+1) - print 'Creating test run', filename, '...' - else: - filename = time.strftime('log/*') - candidates = glob.glob(filename) - candidates.sort() - - if len(candidates) == 0: - print 'No default file found! Use -n option to create new one' - sys.exit(1) - else: - filename = candidates[-1] - print 'Opening test run', filename, '...' - - elif len(glob.glob(filename+'*')) == 0: - print 'Run file', filename, 'does not exist.' - sys.exit(1) - - - runfile = shelve.open(filename, writeback=True) - - if create: - runfile['ctime'] = time.time() - runfile['rev'] = -1 - runfile['filename'] = filename - - runfile['atime'] = time.time() - - runfile.sync() - - return runfile - diff --git a/python/rattest/task.py b/python/rattest/task.py deleted file mode 100644 index 6ddd9815..00000000 --- a/python/rattest/task.py +++ /dev/null @@ -1,109 +0,0 @@ -import os.path - -kPending = 0 -kRunning = 1 -kSuccess = 2 -kFail = 3 - -class TaskList: - def __init__(self): - self.index = {} - self.pending = [] - self.running = [] - self.success = [] - self.fail = [] - - def get_by_id(self, id): - return self.index[id] - - def update_status(self): - for t in running: - if t.status == kSuccess: - self.running.remove(t) - self.success.append(t) - elif t.status == kFail: - self.running.remove(t) - self.fail.append(t) - elif t.status == kPending: - print 'Warning: Task', name, \ - 'has reverted from running to pending!' - self.running.remove(t) - self.fail.append(t) - -class Task: - - def __init__(self, name, desc, cmd, success_file, dependencies=[]): - self.name = name - self.id = self.next_task_id() - self.cmd = cmd - self.jobid = -1 - self.success_file = success_file - self.__status = kPending - self.dependencies = dependencies - - last_task_id = -1 - def next_task_id(cls): - cls.last_task_id += 1 - return cls.last_task_id - next_task_id = classmethod(next_task_id) - - def get_status(self): - if self.__status == kRunning: - self.update_status() - return self.__status - def set_status(self, status): self.__status = status - status = property(get_status, set_status, doc='Current status of task') - - def update_status(self): - if self.__status != kRunning: - return - elif self.jobid < 0: # Not a grid job, so is run synchronously - if os.path.isfile(self.success_file): self.status = kSuccess - else: self.status = kFail - - def __repr__(self): - return 'Task %d: %s' % (self.id, self.cmd) - -def file_subst(fname_in, fname_out, subst): - fin = file(fname_in) - contents = fin.read() - fin.close() - - for key in subst.keys(): - contents = contents.replace("%"+key+"%", subst[key]) - - fout = file(fname_out, "w") - fout.write(contents) - fout.close() - - -def create_data_tasks(desc_list, local_config): - events_per_job = local_config['events_per_job'] - newtasks = { } - - for shortname, datadesc in desc_list.items(): - macro = os.path.join(datadesc['dir'], datadesc['macro']) - workdir = datadesc['dir'] - params = {} - - # Break into several jobs - numjobs = datadesc['events'] / events_per_job - for i in range(numjobs): - params['jobnum'] = '%03d' % i - jobfile = 'job%03d.mac' % i - logfile = 'job%03d.log' % i - - # Create macro file - full_jobfile = os.path.join(workdir, jobfile) - file_subst(macro, full_jobfile, params) - - # Create associated task object - t = Task(name = shortname, - desc = datadesc['desc'], - cmd = './run_data.sh %s %03d' % (workdir, i), - success_file = os.path.join(workdir, 'success.%03d' % i)) - - # Add to list - newtasks[t.id] = t - - return newtasks diff --git a/src/geo/src/DetectorConstruction.cc b/src/geo/src/DetectorConstruction.cc index d068db71..44e3943f 100644 --- a/src/geo/src/DetectorConstruction.cc +++ b/src/geo/src/DetectorConstruction.cc @@ -34,7 +34,15 @@ G4VPhysicalVolume *DetectorConstruction::Construct() { // Load experiment RATDB files before doing anything else try { experiment = ldetector->GetS("experiment"); - info << "Loading experiment-specific RATDB files for: " << experiment << newline; + } catch (DBNotFoundError &e) { + info << "No experiment-specific tables loaded." << newline; + } + info << "Loading experiment-specific RATDB files for: " << experiment << newline; + // Attempt to load literal experiments (absolute paths and/or experiments defined in local directory). + int result = db->LoadAll(experiment); + if (result == 2) { + info << "Found experiment files in " << experiment << newline; + } else { for (auto dir : Rat::ratdb_directories) { std::string experimentDirectoryString = dir + "/" + experiment; int result = db->LoadAll(experimentDirectoryString); @@ -43,8 +51,6 @@ G4VPhysicalVolume *DetectorConstruction::Construct() { break; } } - } catch (DBNotFoundError &e) { - info << "No experiment-specific tables loaded." << newline; } try { diff --git a/test/SConstruct b/test/SConstruct deleted file mode 100644 index 263be230..00000000 --- a/test/SConstruct +++ /dev/null @@ -1,43 +0,0 @@ -#-*-python-*- -# SConstruct file for compiling unit tests. -# -# Assumes all Test*.hh in the current directory contain CxxTest-style unit -# tests. - - -appname = 'testrat' -append_platform_name = False - -#### - -import os -import glob -from buildhelp import RATENVFILE, ROOTARCH, build_list - -env = SConscript(RATENVFILE) - -#### Builder: CxxTest(name of test file, [list of test headers]) -# -# Generates CxxTest test-runner source file from set of header files. - -cxxtest = Builder(action='./cxxtestgen.pl --error-printer -o $TARGET $SOURCES') -env.Append(BUILDERS={ 'CxxTest' : cxxtest }) -#### - - -env['mymain'] = True -env.Append(CPPPATH='#') # For cxxtest/ in current dir - -if append_platform_name: - appname += "_" + ROOTARCH - -#### Target: cxxtest harness -testcc = env.CxxTest(os.path.join(env['BUILDDIR'],'testrat.cc'), - glob.glob('Test*.hh')) -testobj = env.Object(testcc) -testapp = env.RATApp(appname, testobj) -env.Default(testapp) - -#### Target: Execute cxxtest harness -runtest = env.Command('runtest', testapp, './$SOURCE') -env.Alias('test', runtest) diff --git a/test/TestDB.hh b/test/TestDB.hh deleted file mode 100644 index 39e4d004..00000000 --- a/test/TestDB.hh +++ /dev/null @@ -1,122 +0,0 @@ -#include - -#include "RAT/DB.hh" - -using namespace std; -using namespace RAT; - -class TestDB : public CxxTest::TestSuite { - public: - void setUp() { db = new DB(); }; - - void tearDown() { delete db; }; - - void testGetDefault() { TS_ASSERT_DIFFERS(DB::Get(), static_cast(0)); }; - - void testLoad() { TS_ASSERT_EQUALS(db->Load("test.ratdb"), 1); }; - - void testLoadAll() { - TS_ASSERT_EQUALS(db->LoadAll("."), 1); - TS_ASSERT_DIFFERS(db->GetDefaultTable("MEDIA", "vacuum"), static_cast(0)); - TS_ASSERT_DIFFERS(db->GetDefaultTable("TEST", "foo"), static_cast(0)); - TS_ASSERT_EQUALS(db->GetDefaultTable("NOEXIST", ""), static_cast(0)); - }; - - void testGetLink() { - DBLinkPtr lmedia; - TS_ASSERT_THROWS_NOTHING(db->Load("test.ratdb")); - TS_ASSERT_THROWS_NOTHING(lmedia = db->GetLink("MEDIA")); - }; - - void testGetLinkGroup() { - DBLinkGroup lmediag; - TS_ASSERT_THROWS_NOTHING(db->Load("test.ratdb")); - TS_ASSERT_THROWS_NOTHING(lmediag = db->GetLinkGroup("MEDIA")); - - TS_ASSERT_EQUALS(lmediag["vacuum"]->GetS("media_name"), "Vacuum"); - TS_ASSERT_EQUALS(lmediag["h2o"]->GetS("media_name"), "Light water"); - }; - - void testNoExistUserSet() { - db->Load("test2.ratdb"); - DBLinkPtr ltest0 = db->GetLink("TEST", ""); - - // Verify we're looking at right index (TEST[1] has myint) - TS_ASSERT_THROWS_EQUALS(ltest0->GetI("myint"), DBNotFoundError & r, r, DBNotFoundError("TEST", "", "myint")); - TS_ASSERT_THROWS_EQUALS(ltest0->GetS("foo"), DBNotFoundError & r, r, DBNotFoundError("TEST", "", "foo")); - - // Implicitly setting index "" - db->SetI("TEST", "myint", 17); - - // Verify link sees this new value - TS_ASSERT_EQUALS(ltest0->GetI("myint"), 17); - }; - - void testParseTableName() { - string title; - string index; - - TS_ASSERT_EQUALS(DB::ParseTableName("TEST", title, index), true); - TS_ASSERT_EQUALS(title, string("TEST")); - TS_ASSERT_EQUALS(index, ""); - - TS_ASSERT_EQUALS(DB::ParseTableName("ABC[x]", title, index), true); - TS_ASSERT_EQUALS(title, string("ABC")); - TS_ASSERT_EQUALS(index, "x"); - - TS_ASSERT_EQUALS(DB::ParseTableName("XXX[ab12]", title, index), true); - TS_ASSERT_EQUALS(title, string("XXX")); - TS_ASSERT_EQUALS(index, "ab12"); - - TS_ASSERT_EQUALS(DB::ParseTableName("TE+", title, index), false); - TS_ASSERT_EQUALS(DB::ParseTableName("124d", title, index), false); - TS_ASSERT_EQUALS(DB::ParseTableName("XXX[ab1]A", title, index), false); - TS_ASSERT_EQUALS(DB::ParseTableName("!", title, index), false); - }; - - DB *db; -}; - -class TestDBLink : public CxxTest::TestSuite { - public: - DB *db; - DBLinkPtr ltest0; - DBLinkPtr ltest1; - - void setUp() { - db = new DB(); - ltest0 = db->GetLink("TEST", ""); - ltest1 = db->GetLink("TEST", "foo"); - db->Load("test2.ratdb"); - }; - - void tearDown() { delete db; }; - - void testGet() { - TS_ASSERT_EQUALS(ltest1->GetI("myint"), 17); // user - TS_ASSERT_DELTA(ltest1->GetD("mydouble"), 5.0, 1e-9); // default - TS_ASSERT_EQUALS(ltest1->GetS("mystring"), "default"); // default - }; - - void testGetArray() { - const vector &ia = ltest1->GetIArray("ia"); - TS_ASSERT_EQUALS(ia[4], 5); // default - - const vector &da = ltest1->GetDArray("da"); - TS_ASSERT_DELTA(da[2], 24.0, 1e-9); // user - - const vector &sa = ltest1->GetSArray("sa"); - TS_ASSERT_EQUALS(sa[0], "alvin"); // user - }; - - void testSmartPtr() { - for (int i = 0; i < 100; i++) { - // Create a whole bunch of links - DBLinkPtr ltemp = db->GetLink("TEST", "foo"); - } - - // All those links are now out of scope, so there should just - // be the two links we started with - TS_ASSERT_EQUALS(db->NumLinks(), 2); - } -}; diff --git a/test/TestDBMessenger.hh b/test/TestDBMessenger.hh deleted file mode 100644 index f2e1ee7c..00000000 --- a/test/TestDBMessenger.hh +++ /dev/null @@ -1,48 +0,0 @@ -#include - -#include - -#include "RAT/DB.hh" -#include "RAT/DBMessenger.hh" - -using namespace std; -using namespace RAT; - -class TestDBManager : public CxxTest::TestSuite { - public: - DB *db; - DBMessenger *dbm; - G4UImanager *ui; - DBLinkPtr ltest1; - - void setUp() { - db = new DB(); - dbm = new DBMessenger(db); - ltest1 = db->GetLink("TEST", "foo"); - ui = G4UImanager::GetUIpointer(); - }; - - void tearDown() { - delete dbm; - delete db; - }; - - void testLoad() { - ui->ApplyCommand("/rat/db/load test2.ratdb"); - TS_ASSERT_EQUALS(ltest1->GetI("myint"), 17); - }; - - void testSet() { - ui->ApplyCommand("/rat/db/set TEST[foo] myint 16"); - TS_ASSERT_EQUALS(ltest1->GetI("myint"), 16); - ui->ApplyCommand("/rat/db/set TEST[foo] mydouble 16.5d-3"); - TS_ASSERT_DELTA(ltest1->GetD("mydouble"), 16.5e-3, 1e-10); - ui->ApplyCommand("/rat/db/set TEST[foo] mystring 'ratratrat'"); - TS_ASSERT_EQUALS(ltest1->GetS("mystring"), "ratratrat"); - } - - void testSetAfterLoad() { - testLoad(); - testSet(); - } -}; diff --git a/test/TestLog.hh b/test/TestLog.hh deleted file mode 100644 index 2ed71be0..00000000 --- a/test/TestLog.hh +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include - -#include "RAT/Log.hh" - -using namespace std; -using namespace RAT; - -class Fixture1 : public CxxTest::GlobalFixture { - public: - bool setUpWorld() { - Log::Init("testrat.log", Log::DETAIL, Log::DEBUG); - return true; - }; -}; - -// Ensure that Log isn't trapping output from other tests -static Fixture1 init_fixture; - -class TestLog : public CxxTest::TestSuite { - public: - void testNormal() { - Log::Init("test.log", Log::INFO, Log::DETAIL); - - warn << "You should see this warning" << newline; - info << "You should see this info line" << newline; - detail << "This detail line should only be in the log file" << newline; - debug << "This should not be visible anywhere" << newline; - }; - - void testDebug() { - Log::Init("testdebug.log", Log::INFO, Log::DEBUG); - - warn << "You should see this warning" << newline; - info << "You should see this info line" << newline; - detail << "This detail line should only be in the log file" << newline; - debug << "This debug line should also be in the log file" << newline; - }; - - // Leave this test commented out since it terminates the program - // void testDie() { - // Log::Init("testdie.log", Log::INFO, Log::DETAIL); - - // Log::Die("terminating immediately"); - // warn << "You should never see this." << newline; - // }; -}; diff --git a/test/cxxtest/Descriptions.cpp b/test/cxxtest/Descriptions.cpp deleted file mode 100644 index f29df647..00000000 --- a/test/cxxtest/Descriptions.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef __cxxtest__Descriptions_cpp__ -#define __cxxtest__Descriptions_cpp__ - -#include - -namespace CxxTest { -TestDescription::~TestDescription() {} -SuiteDescription::~SuiteDescription() {} -WorldDescription::~WorldDescription() {} - -// -// Convert total tests to string -// -#ifndef _CXXTEST_FACTOR -char *WorldDescription::strTotalTests(char *s) const { - numberToString(numTotalTests(), s); - return s; -} -#else // _CXXTEST_FACTOR -char *WorldDescription::strTotalTests(char *s) const { - char *p = numberToString(numTotalTests(), s); - - if (numTotalTests() <= 1) return s; - - unsigned n = numTotalTests(); - unsigned numFactors = 0; - - for (unsigned factor = 2; (factor * factor) <= n; factor += (factor == 2) ? 1 : 2) { - unsigned power; - - for (power = 0; (n % factor) == 0; n /= factor) ++power; - - if (!power) continue; - - p = numberToString(factor, copyString(p, (numFactors == 0) ? " = " : " * ")); - if (power > 1) p = numberToString(power, copyString(p, "^")); - ++numFactors; - } - - if (n > 1) { - if (!numFactors) - copyString(p, tracker().failedTests() ? " :(" : tracker().warnings() ? " :|" : " :)"); - else - numberToString(n, copyString(p, " * ")); - } - return s; -} -#endif // _CXXTEST_FACTOR -} // namespace CxxTest - -#endif // __cxxtest__Descriptions_cpp__ diff --git a/test/cxxtest/Descriptions.h b/test/cxxtest/Descriptions.h deleted file mode 100644 index bd373ec7..00000000 --- a/test/cxxtest/Descriptions.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef __cxxtest__Descriptions_h__ -#define __cxxtest__Descriptions_h__ - -// -// TestDescription, SuiteDescription and WorldDescription -// hold information about tests so they can be run and reported. -// - -#include - -namespace CxxTest -{ - class TestSuite; - - class TestDescription : public Link - { - public: - virtual ~TestDescription(); - - virtual const char *file() const = 0; - virtual unsigned line() const = 0; - virtual const char *testName() const = 0; - virtual const char *suiteName() const = 0; - - virtual void run() = 0; - - virtual const TestDescription *next() const = 0; - virtual TestDescription *next() = 0; - }; - - class SuiteDescription : public Link - { - public: - virtual ~SuiteDescription(); - - virtual const char *file() const = 0; - virtual unsigned line() const = 0; - virtual const char *suiteName() const = 0; - virtual TestSuite *suite() const = 0; - - virtual unsigned numTests() const = 0; - virtual const TestDescription &testDescription( unsigned /*i*/ ) const = 0; - - virtual TestDescription *firstTest() = 0; - virtual const TestDescription *firstTest() const = 0; - virtual SuiteDescription *next() = 0; - virtual const SuiteDescription *next() const = 0; - - virtual void activateAllTests() = 0; - virtual bool leaveOnly( const char * /*testName*/ ) = 0; - }; - - class WorldDescription : public Link - { - public: - virtual ~WorldDescription(); - - virtual unsigned numSuites( void ) const = 0; - virtual unsigned numTotalTests( void ) const = 0; - virtual const SuiteDescription &suiteDescription( unsigned /*i*/ ) const = 0; - - enum { MAX_STRLEN_TOTAL_TESTS = 32 }; - char *strTotalTests( char * /*buffer*/ ) const; - - virtual SuiteDescription *firstSuite() = 0; - virtual const SuiteDescription *firstSuite() const = 0; - - virtual void activateAllTests() = 0; - virtual bool leaveOnly( const char * /*suiteName*/, const char * /*testName*/ = 0 ) = 0; - }; -} - -#endif // __cxxtest__Descriptions_h__ - diff --git a/test/cxxtest/DummyDescriptions.cpp b/test/cxxtest/DummyDescriptions.cpp deleted file mode 100644 index b91c9a14..00000000 --- a/test/cxxtest/DummyDescriptions.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include - -namespace CxxTest { -DummyTestDescription::DummyTestDescription() {} - -const char *DummyTestDescription::file() const { return ""; } -unsigned DummyTestDescription::line() const { return 0; } -const char *DummyTestDescription::testName() const { return ""; } -const char *DummyTestDescription::suiteName() const { return ""; } -bool DummyTestDescription::setUp() { return true; } -void DummyTestDescription::run() {} -bool DummyTestDescription::tearDown() { return true; } - -TestDescription *DummyTestDescription::next() { return 0; } -const TestDescription *DummyTestDescription::next() const { return 0; } - -DummySuiteDescription::DummySuiteDescription() : _test() {} - -const char *DummySuiteDescription::file() const { return ""; } -unsigned DummySuiteDescription::line() const { return 0; } -const char *DummySuiteDescription::suiteName() const { return ""; } -TestSuite *DummySuiteDescription::suite() const { return 0; } -unsigned DummySuiteDescription::numTests() const { return 0; } -const TestDescription &DummySuiteDescription::testDescription(unsigned) const { return _test; } -SuiteDescription *DummySuiteDescription::next() { return 0; } -TestDescription *DummySuiteDescription::firstTest() { return 0; } -const SuiteDescription *DummySuiteDescription::next() const { return 0; } -const TestDescription *DummySuiteDescription::firstTest() const { return 0; } -void DummySuiteDescription::activateAllTests() {} -bool DummySuiteDescription::leaveOnly(const char * /*testName*/) { return false; } - -bool DummySuiteDescription::setUp() { return true; } -bool DummySuiteDescription::tearDown() { return true; } - -DummyWorldDescription::DummyWorldDescription() : _suite() {} - -unsigned DummyWorldDescription::numSuites(void) const { return 0; } -unsigned DummyWorldDescription::numTotalTests(void) const { return 0; } -const SuiteDescription &DummyWorldDescription::suiteDescription(unsigned) const { return _suite; } -SuiteDescription *DummyWorldDescription::firstSuite() { return 0; } -const SuiteDescription *DummyWorldDescription::firstSuite() const { return 0; } -void DummyWorldDescription::activateAllTests() {} -bool DummyWorldDescription::leaveOnly(const char * /*suiteName*/, const char * /*testName*/) { return false; } - -bool DummyWorldDescription::setUp() { return true; } -bool DummyWorldDescription::tearDown() { return true; } -} // namespace CxxTest diff --git a/test/cxxtest/DummyDescriptions.h b/test/cxxtest/DummyDescriptions.h deleted file mode 100644 index c9215d12..00000000 --- a/test/cxxtest/DummyDescriptions.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef __cxxtest__DummyDescriptions_h__ -#define __cxxtest__DummyDescriptions_h__ - -// -// DummyTestDescription, DummySuiteDescription and DummyWorldDescription -// - -#include - -namespace CxxTest -{ - class DummyTestDescription : public TestDescription - { - public: - DummyTestDescription(); - - const char *file() const; - unsigned line() const; - const char *testName() const; - const char *suiteName() const; - bool setUp(); - void run(); - bool tearDown(); - - TestDescription *next(); - const TestDescription *next() const; - }; - - class DummySuiteDescription : public SuiteDescription - { - public: - DummySuiteDescription(); - - const char *file() const; - unsigned line() const; - const char *suiteName() const; - TestSuite *suite() const; - unsigned numTests() const; - const TestDescription &testDescription( unsigned ) const; - SuiteDescription *next(); - TestDescription *firstTest(); - const SuiteDescription *next() const; - const TestDescription *firstTest() const; - void activateAllTests(); - bool leaveOnly( const char * /*testName*/ ); - - bool setUp(); - bool tearDown(); - - private: - DummyTestDescription _test; - }; - - class DummyWorldDescription : public WorldDescription - { - public: - DummyWorldDescription(); - - unsigned numSuites( void ) const; - unsigned numTotalTests( void ) const; - const SuiteDescription &suiteDescription( unsigned ) const; - SuiteDescription *firstSuite(); - const SuiteDescription *firstSuite() const; - void activateAllTests(); - bool leaveOnly( const char * /*suiteName*/, const char * /*testName*/ = 0 ); - - bool setUp(); - bool tearDown(); - - private: - DummySuiteDescription _suite; - }; -} - -#endif // __cxxtest__DummyDescriptions_h__ - diff --git a/test/cxxtest/ErrorFormatter.h b/test/cxxtest/ErrorFormatter.h deleted file mode 100644 index dca09bc7..00000000 --- a/test/cxxtest/ErrorFormatter.h +++ /dev/null @@ -1,281 +0,0 @@ -#ifndef __cxxtest__ErrorFormatter_h__ -#define __cxxtest__ErrorFormatter_h__ - -// -// The ErrorFormatter is a TestListener that -// prints reports of the errors to an output -// stream. Since we cannot rely ou the standard -// iostreams, this header defines a base class -// analogout to std::ostream. -// - -#include -#include -#include -#include - -namespace CxxTest -{ - class OutputStream - { - public: - virtual ~OutputStream() {} - virtual void flush() {}; - virtual OutputStream &operator<<( unsigned /*number*/ ) { return *this; } - virtual OutputStream &operator<<( const char * /*string*/ ) { return *this; } - - typedef void (*Manipulator)( OutputStream & ); - - virtual OutputStream &operator<<( Manipulator m ) { m( *this ); return *this; } - static void endl( OutputStream &o ) { (o << "\n").flush(); } - }; - - class ErrorFormatter : public TestListener - { - public: - ErrorFormatter( OutputStream *o, const char *preLine = ":", const char *postLine = "" ) : - _dotting( true ), - _reported( false ), - _o(o), - _preLine(preLine), - _postLine(postLine) - { - } - - int run() - { - TestRunner::runAllTests( *this ); - return tracker().failedTests(); - } - - void enterWorld( const WorldDescription & /*desc*/ ) - { - (*_o) << "Running " << totalTests; - _o->flush(); - _dotting = true; - _reported = false; - } - - static void totalTests( OutputStream &o ) - { - char s[WorldDescription::MAX_STRLEN_TOTAL_TESTS]; - const WorldDescription &wd = tracker().world(); - o << wd.strTotalTests( s ) << (wd.numTotalTests() == 1 ? " test" : " tests"); - } - - void enterSuite( const SuiteDescription & ) - { - _reported = false; - } - - void enterTest( const TestDescription & ) - { - _reported = false; - } - - void leaveTest( const TestDescription & ) - { - if ( !tracker().testFailed() ) { - ((*_o) << ".").flush(); - _dotting = true; - } - } - - void leaveWorld( const WorldDescription &desc ) - { - if ( !tracker().failedTests() ) { - (*_o) << "OK!" << endl; - return; - } - newLine(); - (*_o) << "Failed " << tracker().failedTests() << " of " << totalTests << endl; - unsigned numPassed = desc.numTotalTests() - tracker().failedTests(); - (*_o) << "Success rate: " << (numPassed * 100 / desc.numTotalTests()) << "%" << endl; - } - - void trace( const char *file, unsigned line, const char *expression ) - { - stop( file, line ) << "Trace: " << - expression << endl; - } - - void warning( const char *file, unsigned line, const char *expression ) - { - stop( file, line ) << "Warning: " << - expression << endl; - } - - void failedTest( const char *file, unsigned line, const char *expression ) - { - stop( file, line ) << "Error: Test failed: " << - expression << endl; - } - - void failedAssert( const char *file, unsigned line, const char *expression ) - { - stop( file, line ) << "Error: Assertion failed: " << - expression << endl; - } - - void failedAssertEquals( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *x, const char *y ) - { - stop( file, line ) << "Error: Expected (" << - xStr << " == " << yStr << "), found (" << - x << " != " << y << ")" << endl; - } - - void failedAssertSameData( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *sizeStr, const void *x, - const void *y, unsigned size ) - { - stop( file, line ) << "Error: Expected " << sizeStr << " (" << size << ") bytes to be equal at (" << - xStr << ") and (" << yStr << "), found:" << endl; - dump( x, size ); - (*_o) << " differs from" << endl; - dump( y, size ); - } - - void failedAssertDelta( const char *file, unsigned line, - const char *xStr, const char *yStr, const char *dStr, - const char *x, const char *y, const char *d ) - { - stop( file, line ) << "Error: Expected (" << - xStr << " == " << yStr << ") up to " << dStr << " (" << d << "), found (" << - x << " != " << y << ")" << endl; - } - - void failedAssertDiffers( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *value ) - { - stop( file, line ) << "Error: Expected (" << - xStr << " != " << yStr << "), found (" << - value << ")" << endl; - } - - void failedAssertLessThan( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *x, const char *y ) - { - stop( file, line ) << "Error: Expected (" << - xStr << " < " << yStr << "), found (" << - x << " >= " << y << ")" << endl; - } - - void failedAssertLessThanEquals( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *x, const char *y ) - { - stop( file, line ) << "Error: Expected (" << - xStr << " <= " << yStr << "), found (" << - x << " > " << y << ")" << endl; - } - - void failedAssertRelation( const char *file, unsigned line, - const char *relation, const char *xStr, const char *yStr, - const char *x, const char *y ) - { - stop( file, line ) << "Error: Expected " << relation << "( " << - xStr << ", " << yStr << " ), found !" << relation << "( " << x << ", " << y << " )" << endl; - } - - void failedAssertPredicate( const char *file, unsigned line, - const char *predicate, const char *xStr, const char *x ) - { - stop( file, line ) << "Error: Expected " << predicate << "( " << - xStr << " ), found !" << predicate << "( " << x << " )" << endl; - } - - void failedAssertThrows( const char *file, unsigned line, - const char *expression, const char *type, - bool otherThrown ) - { - stop( file, line ) << "Error: Expected (" << expression << ") to throw (" << - type << ") but it " << (otherThrown ? "threw something else" : "didn't throw") << - endl; - } - - void failedAssertThrowsNot( const char *file, unsigned line, const char *expression ) - { - stop( file, line ) << "Error: Expected (" << expression << ") not to throw, but it did" << - endl; - } - - protected: - OutputStream *outputStream() const - { - return _o; - } - - private: - ErrorFormatter( const ErrorFormatter & ); - ErrorFormatter &operator=( const ErrorFormatter & ); - - OutputStream &stop( const char *file, unsigned line ) - { - newLine(); - reportTest(); - return (*_o) << file << _preLine << line << _postLine << ": "; - } - - void newLine( void ) - { - if ( _dotting ) { - (*_o) << endl; - _dotting = false; - } - } - - void reportTest( void ) - { - if( _reported ) - return; - (*_o) << "In " << tracker().suite().suiteName() << "::" << tracker().test().testName() << ":" << endl; - _reported = true; - } - - void dump( const void *buffer, unsigned size ) - { - if ( !buffer ) - dumpNull(); - else - dumpBuffer( buffer, size ); - } - - void dumpNull() - { - (*_o) << " (null)" << endl; - } - - void dumpBuffer( const void *buffer, unsigned size ) - { - unsigned dumpSize = size; - if ( maxDumpSize() && dumpSize > maxDumpSize() ) - dumpSize = maxDumpSize(); - - const unsigned char *p = (const unsigned char *)buffer; - (*_o) << " { "; - for ( unsigned i = 0; i < dumpSize; ++ i ) - (*_o) << byteToHex( *p++ ) << " "; - if ( dumpSize < size ) - (*_o) << "... "; - (*_o) << "}" << endl; - } - - static void endl( OutputStream &o ) - { - OutputStream::endl( o ); - } - - bool _dotting; - bool _reported; - OutputStream *_o; - const char *_preLine; - const char *_postLine; - }; -} - -#endif // __cxxtest__ErrorFormatter_h__ diff --git a/test/cxxtest/ErrorPrinter.h b/test/cxxtest/ErrorPrinter.h deleted file mode 100644 index 53d94253..00000000 --- a/test/cxxtest/ErrorPrinter.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef __cxxtest__ErrorPrinter_h__ -#define __cxxtest__ErrorPrinter_h__ - -// -// The ErrorPrinter is a simple TestListener that -// just prints "OK" if everything goes well, otherwise -// reports the error in the format of compiler messages. -// The ErrorPrinter uses std::cout -// - -#include - -#ifndef _CXXTEST_HAVE_STD -# define _CXXTEST_HAVE_STD -#endif // _CXXTEST_HAVE_STD - -#include -#include - -#ifdef _CXXTEST_OLD_STD -# include -#else // !_CXXTEST_OLD_STD -# include -#endif // _CXXTEST_OLD_STD - -namespace CxxTest -{ - class ErrorPrinter : public ErrorFormatter - { - public: - ErrorPrinter( CXXTEST_STD(ostream) &o = CXXTEST_STD(cout), const char *preLine = ":", const char *postLine = "" ) : - ErrorFormatter( new Adapter(o), preLine, postLine ) {} - virtual ~ErrorPrinter() { delete outputStream(); } - - private: - class Adapter : public OutputStream - { - CXXTEST_STD(ostream) &_o; - public: - Adapter( CXXTEST_STD(ostream) &o ) : _o(o) {} - void flush() { _o.flush(); } - OutputStream &operator<<( const char *s ) { _o << s; return *this; } - OutputStream &operator<<( Manipulator m ) { return OutputStream::operator<<( m ); } - OutputStream &operator<<( unsigned i ) - { - char s[1 + 3 * sizeof(unsigned)]; - numberToString( i, s ); - _o << s; - return *this; - } - }; - }; -} - -#endif // __cxxtest__ErrorPrinter_h__ diff --git a/test/cxxtest/Flags.h b/test/cxxtest/Flags.h deleted file mode 100644 index be2f9f28..00000000 --- a/test/cxxtest/Flags.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef __cxxtest__Flags_h__ -#define __cxxtest__Flags_h__ - -// -// These are the flags that control CxxTest -// - -#if !defined(CXXTEST_FLAGS) -# define CXXTEST_FLAGS -#endif // !CXXTEST_FLAGS - -#if defined(CXXTEST_HAVE_EH) && !defined(_CXXTEST_HAVE_EH) -# define _CXXTEST_HAVE_EH -#endif // CXXTEST_HAVE_EH - -#if defined(CXXTEST_HAVE_STD) && !defined(_CXXTEST_HAVE_STD) -# define _CXXTEST_HAVE_STD -#endif // CXXTEST_HAVE_STD - -#if defined(CXXTEST_OLD_TEMPLATE_SYNTAX) && !defined(_CXXTEST_OLD_TEMPLATE_SYNTAX) -# define _CXXTEST_OLD_TEMPLATE_SYNTAX -#endif // CXXTEST_OLD_TEMPLATE_SYNTAX - -#if defined(CXXTEST_OLD_STD) && !defined(_CXXTEST_OLD_STD) -# define _CXXTEST_OLD_STD -#endif // CXXTEST_OLD_STD - -#if defined(CXXTEST_ABORT_TEST_ON_FAIL) && !defined(_CXXTEST_ABORT_TEST_ON_FAIL) -# define _CXXTEST_ABORT_TEST_ON_FAIL -#endif // CXXTEST_ABORT_TEST_ON_FAIL - -#if defined(CXXTEST_NO_COPY_CONST) && !defined(_CXXTEST_NO_COPY_CONST) -# define _CXXTEST_NO_COPY_CONST -#endif // CXXTEST_NO_COPY_CONST - -#if defined(CXXTEST_FACTOR) && !defined(_CXXTEST_FACTOR) -# define _CXXTEST_FACTOR -#endif // CXXTEST_FACTOR - -#if defined(CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION) && !defined(_CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION) -# define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION -#endif // CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION - -#if defined(CXXTEST_LONGLONG) -# if defined(_CXXTEST_LONGLONG) -# undef _CXXTEST_LONGLONG -# endif -# define _CXXTEST_LONGLONG CXXTEST_LONGLONG -#endif // CXXTEST_LONGLONG - -#ifndef CXXTEST_MAX_DUMP_SIZE -# define CXXTEST_MAX_DUMP_SIZE 0 -#endif // CXXTEST_MAX_DUMP_SIZE - -#if defined(_CXXTEST_ABORT_TEST_ON_FAIL) && !defined(CXXTEST_DEFAULT_ABORT) -# define CXXTEST_DEFAULT_ABORT true -#endif // _CXXTEST_ABORT_TEST_ON_FAIL && !CXXTEST_DEFAULT_ABORT - -#if !defined(CXXTEST_DEFAULT_ABORT) -# define CXXTEST_DEFAULT_ABORT false -#endif // !CXXTEST_DEFAULT_ABORT - -#if defined(_CXXTEST_ABORT_TEST_ON_FAIL) && !defined(_CXXTEST_HAVE_EH) -# warning "CXXTEST_ABORT_TEST_ON_FAIL is meaningless without CXXTEST_HAVE_EH" -# undef _CXXTEST_ABORT_TEST_ON_FAIL -#endif // _CXXTEST_ABORT_TEST_ON_FAIL && !_CXXTEST_HAVE_EH - -// -// Some minimal per-compiler configuration to allow us to compile -// - -#ifdef __BORLANDC__ -# if __BORLANDC__ <= 0x520 // Borland C++ 5.2 or earlier -# ifndef _CXXTEST_OLD_STD -# define _CXXTEST_OLD_STD -# endif -# ifndef _CXXTEST_OLD_TEMPLATE_SYNTAX -# define _CXXTEST_OLD_TEMPLATE_SYNTAX -# endif -# endif -# if __BORLANDC__ >= 0x540 // C++ Builder 4.0 or later -# ifndef _CXXTEST_NO_COPY_CONST -# define _CXXTEST_NO_COPY_CONST -# endif -# ifndef _CXXTEST_LONGLONG -# define _CXXTEST_LONGLONG __int64 -# endif -# endif -#endif // __BORLANDC__ - -#ifdef _MSC_VER // Visual C++ -# ifndef _CXXTEST_LONGLONG -# define _CXXTEST_LONGLONG __int64 -# endif -# if (_MSC_VER >= 0x51E) -# ifndef _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION -# define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION -# endif -# endif -# pragma warning( disable : 4127 ) -# pragma warning( disable : 4290 ) -# pragma warning( disable : 4511 ) -# pragma warning( disable : 4512 ) -# pragma warning( disable : 4514 ) -#endif // _MSC_VER - -#ifdef __GNUC__ -# if (__GNUC__ > 2) || (__GNUC__ == 2 && __GNUC_MINOR__ >= 9) -# ifndef _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION -# define _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION -# endif -# endif -#endif // __GNUC__ - -#ifdef __DMC__ // Digital Mars -# ifndef _CXXTEST_OLD_STD -# define _CXXTEST_OLD_STD -# endif -#endif - -#endif // __cxxtest__Flags_h__ diff --git a/test/cxxtest/GlobalFixture.cpp b/test/cxxtest/GlobalFixture.cpp deleted file mode 100644 index 09ede93a..00000000 --- a/test/cxxtest/GlobalFixture.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __cxxtest__GlobalFixture_cpp__ -#define __cxxtest__GlobalFixture_cpp__ - -#include - -namespace CxxTest { -bool GlobalFixture::setUpWorld() { return true; } -bool GlobalFixture::tearDownWorld() { return true; } -bool GlobalFixture::setUp() { return true; } -bool GlobalFixture::tearDown() { return true; } - -GlobalFixture::GlobalFixture() { attach(_list); } -GlobalFixture::~GlobalFixture() { detach(_list); } - -GlobalFixture *GlobalFixture::firstGlobalFixture() { return (GlobalFixture *)_list.head(); } -GlobalFixture *GlobalFixture::lastGlobalFixture() { return (GlobalFixture *)_list.tail(); } -GlobalFixture *GlobalFixture::nextGlobalFixture() { return (GlobalFixture *)next(); } -GlobalFixture *GlobalFixture::prevGlobalFixture() { return (GlobalFixture *)prev(); } -} // namespace CxxTest - -#endif // __cxxtest__GlobalFixture_cpp__ diff --git a/test/cxxtest/GlobalFixture.h b/test/cxxtest/GlobalFixture.h deleted file mode 100644 index c8173633..00000000 --- a/test/cxxtest/GlobalFixture.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef __cxxtest__GlobalFixture_h__ -#define __cxxtest__GlobalFixture_h__ - -#include - -namespace CxxTest -{ - class GlobalFixture : public Link - { - public: - virtual bool setUpWorld(); - virtual bool tearDownWorld(); - virtual bool setUp(); - virtual bool tearDown(); - - GlobalFixture(); - ~GlobalFixture(); - - static GlobalFixture *firstGlobalFixture(); - static GlobalFixture *lastGlobalFixture(); - GlobalFixture *nextGlobalFixture(); - GlobalFixture *prevGlobalFixture(); - - private: - static List _list; - }; -} - -#endif // __cxxtest__GlobalFixture_h__ - diff --git a/test/cxxtest/Gui.h b/test/cxxtest/Gui.h deleted file mode 100644 index ac53b298..00000000 --- a/test/cxxtest/Gui.h +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef __CXXTEST__GUI_H -#define __CXXTEST__GUI_H - -// -// GuiListener is a simple base class for the differes GUIs -// GuiTuiRunner combines a GUI with a text-mode error formatter -// - -#include - -namespace CxxTest -{ - class GuiListener : public TestListener - { - public: - GuiListener() : _state( GREEN_BAR ) {} - virtual ~GuiListener() {} - - virtual void runGui( int &argc, char **argv, TestListener &listener ) - { - enterGui( argc, argv ); - TestRunner::runAllTests( listener ); - leaveGui(); - } - - virtual void enterGui( int & /*argc*/, char ** /*argv*/ ) {} - virtual void leaveGui() {} - - // - // The easy way is to implement these functions: - // - virtual void guiEnterWorld( unsigned /*numTotalTests*/ ) {} - virtual void guiEnterSuite( const char * /*suiteName*/ ) {} - virtual void guiEnterTest( const char * /*suiteName*/, const char * /*testName*/ ) {} - virtual void yellowBar() {} - virtual void redBar() {} - - // - // The hard way is this: - // - void enterWorld( const WorldDescription &d ) { guiEnterWorld( d.numTotalTests() ); } - void enterSuite( const SuiteDescription &d ) { guiEnterSuite( d.suiteName() ); } - void enterTest( const TestDescription &d ) { guiEnterTest( d.suiteName(), d.testName() ); } - void leaveTest( const TestDescription & ) {} - void leaveSuite( const SuiteDescription & ) {} - void leaveWorld( const WorldDescription & ) {} - - void warning( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) - { - yellowBarSafe(); - } - - void failedTest( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) - { - redBarSafe(); - } - - void failedAssert( const char * /*file*/, unsigned /*line*/, const char * /*expression*/ ) - { - redBarSafe(); - } - - void failedAssertEquals( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*x*/, const char * /*y*/ ) - { - redBarSafe(); - } - - void failedAssertSameData( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*sizeStr*/, const void * /*x*/, - const void * /*y*/, unsigned /*size*/ ) - { - redBarSafe(); - } - - void failedAssertDelta( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, const char * /*dStr*/, - const char * /*x*/, const char * /*y*/, const char * /*d*/ ) - { - redBarSafe(); - } - - void failedAssertDiffers( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*value*/ ) - { - redBarSafe(); - } - - void failedAssertLessThan( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*x*/, const char * /*y*/ ) - { - redBarSafe(); - } - - void failedAssertLessThanEquals( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*x*/, const char * /*y*/ ) - { - redBarSafe(); - } - - void failedAssertPredicate( const char * /*file*/, unsigned /*line*/, - const char * /*predicate*/, const char * /*xStr*/, const char * /*x*/ ) - { - redBarSafe(); - } - - void failedAssertRelation( const char * /*file*/, unsigned /*line*/, - const char * /*relation*/, const char * /*xStr*/, const char * /*yStr*/, - const char * /*x*/, const char * /*y*/ ) - { - redBarSafe(); - } - - void failedAssertThrows( const char * /*file*/, unsigned /*line*/, - const char * /*expression*/, const char * /*type*/, - bool /*otherThrown*/ ) - { - redBarSafe(); - } - - void failedAssertThrowsNot( const char * /*file*/, unsigned /*line*/, - const char * /*expression*/ ) - { - redBarSafe(); - } - - protected: - void yellowBarSafe() - { - if ( _state < YELLOW_BAR ) { - yellowBar(); - _state = YELLOW_BAR; - } - } - - void redBarSafe() - { - if ( _state < RED_BAR ) { - redBar(); - _state = RED_BAR; - } - } - - private: - enum { GREEN_BAR, YELLOW_BAR, RED_BAR } _state; - }; - - template - class GuiTuiRunner : public TeeListener - { - int &_argc; - char **_argv; - GuiT _gui; - TuiT _tui; - - public: - GuiTuiRunner( int &argc, char **argv ) : - _argc( argc ), - _argv( argv ) - { - setFirst( _gui ); - setSecond( _tui ); - } - - int run() - { - _gui.runGui( _argc, _argv, *this ); - return tracker().failedTests(); - } - }; -}; - -#endif //__CXXTEST__GUI_H diff --git a/test/cxxtest/LinkedList.cpp b/test/cxxtest/LinkedList.cpp deleted file mode 100644 index 087c30dd..00000000 --- a/test/cxxtest/LinkedList.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#ifndef __cxxtest__LinkedList_cpp__ -#define __cxxtest__LinkedList_cpp__ - -#include - -namespace CxxTest { -List GlobalFixture::_list = {0, 0}; -List RealSuiteDescription::_suites = {0, 0}; - -void List::initialize() { _head = _tail = 0; } - -Link *List::head() { - Link *l = _head; - while (l && !l->active()) l = l->next(); - return l; -} - -const Link *List::head() const { - Link *l = _head; - while (l && !l->active()) l = l->next(); - return l; -} - -Link *List::tail() { - Link *l = _tail; - while (l && !l->active()) l = l->prev(); - return l; -} - -const Link *List::tail() const { - Link *l = _tail; - while (l && !l->active()) l = l->prev(); - return l; -} - -bool List::empty() const { return (_head == 0); } - -unsigned List::size() const { - unsigned count = 0; - for (const Link *l = head(); l != 0; l = l->next()) ++count; - return count; -} - -Link *List::nth(unsigned n) { - Link *l = head(); - while (n--) l = l->next(); - return l; -} - -void List::activateAll() { - for (Link *l = _head; l != 0; l = l->justNext()) l->setActive(true); -} - -void List::leaveOnly(const Link &link) { - for (Link *l = head(); l != 0; l = l->next()) - if (l != &link) l->setActive(false); -} - -Link::Link() : _next(0), _prev(0), _active(true) {} - -Link::~Link() {} - -bool Link::active() const { return _active; } - -void Link::setActive(bool value) { _active = value; } - -Link *Link::justNext() { return _next; } - -Link *Link::justPrev() { return _prev; } - -Link *Link::next() { - Link *l = _next; - while (l && !l->_active) l = l->_next; - return l; -} - -Link *Link::prev() { - Link *l = _prev; - while (l && !l->_active) l = l->_prev; - return l; -} - -const Link *Link::next() const { - Link *l = _next; - while (l && !l->_active) l = l->_next; - return l; -} - -const Link *Link::prev() const { - Link *l = _prev; - while (l && !l->_active) l = l->_prev; - return l; -} - -void Link::attach(List &l) { - if (l._tail) l._tail->_next = this; - - _prev = l._tail; - _next = 0; - - if (l._head == 0) l._head = this; - l._tail = this; -} - -void Link::detach(List &l) { - if (_prev) - _prev->_next = _next; - else - l._head = _next; - - if (_next) - _next->_prev = _prev; - else - l._tail = _prev; -} -} // namespace CxxTest - -#endif // __cxxtest__LinkedList_cpp__ diff --git a/test/cxxtest/LinkedList.h b/test/cxxtest/LinkedList.h deleted file mode 100644 index 983a6e24..00000000 --- a/test/cxxtest/LinkedList.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef __cxxtest__LinkedList_h__ -#define __cxxtest__LinkedList_h__ - -#include - -namespace CxxTest -{ - struct List; - class Link; - - struct List - { - Link *_head; - Link *_tail; - - void initialize(); - - Link *head(); - const Link *head() const; - Link *tail(); - const Link *tail() const; - - bool empty() const; - unsigned size() const; - Link *nth( unsigned n ); - - void activateAll(); - void leaveOnly( const Link &link ); - }; - - class Link - { - public: - Link(); - virtual ~Link(); - - bool active() const; - void setActive( bool value = true ); - - Link *justNext(); - Link *justPrev(); - - Link *next(); - Link *prev(); - const Link *next() const; - const Link *prev() const; - - virtual bool setUp() = 0; - virtual bool tearDown() = 0; - - void attach( List &l ); - void detach( List &l ); - - private: - Link *_next; - Link *_prev; - bool _active; - - Link( const Link & ); - Link &operator=( const Link & ); - }; -} - -#endif // __cxxtest__LinkedList_h__ - diff --git a/test/cxxtest/Mock.h b/test/cxxtest/Mock.h deleted file mode 100644 index 647088e8..00000000 --- a/test/cxxtest/Mock.h +++ /dev/null @@ -1,350 +0,0 @@ -#ifndef __cxxtest__Mock_h__ -#define __cxxtest__Mock_h__ - -// -// The default namespace is T:: -// -#ifndef CXXTEST_MOCK_NAMESPACE -# define CXXTEST_MOCK_NAMESPACE T -#endif // CXXTEST_MOCK_NAMESPACE - -// -// MockTraits: What to return when no mock object has been created -// -#define __CXXTEST_MOCK__TRAITS \ - namespace CXXTEST_MOCK_NAMESPACE \ - { \ - template \ - class MockTraits \ - { \ - public: \ - static T defaultValue() { return 0; } \ - }; \ - }; - -// -// extern "C" when needed -// -#ifdef __cplusplus -# define CXXTEST_EXTERN_C extern "C" -#else -# define CXXTEST_EXTERN_C -#endif // __cplusplus - -// -// Prototypes: For "normal" headers -// -#define __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - namespace CXXTEST_MOCK_NAMESPACE { TYPE NAME ARGS; } - -#define __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__PROTOTYPE( MOCK, void, NAME, ARGS, REAL, CALL ) - -#define __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - TYPE REAL ARGS; - -#define __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY__PROTOTYPE( MOCK, void, NAME, ARGS, REAL, CALL ) - -// -// Class declarations: For test files -// -#define __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - namespace CXXTEST_MOCK_NAMESPACE { \ - class Base_##MOCK : public CxxTest::Link \ - { \ - public: \ - Base_##MOCK(); \ - ~Base_##MOCK(); \ - bool setUp(); \ - bool tearDown(); \ - \ - static Base_##MOCK ¤t(); \ - \ - virtual TYPE NAME ARGS = 0; \ - \ - private: \ - static CxxTest::List _list; \ - }; \ - \ - class Real_##MOCK : public Base_##MOCK \ - { \ - public: \ - TYPE NAME ARGS; \ - }; \ - \ - class _Unimplemented_##MOCK : public Base_##MOCK \ - { \ - public: \ - TYPE NAME ARGS; \ - }; \ - } - -#define __CXXTEST_MOCK_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, void, NAME, ARGS, REAL, CALL ) - -#define __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - namespace CXXTEST_MOCK_NAMESPACE { \ - class Base_##MOCK : public CxxTest::Link \ - { \ - public: \ - Base_##MOCK(); \ - ~Base_##MOCK(); \ - bool setUp(); \ - bool tearDown(); \ - \ - static Base_##MOCK ¤t(); \ - \ - virtual TYPE NAME ARGS = 0; \ - \ - private: \ - static CxxTest::List _list; \ - }; \ - \ - class _Unimplemented_##MOCK : public Base_##MOCK \ - { \ - public: \ - TYPE NAME ARGS; \ - }; \ - } - -#define __CXXTEST_SUPPLY_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, void, NAME, ARGS, REAL, CALL ) - -// -// Class implementation: For test source files -// -#define __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \ - namespace CXXTEST_MOCK_NAMESPACE { \ - \ - CxxTest::List Base_##MOCK::_list = { 0, 0 }; \ - \ - Base_##MOCK::Base_##MOCK() { attach( _list ); } \ - Base_##MOCK::~Base_##MOCK() { detach( _list ); } \ - bool Base_##MOCK::setUp() { return true; } \ - bool Base_##MOCK::tearDown() { return true; } \ - \ - Base_##MOCK &Base_##MOCK::current() \ - { \ - if ( _list.empty() ) \ - static _Unimplemented_##MOCK unimplemented; \ - return *(Base_##MOCK *)_list.tail(); \ - } \ - } - -#define __CXXTEST_MOCK__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \ - namespace CXXTEST_MOCK_NAMESPACE { \ - TYPE Real_##MOCK::NAME ARGS \ - { \ - return REAL CALL; \ - } \ - \ - TYPE _Unimplemented_##MOCK::NAME ARGS \ - { \ - while ( false ) \ - return NAME CALL; \ - __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \ - return MockTraits::defaultValue(); \ - } \ - \ - TYPE NAME ARGS \ - { \ - return Base_##MOCK::current().NAME CALL; \ - } \ - } - -#define __CXXTEST_MOCK_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \ - namespace CXXTEST_MOCK_NAMESPACE { \ - void Real_##MOCK::NAME ARGS \ - { \ - REAL CALL; \ - } \ - \ - void _Unimplemented_##MOCK::NAME ARGS \ - { \ - while ( false ) \ - NAME CALL; \ - __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \ - } \ - \ - void NAME ARGS \ - { \ - Base_##MOCK::current().NAME CALL; \ - } \ - } - -#define __CXXTEST_SUPPLY__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \ - namespace CXXTEST_MOCK_NAMESPACE { \ - TYPE _Unimplemented_##MOCK::NAME ARGS \ - { \ - while ( false ) \ - return NAME CALL; \ - __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \ - return MockTraits::defaultValue(); \ - } \ - } \ - \ - TYPE REAL ARGS \ - { \ - return CXXTEST_MOCK_NAMESPACE::Base_##MOCK::current().NAME CALL; \ - } - -#define __CXXTEST_SUPPLY_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__COMMON_CLASS_IMPLEMENTATION( MOCK, NAME ) \ - namespace CXXTEST_MOCK_NAMESPACE { \ - void _Unimplemented_##MOCK::NAME ARGS \ - { \ - while ( false ) \ - NAME CALL; \ - __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ); \ - } \ - } \ - \ - void REAL ARGS \ - { \ - CXXTEST_MOCK_NAMESPACE::Base_##MOCK::current().NAME CALL; \ - } \ - -// -// Error for calling mock function w/o object -// -#define __CXXTEST_MOCK_UNIMPLEMENTED( NAME, ARGS ) \ - TS_FAIL( CXXTEST_MOCK_NAMESPACE_STR #NAME #ARGS " called with no " \ - CXXTEST_MOCK_NAMESPACE_STR "Base_" #NAME " object" ); \ - -#define CXXTEST_MOCK_NAMESPACE_STR __CXXTEST_STR(CXXTEST_MOCK_NAMESPACE) "::" -#define __CXXTEST_STR(X) __CXXTEST_XSTR(X) -#define __CXXTEST_XSTR(X) #X - -#if defined(CXXTEST_MOCK_TEST_SOURCE_FILE) -// -// Test source file: Prototypes, class declarations and implementation -// -#include - -__CXXTEST_MOCK__TRAITS; - -#define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) - -#define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) - -#define CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY__CLASS_IMPLEMENTATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) - -#define CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY_VOID__CLASS_IMPLEMENTATION( MOCK, NAME, ARGS, REAL, CALL ) - -#elif defined(CXXTEST_FLAGS) || defined(CXXTEST_RUNNING) -// -// Test file other than source: Prototypes and class declarations -// -#include - -__CXXTEST_MOCK__TRAITS; - -#define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) - -#define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) - -#define CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY__CLASS_DECLARATION( MOCK, TYPE, NAME, ARGS, REAL, CALL ) - -#define CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY_VOID__CLASS_DECLARATION( MOCK, NAME, ARGS, REAL, CALL ) - -#elif defined(CXXTEST_MOCK_REAL_SOURCE_FILE) -// -// Real source file: "Real" implementations -// -#define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - namespace CXXTEST_MOCK_NAMESPACE { TYPE NAME ARGS { return REAL CALL; } } - -#define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ - namespace CXXTEST_MOCK_NAMESPACE { void NAME ARGS { REAL CALL; } } - -#else -// -// Ordinary header file: Just prototypes -// - -#define CXXTEST_MOCK( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) - -#define CXXTEST_MOCK_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_MOCK_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) - -#define CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) - -#define CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) \ - __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) - -#endif // Ordinary header file - -// -// How to supply extern "C" functions -// -#define CXXTEST_SUPPLY_C( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - CXXTEST_EXTERN_C __CXXTEST_SUPPLY__PROTOTYPE( MOCK, TYPE, NAME, ARGS, REAL, CALL ) \ - CXXTEST_SUPPLY( MOCK, TYPE, NAME, ARGS, REAL, CALL ) - -#define CXXTEST_SUPPLY_VOID_C( MOCK, NAME, ARGS, REAL, CALL ) \ - CXXTEST_EXTERN_C __CXXTEST_SUPPLY_VOID__PROTOTYPE( MOCK, NAME, ARGS, REAL, CALL ) \ - CXXTEST_SUPPLY_VOID( MOCK, NAME, ARGS, REAL, CALL ) - -// -// Usually we mean the global namespace -// -#define CXXTEST_MOCK_GLOBAL( TYPE, NAME, ARGS, CALL ) \ - CXXTEST_MOCK( NAME, TYPE, NAME, ARGS, ::NAME, CALL ) - -#define CXXTEST_MOCK_VOID_GLOBAL( NAME, ARGS, CALL ) \ - CXXTEST_MOCK_VOID( NAME, NAME, ARGS, ::NAME, CALL ) - -#define CXXTEST_SUPPLY_GLOBAL( TYPE, NAME, ARGS, CALL ) \ - CXXTEST_SUPPLY( NAME, TYPE, NAME, ARGS, NAME, CALL ) - -#define CXXTEST_SUPPLY_VOID_GLOBAL( NAME, ARGS, CALL ) \ - CXXTEST_SUPPLY_VOID( NAME, NAME, ARGS, NAME, CALL ) - -#define CXXTEST_SUPPLY_GLOBAL_C( TYPE, NAME, ARGS, CALL ) \ - CXXTEST_SUPPLY_C( NAME, TYPE, NAME, ARGS, NAME, CALL ) - -#define CXXTEST_SUPPLY_VOID_GLOBAL_C( NAME, ARGS, CALL ) \ - CXXTEST_SUPPLY_VOID_C( NAME, NAME, ARGS, NAME, CALL ) - -// -// What to return when no mock object has been created. -// The default value of 0 usually works, but some cases may need this. -// -#define CXXTEST_MOCK_DEFAULT_VALUE( TYPE, VALUE ) \ - namespace CXXTEST_MOCK_NAMESPACE \ - { \ - template<> \ - class MockTraits \ - { \ - public: \ - static TYPE defaultValue() { return VALUE; } \ - }; \ - } - -#endif // __cxxtest__Mock_h__ diff --git a/test/cxxtest/ParenPrinter.h b/test/cxxtest/ParenPrinter.h deleted file mode 100644 index 9ecf3105..00000000 --- a/test/cxxtest/ParenPrinter.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __cxxtest__ParenPrinter_h__ -#define __cxxtest__ParenPrinter_h__ - -// -// The ParenPrinter is identical to the ErrorPrinter, except it -// prints the line number in a format expected by some compilers -// (notably, MSVC). -// - -#include - -namespace CxxTest -{ - class ParenPrinter : public ErrorPrinter - { - public: - ParenPrinter( CXXTEST_STD(ostream) &o = CXXTEST_STD(cout) ) : ErrorPrinter( o, "(", ")" ) {} - }; -} - -#endif // __cxxtest__ParenPrinter_h__ diff --git a/test/cxxtest/QtGui.h b/test/cxxtest/QtGui.h deleted file mode 100644 index 88982510..00000000 --- a/test/cxxtest/QtGui.h +++ /dev/null @@ -1,271 +0,0 @@ -#ifndef __cxxtest__QtGui_h__ -#define __cxxtest__QtGui_h__ - -// -// The QtGui displays a simple progress bar using the Qt Toolkit. It -// has been tested with versions 2.x and 3.x. -// -// Apart from normal Qt command-line arguments, it accepts the following options: -// -minimized Start minimized, pop up on error -// -keep Don't close the window at the end -// -title TITLE Set the window caption -// -// If both are -minimized and -keep specified, GUI will only keep the -// window if it's in focus. -// - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace CxxTest -{ - class QtGui : public GuiListener - { - public: - void enterGui( int &argc, char **argv ) - { - parseCommandLine( argc, argv ); - createApplication( argc, argv ); - } - - void enterWorld( const WorldDescription &wd ) - { - createWindow( wd ); - processEvents(); - } - - void guiEnterSuite( const char *suiteName ) - { - showSuiteName( suiteName ); - } - - void guiEnterTest( const char *suiteName, const char *testName ) - { - setCaption( suiteName, testName ); - advanceProgressBar(); - showTestName( testName ); - showTestsDone( _progressBar->progress() ); - processEvents(); - } - - void yellowBar() - { - setColor( 255, 255, 0 ); - setIcon( QMessageBox::Warning ); - getTotalTests(); - processEvents(); - } - - void redBar() - { - if ( _startMinimized && _mainWindow->isMinimized() ) - showNormal(); - setColor( 255, 0, 0 ); - setIcon( QMessageBox::Critical ); - getTotalTests(); - processEvents(); - } - - void leaveGui() - { - if ( keep() ) { - showSummary(); - _application->exec(); - } - else - _mainWindow->close( true ); - } - - private: - QString _title; - bool _startMinimized, _keep; - unsigned _numTotalTests; - QString _strTotalTests; - QApplication *_application; - QWidget *_mainWindow; - QVBoxLayout *_layout; - QProgressBar *_progressBar; - QStatusBar *_statusBar; - QLabel *_suiteName, *_testName, *_testsDone; - - void parseCommandLine( int argc, char **argv ) - { - _startMinimized = _keep = false; - _title = argv[0]; - - for ( int i = 1; i < argc; ++ i ) { - QString arg( argv[i] ); - if ( arg == "-minimized" ) - _startMinimized = true; - else if ( arg == "-keep" ) - _keep = true; - else if ( arg == "-title" && (i + 1 < argc) ) - _title = argv[++i]; - } - } - - void createApplication( int &argc, char **argv ) - { - _application = new QApplication( argc, argv ); - } - - void createWindow( const WorldDescription &wd ) - { - getTotalTests( wd ); - createMainWindow(); - createProgressBar(); - createStatusBar(); - setMainWidget(); - if ( _startMinimized ) - showMinimized(); - else - showNormal(); - } - - void getTotalTests() - { - getTotalTests( tracker().world() ); - } - - void getTotalTests( const WorldDescription &wd ) - { - _numTotalTests = wd.numTotalTests(); - char s[WorldDescription::MAX_STRLEN_TOTAL_TESTS]; - _strTotalTests = wd.strTotalTests( s ); - } - - void createMainWindow() - { - _mainWindow = new QWidget(); - _layout = new QVBoxLayout( _mainWindow ); - } - - void createProgressBar() - { - _layout->addWidget( _progressBar = new QProgressBar( _numTotalTests, _mainWindow ) ); - _progressBar->setProgress( 0 ); - setColor( 0, 255, 0 ); - setIcon( QMessageBox::Information ); - } - - void createStatusBar() - { - _layout->addWidget( _statusBar = new QStatusBar( _mainWindow ) ); - _statusBar->addWidget( _suiteName = new QLabel( _statusBar ), 2 ); - _statusBar->addWidget( _testName = new QLabel( _statusBar ), 4 ); - _statusBar->addWidget( _testsDone = new QLabel( _statusBar ), 1 ); - } - - void setMainWidget() - { - _application->setMainWidget( _mainWindow ); - } - - void showMinimized() - { - _mainWindow->showMinimized(); - } - - void showNormal() - { - _mainWindow->showNormal(); - centerWindow(); - } - - void setCaption( const QString &suiteName, const QString &testName ) - { - _mainWindow->setCaption( _title + " - " + suiteName + "::" + testName + "()" ); - } - - void showSuiteName( const QString &suiteName ) - { - _suiteName->setText( "class " + suiteName ); - } - - void advanceProgressBar() - { - _progressBar->setProgress( _progressBar->progress() + 1 ); - } - - void showTestName( const QString &testName ) - { - _testName->setText( testName + "()" ); - } - - void showTestsDone( unsigned testsDone ) - { - _testsDone->setText( asString( testsDone ) + " of " + _strTotalTests ); - } - - static QString asString( unsigned n ) - { - return QString::number( n ); - } - - void setColor( int r, int g, int b ) - { - QPalette palette = _progressBar->palette(); - palette.setColor( QColorGroup::Highlight, QColor( r, g, b ) ); - _progressBar->setPalette( palette ); - } - - void setIcon( QMessageBox::Icon icon ) - { -#if QT_VERSION >= 0x030000 - _mainWindow->setIcon( QMessageBox::standardIcon( icon ) ); -#else // Qt version < 3.0.0 - _mainWindow->setIcon( QMessageBox::standardIcon( icon, QApplication::style().guiStyle() ) ); -#endif // QT_VERSION - } - - void processEvents() - { - _application->processEvents(); - } - - void centerWindow() - { - QWidget *desktop = QApplication::desktop(); - int xCenter = desktop->x() + (desktop->width() / 2); - int yCenter = desktop->y() + (desktop->height() / 2); - - int windowWidth = (desktop->width() * 4) / 5; - int windowHeight = _mainWindow->height(); - _mainWindow->setGeometry( xCenter - (windowWidth / 2), yCenter - (windowHeight / 2), windowWidth, windowHeight ); - } - - bool keep() - { - if ( !_keep ) - return false; - if ( !_startMinimized ) - return true; - return (_mainWindow == _application->activeWindow()); - } - - void showSummary() - { - QString summary = _strTotalTests + (_numTotalTests == 1 ? " test" : " tests"); - if ( tracker().failedTests() ) - summary = "Failed " + asString( tracker().failedTests() ) + " of " + summary; - else - summary = summary + " passed"; - - _mainWindow->setCaption( _title + " - " + summary ); - - _statusBar->removeWidget( _suiteName ); - _statusBar->removeWidget( _testName ); - _testsDone->setText( summary ); - } - }; -}; - -#endif // __cxxtest__QtGui_h__ diff --git a/test/cxxtest/RealDescriptions.cpp b/test/cxxtest/RealDescriptions.cpp deleted file mode 100644 index 591da5e7..00000000 --- a/test/cxxtest/RealDescriptions.cpp +++ /dev/null @@ -1,240 +0,0 @@ -#ifndef __cxxtest__RealDescriptions_cpp__ -#define __cxxtest__RealDescriptions_cpp__ - -// -// NOTE: If an error occur during world construction/deletion, CxxTest cannot -// know where the error originated. -// - -#include - -namespace CxxTest { -RealTestDescription::RealTestDescription() {} - -RealTestDescription::RealTestDescription(List &argList, SuiteDescription &argSuite, unsigned argLine, - const char *argTestName) { - initialize(argList, argSuite, argLine, argTestName); -} - -void RealTestDescription::initialize(List &argList, SuiteDescription &argSuite, unsigned argLine, - const char *argTestName) { - _suite = &argSuite; - _line = argLine; - _testName = argTestName; - attach(argList); -} - -bool RealTestDescription::setUp() { - if (!suite()) return false; - - for (GlobalFixture *gf = GlobalFixture::firstGlobalFixture(); gf != 0; gf = gf->nextGlobalFixture()) { - bool ok; - _TS_TRY { ok = gf->setUp(); } - _TS_LAST_CATCH({ ok = false; }); - - if (!ok) { - doFailTest(file(), line(), "Error in GlobalFixture::setUp()"); - return false; - } - } - - _TS_TRY { _TSM_ASSERT_THROWS_NOTHING(file(), line(), "Exception thrown from setUp()", suite()->setUp()); } - _TS_CATCH_ABORT({ return false; }); - - return true; -} - -bool RealTestDescription::tearDown() { - if (!suite()) return false; - - _TS_TRY { _TSM_ASSERT_THROWS_NOTHING(file(), line(), "Exception thrown from tearDown()", suite()->tearDown()); } - _TS_CATCH_ABORT({ return false; }); - - for (GlobalFixture *gf = GlobalFixture::lastGlobalFixture(); gf != 0; gf = gf->prevGlobalFixture()) { - bool ok; - _TS_TRY { ok = gf->tearDown(); } - _TS_LAST_CATCH({ ok = false; }); - - if (!ok) { - doFailTest(file(), line(), "Error in GlobalFixture::tearDown()"); - return false; - } - } - - return true; -} - -const char *RealTestDescription::file() const { return _suite->file(); } -unsigned RealTestDescription::line() const { return _line; } -const char *RealTestDescription::testName() const { return _testName; } -const char *RealTestDescription::suiteName() const { return _suite->suiteName(); } - -TestDescription *RealTestDescription::next() { return (RealTestDescription *)Link::next(); } -const TestDescription *RealTestDescription::next() const { return (const RealTestDescription *)Link::next(); } - -TestSuite *RealTestDescription::suite() const { return _suite->suite(); } - -void RealTestDescription::run() { - _TS_TRY { runTest(); } - _TS_CATCH_ABORT({}) - ___TSM_CATCH(file(), line(), "Exception thrown from test"); -} - -RealSuiteDescription::RealSuiteDescription() {} -RealSuiteDescription::RealSuiteDescription(const char *argFile, unsigned argLine, const char *argSuiteName, - List &argTests) { - initialize(argFile, argLine, argSuiteName, argTests); -} - -void RealSuiteDescription::initialize(const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests) { - _file = argFile; - _line = argLine; - _suiteName = argSuiteName; - _tests = &argTests; - - attach(_suites); -} - -const char *RealSuiteDescription::file() const { return _file; } -unsigned RealSuiteDescription::line() const { return _line; } -const char *RealSuiteDescription::suiteName() const { return _suiteName; } - -TestDescription *RealSuiteDescription::firstTest() { return (RealTestDescription *)_tests->head(); } -const TestDescription *RealSuiteDescription::firstTest() const { return (const RealTestDescription *)_tests->head(); } -SuiteDescription *RealSuiteDescription::next() { return (RealSuiteDescription *)Link::next(); } -const SuiteDescription *RealSuiteDescription::next() const { return (const RealSuiteDescription *)Link::next(); } - -unsigned RealSuiteDescription::numTests() const { return _tests->size(); } - -const TestDescription &RealSuiteDescription::testDescription(unsigned i) const { - return *(RealTestDescription *)_tests->nth(i); -} - -void RealSuiteDescription::activateAllTests() { _tests->activateAll(); } - -bool RealSuiteDescription::leaveOnly(const char *testName) { - for (TestDescription *td = firstTest(); td != 0; td = td->next()) { - if (stringsEqual(td->testName(), testName)) { - _tests->leaveOnly(*td); - return true; - } - } - return false; -} - -StaticSuiteDescription::StaticSuiteDescription() {} -StaticSuiteDescription::StaticSuiteDescription(const char *argFile, unsigned argLine, const char *argSuiteName, - TestSuite &argSuite, List &argTests) - : RealSuiteDescription(argFile, argLine, argSuiteName, argTests) { - doInitialize(argSuite); -} - -void StaticSuiteDescription::initialize(const char *argFile, unsigned argLine, const char *argSuiteName, - TestSuite &argSuite, List &argTests) { - RealSuiteDescription::initialize(argFile, argLine, argSuiteName, argTests); - doInitialize(argSuite); -} - -void StaticSuiteDescription::doInitialize(TestSuite &argSuite) { _suite = &argSuite; } - -TestSuite *StaticSuiteDescription::suite() const { return _suite; } - -bool StaticSuiteDescription::setUp() { return true; } -bool StaticSuiteDescription::tearDown() { return true; } - -CommonDynamicSuiteDescription::CommonDynamicSuiteDescription() {} -CommonDynamicSuiteDescription::CommonDynamicSuiteDescription(const char *argFile, unsigned argLine, - const char *argSuiteName, List &argTests, - unsigned argCreateLine, unsigned argDestroyLine) - : RealSuiteDescription(argFile, argLine, argSuiteName, argTests) { - doInitialize(argCreateLine, argDestroyLine); -} - -void CommonDynamicSuiteDescription::initialize(const char *argFile, unsigned argLine, const char *argSuiteName, - List &argTests, unsigned argCreateLine, unsigned argDestroyLine) { - RealSuiteDescription::initialize(argFile, argLine, argSuiteName, argTests); - doInitialize(argCreateLine, argDestroyLine); -} - -void CommonDynamicSuiteDescription::doInitialize(unsigned argCreateLine, unsigned argDestroyLine) { - _createLine = argCreateLine; - _destroyLine = argDestroyLine; -} - -List &RealWorldDescription::suites() { return RealSuiteDescription::_suites; } - -unsigned RealWorldDescription::numSuites(void) const { return suites().size(); } - -unsigned RealWorldDescription::numTotalTests(void) const { - unsigned count = 0; - for (const SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next()) count += sd->numTests(); - return count; -} - -SuiteDescription *RealWorldDescription::firstSuite() { return (RealSuiteDescription *)suites().head(); } - -const SuiteDescription *RealWorldDescription::firstSuite() const { - return (const RealSuiteDescription *)suites().head(); -} - -const SuiteDescription &RealWorldDescription::suiteDescription(unsigned i) const { - return *(const RealSuiteDescription *)suites().nth(i); -} - -void RealWorldDescription::activateAllTests() { - suites().activateAll(); - for (SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next()) sd->activateAllTests(); -} - -bool RealWorldDescription::leaveOnly(const char *suiteName, const char *testName) { - for (SuiteDescription *sd = firstSuite(); sd != 0; sd = sd->next()) { - if (stringsEqual(sd->suiteName(), suiteName)) { - if (testName) - if (!sd->leaveOnly(testName)) return false; - suites().leaveOnly(*sd); - return true; - } - } - return false; -} - -bool RealWorldDescription::setUp() { - for (GlobalFixture *gf = GlobalFixture::firstGlobalFixture(); gf != 0; gf = gf->nextGlobalFixture()) { - bool ok; - _TS_TRY { ok = gf->setUpWorld(); } - _TS_LAST_CATCH({ ok = false; }); - - if (!ok) { - reportError("Error setting up world"); - return false; - } - } - - return true; -} - -bool RealWorldDescription::tearDown() { - for (GlobalFixture *gf = GlobalFixture::lastGlobalFixture(); gf != 0; gf = gf->prevGlobalFixture()) { - bool ok; - _TS_TRY { ok = gf->tearDownWorld(); } - _TS_LAST_CATCH({ ok = false; }); - - if (!ok) { - reportError("Error tearing down world"); - return false; - } - } - - return true; -} - -void RealWorldDescription::reportError(const char *message) { doWarn(__FILE__, 5, message); } - -void activateAllTests() { RealWorldDescription().activateAllTests(); } - -bool leaveOnly(const char *suiteName, const char *testName) { - return RealWorldDescription().leaveOnly(suiteName, testName); -} -} // namespace CxxTest - -#endif // __cxxtest__RealDescriptions_cpp__ diff --git a/test/cxxtest/RealDescriptions.h b/test/cxxtest/RealDescriptions.h deleted file mode 100644 index 14c457de..00000000 --- a/test/cxxtest/RealDescriptions.h +++ /dev/null @@ -1,223 +0,0 @@ -#ifndef __cxxtest__RealDescriptions_h__ -#define __cxxtest__RealDescriptions_h__ - -// -// The "real" description classes -// - -#include -#include -#include - -namespace CxxTest -{ - class RealTestDescription : public TestDescription - { - public: - RealTestDescription(); - RealTestDescription( List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName ); - void initialize( List &argList, SuiteDescription &argSuite, unsigned argLine, const char *argTestName ); - - const char *file() const; - unsigned line() const; - const char *testName() const; - const char *suiteName() const; - - TestDescription *next(); - const TestDescription *next() const; - - TestSuite *suite() const; - - bool setUp(); - void run(); - bool tearDown(); - - private: - RealTestDescription( const RealTestDescription & ); - RealTestDescription &operator=( const RealTestDescription & ); - - virtual void runTest() = 0; - - SuiteDescription *_suite; - unsigned _line; - const char *_testName; - }; - - class RealSuiteDescription : public SuiteDescription - { - public: - RealSuiteDescription(); - RealSuiteDescription( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests ); - - void initialize( const char *argFile, unsigned argLine, const char *argSuiteName, List &argTests ); - - const char *file() const; - unsigned line() const; - const char *suiteName() const; - - TestDescription *firstTest(); - const TestDescription *firstTest() const; - SuiteDescription *next(); - const SuiteDescription *next() const; - - unsigned numTests() const; - const TestDescription &testDescription( unsigned i ) const; - - void activateAllTests(); - bool leaveOnly( const char *testName ); - - private: - RealSuiteDescription( const RealSuiteDescription & ); - RealSuiteDescription &operator=( const RealSuiteDescription & ); - - const char *_file; - unsigned _line; - const char *_suiteName; - List *_tests; - - static List _suites; - friend class RealWorldDescription; - }; - - class StaticSuiteDescription : public RealSuiteDescription - { - public: - StaticSuiteDescription(); - StaticSuiteDescription( const char *argFile, unsigned argLine, - const char *argSuiteName, TestSuite &argSuite, - List &argTests ); - - void initialize( const char *argFile, unsigned argLine, - const char *argSuiteName, TestSuite &argSuite, - List &argTests ); - TestSuite *suite() const; - - bool setUp(); - bool tearDown(); - - private: - StaticSuiteDescription( const StaticSuiteDescription & ); - StaticSuiteDescription &operator=( const StaticSuiteDescription & ); - - void doInitialize( TestSuite &argSuite ); - - TestSuite *_suite; - }; - - class CommonDynamicSuiteDescription : public RealSuiteDescription - { - public: - CommonDynamicSuiteDescription(); - CommonDynamicSuiteDescription( const char *argFile, unsigned argLine, - const char *argSuiteName, List &argTests, - unsigned argCreateLine, unsigned argDestroyLine ); - - void initialize( const char *argFile, unsigned argLine, - const char *argSuiteName, List &argTests, - unsigned argCreateLine, unsigned argDestroyLine ); - - protected: - unsigned _createLine, _destroyLine; - - private: - void doInitialize( unsigned argCreateLine, unsigned argDestroyLine ); - }; - - template - class DynamicSuiteDescription : public CommonDynamicSuiteDescription - { - public: - DynamicSuiteDescription() {} - DynamicSuiteDescription( const char *argFile, unsigned argLine, - const char *argSuiteName, List &argTests, - S *&argSuite, unsigned argCreateLine, - unsigned argDestroyLine ) : - CommonDynamicSuiteDescription( argFile, argLine, argSuiteName, argTests, argCreateLine, argDestroyLine ) - { - _suite = &argSuite; - } - - void initialize( const char *argFile, unsigned argLine, - const char *argSuiteName, List &argTests, - S *&argSuite, unsigned argCreateLine, - unsigned argDestroyLine ) - { - CommonDynamicSuiteDescription::initialize( argFile, argLine, - argSuiteName, argTests, - argCreateLine, argDestroyLine ); - _suite = &argSuite; - } - - TestSuite *suite() const { return realSuite(); } - - bool setUp(); - bool tearDown(); - - private: - S *realSuite() const { return *_suite; } - void setSuite( S *s ) { *_suite = s; } - - void createSuite() - { - setSuite( S::createSuite() ); - } - - void destroySuite() - { - S *s = realSuite(); - setSuite( 0 ); - S::destroySuite( s ); - } - - S **_suite; - }; - - template - bool DynamicSuiteDescription::setUp() - { - _TS_TRY { - _TSM_ASSERT_THROWS_NOTHING( file(), _createLine, "Exception thrown from createSuite()", createSuite() ); - _TSM_ASSERT( file(), _createLine, "createSuite() failed", suite() != 0 ); - } - _TS_CATCH_ABORT( { return false; } ); - - return (suite() != 0); - } - - template - bool DynamicSuiteDescription::tearDown() - { - if ( !_suite ) - return true; - - _TS_TRY { - _TSM_ASSERT_THROWS_NOTHING( file(), _destroyLine, "destroySuite() failed", destroySuite() ); - } - _TS_CATCH_ABORT( { return false; } ); - - return true; - } - - class RealWorldDescription : public WorldDescription - { - public: - static List &suites(); - unsigned numSuites( void ) const; - unsigned numTotalTests( void ) const; - SuiteDescription *firstSuite(); - const SuiteDescription *firstSuite() const; - const SuiteDescription &suiteDescription( unsigned i ) const; - void activateAllTests(); - bool leaveOnly( const char *suiteName, const char *testName = 0 ); - - bool setUp(); - bool tearDown(); - static void reportError( const char *message ); - }; - - void activateAllTests(); - bool leaveOnly( const char *suiteName, const char *testName = 0 ); -} - -#endif // __cxxtest__RealDescriptions_h__ - diff --git a/test/cxxtest/Root.cpp b/test/cxxtest/Root.cpp deleted file mode 100644 index ff375ced..00000000 --- a/test/cxxtest/Root.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef __cxxtest__Root_cpp__ -#define __cxxtest__Root_cpp__ - -// -// This file holds the "root" of CxxTest, i.e. -// the parts that must be in a source file file. -// - -#include -#include -#include -#include -#include -#include -#include -#include - -#endif // __cxxtest__Root_cpp__ diff --git a/test/cxxtest/SelfTest.h b/test/cxxtest/SelfTest.h deleted file mode 100644 index 6d6b96e7..00000000 --- a/test/cxxtest/SelfTest.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef __cxxtest_SelfTest_h__ -#define __cxxtest_SelfTest_h__ - -#define CXXTEST_SUITE(name) -#define CXXTEST_CODE(member) - -#endif // __cxxtest_SelfTest_h__ diff --git a/test/cxxtest/StdHeaders.h b/test/cxxtest/StdHeaders.h deleted file mode 100644 index 7c80b76f..00000000 --- a/test/cxxtest/StdHeaders.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef __cxxtest_StdHeaders_h__ -#define __cxxtest_StdHeaders_h__ - -// -// This file basically #includes the STL headers. -// It exists to support warning level 4 in Visual C++ -// - -#ifdef _MSC_VER -# pragma warning( push, 1 ) -#endif // _MSC_VER - -#include -#include -#include -#include -#include -#include -#include - -#ifdef _MSC_VER -# pragma warning( pop ) -#endif // _MSC_VER - -#endif // __cxxtest_StdHeaders_h__ diff --git a/test/cxxtest/StdValueTraits.h b/test/cxxtest/StdValueTraits.h deleted file mode 100644 index ac1ee07e..00000000 --- a/test/cxxtest/StdValueTraits.h +++ /dev/null @@ -1,229 +0,0 @@ -#ifndef __cxxtest_StdValueTraits_h__ -#define __cxxtest_StdValueTraits_h__ - -// -// This file defines ValueTraits for std:: stuff. -// It is #included by if you -// define CXXTEST_HAVE_STD -// - -#include -#include - -#ifdef _CXXTEST_OLD_STD -# define CXXTEST_STD(x) x -#else // !_CXXTEST_OLD_STD -# define CXXTEST_STD(x) std::x -#endif // _CXXTEST_OLD_STD - -#ifndef CXXTEST_USER_VALUE_TRAITS - -namespace CxxTest -{ - // - // NOTE: This should have been - // template - // class ValueTraits< std::basic_string > {}; - // But MSVC doesn't support it (yet). - // - - // - // If we have std::string, we might as well use it - // - class StdTraitsBase - { - public: - StdTraitsBase &operator<<( const CXXTEST_STD(string) &s ) { _s += s; return *this; } - const char *asString() const { return _s.c_str(); } - - private: - CXXTEST_STD(string) _s; - }; - - // - // std::string - // - CXXTEST_TEMPLATE_INSTANTIATION - class ValueTraits : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(string) &s ) - { - *this << "\""; - for ( unsigned i = 0; i < s.length(); ++ i ) { - char c[sizeof("\\xXX")]; - charToString( s[i], c ); - *this << c; - } - *this << "\""; - } - }; - - CXXTEST_COPY_CONST_TRAITS( CXXTEST_STD(string) ); - -#ifndef _CXXTEST_OLD_STD - // - // std::wstring - // - CXXTEST_TEMPLATE_INSTANTIATION - class ValueTraits)> : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(basic_string) &s ) - { - *this << "L\""; - for ( unsigned i = 0; i < s.length(); ++ i ) { - char c[sizeof("\\x12345678")]; - charToString( (unsigned long)s[i], c ); - *this << c; - } - *this << "\""; - } - }; - - CXXTEST_COPY_CONST_TRAITS( CXXTEST_STD(basic_string) ); -#endif // _CXXTEST_OLD_STD - - // - // Convert a range defined by iterators to a string - // This is useful for almost all STL containers - // - template - void dumpRange( Stream &s, Iterator first, Iterator last ) - { - s << "{ "; - while ( first != last ) { - s << TS_AS_STRING(*first); - ++ first; - s << ((first == last) ? " }" : ", "); - } - } - -#ifdef _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION - // - // std::pair - // - template - class ValueTraits< CXXTEST_STD(pair) > : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(pair) &p ) - { - *this << "<" << TS_AS_STRING( p.first ) << ", " << TS_AS_STRING( p.second ) << ">"; - } - }; - - // - // std::vector - // - template - class ValueTraits< CXXTEST_STD(vector) > : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(vector) &v ) - { - dumpRange( *this, v.begin(), v.end() ); - } - }; - - // - // std::list - // - template - class ValueTraits< CXXTEST_STD(list) > : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(list) &l ) - { - dumpRange( *this, l.begin(), l.end() ); - } - }; - - // - // std::set - // - template - class ValueTraits< CXXTEST_STD(set) > : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(set) &s ) - { - dumpRange( *this, s.begin(), s.end() ); - } - }; - - // - // std::map - // - template - class ValueTraits< CXXTEST_STD(map) > : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(map) &m ) - { - dumpRange( *this, m.begin(), m.end() ); - } - }; - - // - // std::deque - // - template - class ValueTraits< CXXTEST_STD(deque) > : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(deque) &d ) - { - dumpRange( *this, d.begin(), d.end() ); - } - }; - - // - // std::multiset - // - template - class ValueTraits< CXXTEST_STD(multiset) > : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(multiset) &ms ) - { - dumpRange( *this, ms.begin(), ms.end() ); - } - }; - - // - // std::multimap - // - template - class ValueTraits< CXXTEST_STD(multimap) > : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(multimap) &mm ) - { - dumpRange( *this, mm.begin(), mm.end() ); - } - }; - - // - // std::complex - // - template - class ValueTraits< CXXTEST_STD(complex) > : public StdTraitsBase - { - public: - ValueTraits( const CXXTEST_STD(complex) &c ) - { - if ( !c.imag() ) - *this << TS_AS_STRING(c.real()); - else if ( !c.real() ) - *this << "(" << TS_AS_STRING(c.imag()) << " * i)"; - else - *this << "(" << TS_AS_STRING(c.real()) << " + " << TS_AS_STRING(c.imag()) << " * i)"; - } - }; -#endif // _CXXTEST_PARTIAL_TEMPLATE_SPECIALIZATION -} - -#endif // CXXTEST_USER_VALUE_TRAITS - -#endif // __cxxtest_StdValueTraits_h__ diff --git a/test/cxxtest/StdioFilePrinter.h b/test/cxxtest/StdioFilePrinter.h deleted file mode 100644 index 47984b69..00000000 --- a/test/cxxtest/StdioFilePrinter.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef __cxxtest__StdioFilePrinter_h__ -#define __cxxtest__StdioFilePrinter_h__ - -// -// The StdioFilePrinter is a simple TestListener that -// just prints "OK" if everything goes well, otherwise -// reports the error in the format of compiler messages. -// This class uses , i.e. FILE * and fprintf(). -// - -#include -#include - -namespace CxxTest -{ - class StdioFilePrinter : public ErrorFormatter - { - public: - StdioFilePrinter( FILE *o, const char *preLine = ":", const char *postLine = "" ) : - ErrorFormatter( new Adapter(o), preLine, postLine ) {} - virtual ~StdioFilePrinter() { delete outputStream(); } - - private: - class Adapter : public OutputStream - { - Adapter( const Adapter & ); - Adapter &operator=( const Adapter & ); - - FILE *_o; - - public: - Adapter( FILE *o ) : _o(o) {} - void flush() { fflush( _o ); } - OutputStream &operator<<( unsigned i ) { fprintf( _o, "%u", i ); return *this; } - OutputStream &operator<<( const char *s ) { fputs( s, _o ); return *this; } - OutputStream &operator<<( Manipulator m ) { return OutputStream::operator<<( m ); } - }; - }; -} - -#endif // __cxxtest__StdioFilePrinter_h__ diff --git a/test/cxxtest/StdioPrinter.h b/test/cxxtest/StdioPrinter.h deleted file mode 100644 index af5bc6b6..00000000 --- a/test/cxxtest/StdioPrinter.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __cxxtest__StdioPrinter_h__ -#define __cxxtest__StdioPrinter_h__ - -// -// The StdioPrinter is an StdioFilePrinter which defaults to stdout. -// This should have been called StdOutPrinter or something, but the name -// has been historically used. -// - -#include - -namespace CxxTest -{ - class StdioPrinter : public StdioFilePrinter - { - public: - StdioPrinter( FILE *o = stdout, const char *preLine = ":", const char *postLine = "" ) : - StdioFilePrinter( o, preLine, postLine ) {} - }; -} - -#endif // __cxxtest__StdioPrinter_h__ diff --git a/test/cxxtest/TeeListener.h b/test/cxxtest/TeeListener.h deleted file mode 100644 index 88afdd3e..00000000 --- a/test/cxxtest/TeeListener.h +++ /dev/null @@ -1,182 +0,0 @@ -#ifndef __cxxtest__TeeListener_h__ -#define __cxxtest__TeeListener_h__ - -// -// A TeeListener notifies two "reular" TestListeners -// - -#include -#include - -namespace CxxTest -{ - class TeeListener : public TestListener - { - public: - TeeListener() - { - setFirst( _dummy ); - setSecond( _dummy ); - } - - virtual ~TeeListener() - { - } - - void setFirst( TestListener &first ) - { - _first = &first; - } - - void setSecond( TestListener &second ) - { - _second = &second; - } - - void enterWorld( const WorldDescription &d ) - { - _first->enterWorld( d ); - _second->enterWorld( d ); - } - - void enterSuite( const SuiteDescription &d ) - { - _first->enterSuite( d ); - _second->enterSuite( d ); - } - - void enterTest( const TestDescription &d ) - { - _first->enterTest( d ); - _second->enterTest( d ); - } - - void trace( const char *file, unsigned line, const char *expression ) - { - _first->trace( file, line, expression ); - _second->trace( file, line, expression ); - } - - void warning( const char *file, unsigned line, const char *expression ) - { - _first->warning( file, line, expression ); - _second->warning( file, line, expression ); - } - - void failedTest( const char *file, unsigned line, const char *expression ) - { - _first->failedTest( file, line, expression ); - _second->failedTest( file, line, expression ); - } - - void failedAssert( const char *file, unsigned line, const char *expression ) - { - _first->failedAssert( file, line, expression ); - _second->failedAssert( file, line, expression ); - } - - void failedAssertEquals( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *x, const char *y ) - { - _first->failedAssertEquals( file, line, xStr, yStr, x, y ); - _second->failedAssertEquals( file, line, xStr, yStr, x, y ); - } - - void failedAssertSameData( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *sizeStr, const void *x, - const void *y, unsigned size ) - { - _first->failedAssertSameData( file, line, xStr, yStr, sizeStr, x, y, size ); - _second->failedAssertSameData( file, line, xStr, yStr, sizeStr, x, y, size ); - } - - void failedAssertDelta( const char *file, unsigned line, - const char *xStr, const char *yStr, const char *dStr, - const char *x, const char *y, const char *d ) - { - _first->failedAssertDelta( file, line, xStr, yStr, dStr, x, y, d ); - _second->failedAssertDelta( file, line, xStr, yStr, dStr, x, y, d ); - } - - void failedAssertDiffers( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *value ) - { - _first->failedAssertDiffers( file, line, xStr, yStr, value ); - _second->failedAssertDiffers( file, line, xStr, yStr, value ); - } - - void failedAssertLessThan( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *x, const char *y ) - { - _first->failedAssertLessThan( file, line, xStr, yStr, x, y ); - _second->failedAssertLessThan( file, line, xStr, yStr, x, y ); - } - - void failedAssertLessThanEquals( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *x, const char *y ) - { - _first->failedAssertLessThanEquals( file, line, xStr, yStr, x, y ); - _second->failedAssertLessThanEquals( file, line, xStr, yStr, x, y ); - } - - void failedAssertPredicate( const char *file, unsigned line, - const char *predicate, const char *xStr, const char *x ) - { - _first->failedAssertPredicate( file, line, predicate, xStr, x ); - _second->failedAssertPredicate( file, line, predicate, xStr, x ); - } - - void failedAssertRelation( const char *file, unsigned line, - const char *relation, const char *xStr, const char *yStr, - const char *x, const char *y ) - { - _first->failedAssertRelation( file, line, relation, xStr, yStr, x, y ); - _second->failedAssertRelation( file, line, relation, xStr, yStr, x, y ); - } - - void failedAssertThrows( const char *file, unsigned line, - const char *expression, const char *type, - bool otherThrown ) - { - _first->failedAssertThrows( file, line, expression, type, otherThrown ); - _second->failedAssertThrows( file, line, expression, type, otherThrown ); - } - - void failedAssertThrowsNot( const char *file, unsigned line, - const char *expression ) - { - _first->failedAssertThrowsNot( file, line, expression ); - _second->failedAssertThrowsNot( file, line, expression ); - } - - void leaveTest( const TestDescription &d ) - { - _first->leaveTest(d); - _second->leaveTest(d); - } - - void leaveSuite( const SuiteDescription &d ) - { - _first->leaveSuite(d); - _second->leaveSuite(d); - } - - void leaveWorld( const WorldDescription &d ) - { - _first->leaveWorld(d); - _second->leaveWorld(d); - } - - private: - TestListener *_first, *_second; - TestListener _dummy; - }; -}; - - -#endif // __cxxtest__TeeListener_h__ diff --git a/test/cxxtest/TestListener.h b/test/cxxtest/TestListener.h deleted file mode 100644 index 0eeb5234..00000000 --- a/test/cxxtest/TestListener.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef __cxxtest__TestListener_h__ -#define __cxxtest__TestListener_h__ - -// -// TestListener is the base class for all "listeners", -// i.e. classes that receive notifications of the -// testing process. -// -// The names of the parameters are in comments to avoid -// "unused parameter" warnings. -// - -#include - -namespace CxxTest -{ - class TestListener - { - public: - TestListener() {} - virtual ~TestListener() {} - - virtual void enterWorld( const WorldDescription & /*desc*/ ) {} - virtual void enterSuite( const SuiteDescription & /*desc*/ ) {} - virtual void enterTest( const TestDescription & /*desc*/ ) {} - virtual void trace( const char * /*file*/, unsigned /*line*/, - const char * /*expression*/ ) {} - virtual void warning( const char * /*file*/, unsigned /*line*/, - const char * /*expression*/ ) {} - virtual void failedTest( const char * /*file*/, unsigned /*line*/, - const char * /*expression*/ ) {} - virtual void failedAssert( const char * /*file*/, unsigned /*line*/, - const char * /*expression*/ ) {} - virtual void failedAssertEquals( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*x*/, const char * /*y*/ ) {} - virtual void failedAssertSameData( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*sizeStr*/, const void * /*x*/, - const void * /*y*/, unsigned /*size*/ ) {} - virtual void failedAssertDelta( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*dStr*/, const char * /*x*/, - const char * /*y*/, const char * /*d*/ ) {} - virtual void failedAssertDiffers( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*value*/ ) {} - virtual void failedAssertLessThan( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*x*/, const char * /*y*/ ) {} - virtual void failedAssertLessThanEquals( const char * /*file*/, unsigned /*line*/, - const char * /*xStr*/, const char * /*yStr*/, - const char * /*x*/, const char * /*y*/ ) {} - virtual void failedAssertPredicate( const char * /*file*/, unsigned /*line*/, - const char * /*predicate*/, const char * /*xStr*/, const char * /*x*/ ) {} - virtual void failedAssertRelation( const char * /*file*/, unsigned /*line*/, - const char * /*relation*/, const char * /*xStr*/, const char * /*yStr*/, - const char * /*x*/, const char * /*y*/ ) {} - virtual void failedAssertThrows( const char * /*file*/, unsigned /*line*/, - const char * /*expression*/, const char * /*type*/, - bool /*otherThrown*/ ) {} - virtual void failedAssertThrowsNot( const char * /*file*/, unsigned /*line*/, - const char * /*expression*/ ) {} - virtual void leaveTest( const TestDescription & /*desc*/ ) {} - virtual void leaveSuite( const SuiteDescription & /*desc*/ ) {} - virtual void leaveWorld( const WorldDescription & /*desc*/ ) {} - }; -} - -#endif // __cxxtest__TestListener_h__ diff --git a/test/cxxtest/TestRunner.h b/test/cxxtest/TestRunner.h deleted file mode 100644 index cf0d856e..00000000 --- a/test/cxxtest/TestRunner.h +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef __cxxtest_TestRunner_h__ -#define __cxxtest_TestRunner_h__ - -// -// TestRunner is the class that runs all the tests. -// To use it, create an object that implements the TestListener -// interface and call TestRunner::runAllTests( myListener ); -// - -#include -#include -#include -#include - -namespace CxxTest -{ - class TestRunner - { - public: - static void runAllTests( TestListener &listener ) - { - tracker().setListener( &listener ); - _TS_TRY { TestRunner().runWorld(); } - _TS_LAST_CATCH( { tracker().failedTest( __FILE__, __LINE__, "Exception thrown from world" ); } ); - tracker().setListener( 0 ); - } - - static void runAllTests( TestListener *listener ) - { - if ( listener ) { - listener->warning( __FILE__, __LINE__, "Deprecated; Use runAllTests( TestListener & )" ); - runAllTests( *listener ); - } - } - - private: - void runWorld() - { - RealWorldDescription wd; - WorldGuard sg; - - tracker().enterWorld( wd ); - if ( wd.setUp() ) { - for ( SuiteDescription *sd = wd.firstSuite(); sd; sd = sd->next() ) - if ( sd->active() ) - runSuite( *sd ); - - wd.tearDown(); - } - tracker().leaveWorld( wd ); - } - - void runSuite( SuiteDescription &sd ) - { - StateGuard sg; - - tracker().enterSuite( sd ); - if ( sd.setUp() ) { - for ( TestDescription *td = sd.firstTest(); td; td = td->next() ) - if ( td->active() ) - runTest( *td ); - - sd.tearDown(); - } - tracker().leaveSuite( sd ); - } - - void runTest( TestDescription &td ) - { - StateGuard sg; - - tracker().enterTest( td ); - if ( td.setUp() ) { - td.run(); - td.tearDown(); - } - tracker().leaveTest( td ); - } - - class StateGuard - { -#ifdef _CXXTEST_HAVE_EH - bool _abortTestOnFail; -#endif // _CXXTEST_HAVE_EH - unsigned _maxDumpSize; - - public: - StateGuard() - { -#ifdef _CXXTEST_HAVE_EH - _abortTestOnFail = abortTestOnFail(); -#endif // _CXXTEST_HAVE_EH - _maxDumpSize = maxDumpSize(); - } - - ~StateGuard() - { -#ifdef _CXXTEST_HAVE_EH - setAbortTestOnFail( _abortTestOnFail ); -#endif // _CXXTEST_HAVE_EH - setMaxDumpSize( _maxDumpSize ); - } - }; - - class WorldGuard : public StateGuard - { - public: - WorldGuard() : StateGuard() - { -#ifdef _CXXTEST_HAVE_EH - setAbortTestOnFail( CXXTEST_DEFAULT_ABORT ); -#endif // _CXXTEST_HAVE_EH - setMaxDumpSize( CXXTEST_MAX_DUMP_SIZE ); - } - }; - }; - - // - // For --no-static-init - // - void initialize(); -} - - -#endif // __cxxtest_TestRunner_h__ diff --git a/test/cxxtest/TestSuite.cpp b/test/cxxtest/TestSuite.cpp deleted file mode 100644 index 5ada7e55..00000000 --- a/test/cxxtest/TestSuite.cpp +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __cxxtest__TestSuite_cpp__ -#define __cxxtest__TestSuite_cpp__ - -#include - -namespace CxxTest { -// -// TestSuite members -// -TestSuite::~TestSuite() {} -void TestSuite::setUp() {} -void TestSuite::tearDown() {} - -// -// Test-aborting stuff -// -static bool currentAbortTestOnFail = false; - -bool abortTestOnFail() { return currentAbortTestOnFail; } - -void setAbortTestOnFail(bool value) { currentAbortTestOnFail = value; } - -void doAbortTest() { -#if defined(_CXXTEST_HAVE_EH) - if (currentAbortTestOnFail) throw AbortTest(); -#endif // _CXXTEST_HAVE_EH -} - -// -// Max dump size -// -static unsigned currentMaxDumpSize = CXXTEST_MAX_DUMP_SIZE; - -unsigned maxDumpSize() { return currentMaxDumpSize; } - -void setMaxDumpSize(unsigned value) { currentMaxDumpSize = value; } - -// -// Some non-template functions -// -void doTrace(const char *file, unsigned line, const char *message) { tracker().trace(file, line, message); } - -void doWarn(const char *file, unsigned line, const char *message) { tracker().warning(file, line, message); } - -void doFailTest(const char *file, unsigned line, const char *message) { - tracker().failedTest(file, line, message); - TS_ABORT(); -} - -void doFailAssert(const char *file, unsigned line, const char *expression, const char *message) { - if (message) tracker().failedTest(file, line, message); - tracker().failedAssert(file, line, expression); - TS_ABORT(); -} - -bool sameData(const void *x, const void *y, unsigned size) { - if (size == 0) return true; - - if (x == y) return true; - - if (!x || !y) return false; - - const char *cx = (const char *)x; - const char *cy = (const char *)y; - while (size--) - if (*cx++ != *cy++) return false; - - return true; -} - -void doAssertSameData(const char *file, unsigned line, const char *xExpr, const void *x, const char *yExpr, - const void *y, const char *sizeExpr, unsigned size, const char *message) { - if (!sameData(x, y, size)) { - if (message) tracker().failedTest(file, line, message); - tracker().failedAssertSameData(file, line, xExpr, yExpr, sizeExpr, x, y, size); - TS_ABORT(); - } -} - -void doFailAssertThrows(const char *file, unsigned line, const char *expr, const char *type, bool otherThrown, - const char *message) { - if (message) tracker().failedTest(file, line, message); - - tracker().failedAssertThrows(file, line, expr, type, otherThrown); - TS_ABORT(); -} - -void doFailAssertThrowsNot(const char *file, unsigned line, const char *expression, const char *message) { - if (message) tracker().failedTest(file, line, message); - - tracker().failedAssertThrowsNot(file, line, expression); - TS_ABORT(); -} -} // namespace CxxTest - -#endif // __cxxtest__TestSuite_cpp__ diff --git a/test/cxxtest/TestSuite.h b/test/cxxtest/TestSuite.h deleted file mode 100644 index fc5a206a..00000000 --- a/test/cxxtest/TestSuite.h +++ /dev/null @@ -1,512 +0,0 @@ -#ifndef __cxxtest__TestSuite_h__ -#define __cxxtest__TestSuite_h__ - -// -// class TestSuite is the base class for all test suites. -// To define a test suite, derive from this class and add -// member functions called void test*(); -// - -#include -#include -#include -#include - -#ifdef _CXXTEST_HAVE_STD -# include -#endif // _CXXTEST_HAVE_STD - -namespace CxxTest -{ - class TestSuite - { - public: - virtual ~TestSuite(); - virtual void setUp(); - virtual void tearDown(); - }; - - class AbortTest {}; - void doAbortTest(); -# define TS_ABORT() CxxTest::doAbortTest() - - bool abortTestOnFail(); - void setAbortTestOnFail( bool value = CXXTEST_DEFAULT_ABORT ); - - unsigned maxDumpSize(); - void setMaxDumpSize( unsigned value = CXXTEST_MAX_DUMP_SIZE ); - - void doTrace( const char *file, unsigned line, const char *message ); - void doWarn( const char *file, unsigned line, const char *message ); - void doFailTest( const char *file, unsigned line, const char *message ); - void doFailAssert( const char *file, unsigned line, const char *expression, const char *message ); - - template - bool equals( X x, Y y ) - { - return (x == y); - } - - template - void doAssertEquals( const char *file, unsigned line, - const char *xExpr, X x, - const char *yExpr, Y y, - const char *message ) - { - if ( !equals( x, y ) ) { - if ( message ) - tracker().failedTest( file, line, message ); - tracker().failedAssertEquals( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) ); - TS_ABORT(); - } - } - - void doAssertSameData( const char *file, unsigned line, - const char *xExpr, const void *x, - const char *yExpr, const void *y, - const char *sizeExpr, unsigned size, - const char *message ); - - template - bool differs( X x, Y y ) - { - return !(x == y); - } - - template - void doAssertDiffers( const char *file, unsigned line, - const char *xExpr, X x, - const char *yExpr, Y y, - const char *message ) - { - if ( !differs( x, y ) ) { - if ( message ) - tracker().failedTest( file, line, message ); - tracker().failedAssertDiffers( file, line, xExpr, yExpr, TS_AS_STRING(x) ); - TS_ABORT(); - } - } - - template - bool lessThan( X x, Y y ) - { - return (x < y); - } - - template - void doAssertLessThan( const char *file, unsigned line, - const char *xExpr, X x, - const char *yExpr, Y y, - const char *message ) - { - if ( !lessThan(x, y) ) { - if ( message ) - tracker().failedTest( file, line, message ); - tracker().failedAssertLessThan( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) ); - TS_ABORT(); - } - } - - template - bool lessThanEquals( X x, Y y ) - { - return (x <= y); - } - - template - void doAssertLessThanEquals( const char *file, unsigned line, - const char *xExpr, X x, - const char *yExpr, Y y, - const char *message ) - { - if ( !lessThanEquals( x, y ) ) { - if ( message ) - tracker().failedTest( file, line, message ); - tracker().failedAssertLessThanEquals( file, line, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) ); - TS_ABORT(); - } - } - - template - void doAssertPredicate( const char *file, unsigned line, - const char *pExpr, const P &p, - const char *xExpr, X x, - const char *message ) - { - if ( !p( x ) ) { - if ( message ) - tracker().failedTest( file, line, message ); - tracker().failedAssertPredicate( file, line, pExpr, xExpr, TS_AS_STRING(x) ); - TS_ABORT(); - } - } - - template - void doAssertRelation( const char *file, unsigned line, - const char *rExpr, const R &r, - const char *xExpr, X x, - const char *yExpr, Y y, - const char *message ) - { - if ( !r( x, y ) ) { - if ( message ) - tracker().failedTest( file, line, message ); - tracker().failedAssertRelation( file, line, rExpr, xExpr, yExpr, TS_AS_STRING(x), TS_AS_STRING(y) ); - TS_ABORT(); - } - } - - template - bool delta( X x, Y y, D d ) - { - return ((y >= x - d) && (y <= x + d)); - } - - template - void doAssertDelta( const char *file, unsigned line, - const char *xExpr, X x, - const char *yExpr, Y y, - const char *dExpr, D d, - const char *message ) - { - if ( !delta( x, y, d ) ) { - if ( message ) - tracker().failedTest( file, line, message ); - - tracker().failedAssertDelta( file, line, xExpr, yExpr, dExpr, - TS_AS_STRING(x), TS_AS_STRING(y), TS_AS_STRING(d) ); - TS_ABORT(); - } - } - - void doFailAssertThrows( const char *file, unsigned line, - const char *expr, const char *type, - bool otherThrown, - const char *message ); - - void doFailAssertThrowsNot( const char *file, unsigned line, - const char *expression, const char *message ); - -# ifdef _CXXTEST_HAVE_EH -# define _TS_TRY try -# define _TS_CATCH_TYPE(t, b) catch t b -# define _TS_CATCH_ABORT(b) _TS_CATCH_TYPE( (const CxxTest::AbortTest &), b ) -# define _TS_LAST_CATCH(b) _TS_CATCH_TYPE( (...), b ) -# define _TSM_LAST_CATCH(f,l,m) _TS_LAST_CATCH( { (CxxTest::tracker()).failedTest(f,l,m); } ) -# ifdef _CXXTEST_HAVE_STD -# define ___TSM_CATCH(f,l,m) \ - catch(const std::exception &e) { (CxxTest::tracker()).failedTest(f,l,e.what()); } \ - _TSM_LAST_CATCH(f,l,m) -# else // !_CXXTEST_HAVE_STD -# define ___TSM_CATCH(f,l,m) _TSM_LAST_CATCH(f,l,m) -# endif // _CXXTEST_HAVE_STD -# define __TSM_CATCH(f,l,m) \ - _TS_CATCH_ABORT( { throw; } ) \ - ___TSM_CATCH(f,l,m) -# define __TS_CATCH(f,l) __TSM_CATCH(f,l,"Unhandled exception") -# define _TS_CATCH __TS_CATCH(__FILE__,__LINE__) -# else // !_CXXTEST_HAVE_EH -# define _TS_TRY -# define ___TSM_CATCH(f,l,m) -# define __TSM_CATCH(f,l,m) -# define __TS_CATCH(f,l) -# define _TS_CATCH -# define _TS_CATCH_TYPE(t, b) -# define _TS_LAST_CATCH(b) -# define _TS_CATCH_ABORT(b) -# endif // _CXXTEST_HAVE_EH - - // TS_TRACE -# define _TS_TRACE(f,l,e) CxxTest::doTrace( (f), (l), TS_AS_STRING(e) ) -# define TS_TRACE(e) _TS_TRACE( __FILE__, __LINE__, e ) - - // TS_WARN -# define _TS_WARN(f,l,e) CxxTest::doWarn( (f), (l), TS_AS_STRING(e) ) -# define TS_WARN(e) _TS_WARN( __FILE__, __LINE__, e ) - - // TS_FAIL -# define _TS_FAIL(f,l,e) CxxTest::doFailTest( (f), (l), TS_AS_STRING(e) ) -# define TS_FAIL(e) _TS_FAIL( __FILE__, __LINE__, e ) - - // TS_ASSERT -# define ___ETS_ASSERT(f,l,e,m) { if ( !(e) ) CxxTest::doFailAssert( (f), (l), #e, (m) ); } -# define ___TS_ASSERT(f,l,e,m) { _TS_TRY { ___ETS_ASSERT(f,l,e,m); } __TS_CATCH(f,l) } - -# define _ETS_ASSERT(f,l,e) ___ETS_ASSERT(f,l,e,0) -# define _TS_ASSERT(f,l,e) ___TS_ASSERT(f,l,e,0) - -# define ETS_ASSERT(e) _ETS_ASSERT(__FILE__,__LINE__,e) -# define TS_ASSERT(e) _TS_ASSERT(__FILE__,__LINE__,e) - -# define _ETSM_ASSERT(f,l,m,e) ___ETS_ASSERT(f,l,e,TS_AS_STRING(m) ) -# define _TSM_ASSERT(f,l,m,e) ___TS_ASSERT(f,l,e,TS_AS_STRING(m) ) - -# define ETSM_ASSERT(m,e) _ETSM_ASSERT(__FILE__,__LINE__,m,e) -# define TSM_ASSERT(m,e) _TSM_ASSERT(__FILE__,__LINE__,m,e) - - // TS_ASSERT_EQUALS -# define ___ETS_ASSERT_EQUALS(f,l,x,y,m) CxxTest::doAssertEquals( (f), (l), #x, (x), #y, (y), (m) ) -# define ___TS_ASSERT_EQUALS(f,l,x,y,m) { _TS_TRY { ___ETS_ASSERT_EQUALS(f,l,x,y,m); } __TS_CATCH(f,l) } - -# define _ETS_ASSERT_EQUALS(f,l,x,y) ___ETS_ASSERT_EQUALS(f,l,x,y,0) -# define _TS_ASSERT_EQUALS(f,l,x,y) ___TS_ASSERT_EQUALS(f,l,x,y,0) - -# define ETS_ASSERT_EQUALS(x,y) _ETS_ASSERT_EQUALS(__FILE__,__LINE__,x,y) -# define TS_ASSERT_EQUALS(x,y) _TS_ASSERT_EQUALS(__FILE__,__LINE__,x,y) - -# define _ETSM_ASSERT_EQUALS(f,l,m,x,y) ___ETS_ASSERT_EQUALS(f,l,x,y,TS_AS_STRING(m)) -# define _TSM_ASSERT_EQUALS(f,l,m,x,y) ___TS_ASSERT_EQUALS(f,l,x,y,TS_AS_STRING(m)) - -# define ETSM_ASSERT_EQUALS(m,x,y) _ETSM_ASSERT_EQUALS(__FILE__,__LINE__,m,x,y) -# define TSM_ASSERT_EQUALS(m,x,y) _TSM_ASSERT_EQUALS(__FILE__,__LINE__,m,x,y) - - // TS_ASSERT_SAME_DATA -# define ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,m) CxxTest::doAssertSameData( (f), (l), #x, (x), #y, (y), #s, (s), (m) ) -# define ___TS_ASSERT_SAME_DATA(f,l,x,y,s,m) { _TS_TRY { ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,m); } __TS_CATCH(f,l) } - -# define _ETS_ASSERT_SAME_DATA(f,l,x,y,s) ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,0) -# define _TS_ASSERT_SAME_DATA(f,l,x,y,s) ___TS_ASSERT_SAME_DATA(f,l,x,y,s,0) - -# define ETS_ASSERT_SAME_DATA(x,y,s) _ETS_ASSERT_SAME_DATA(__FILE__,__LINE__,x,y,s) -# define TS_ASSERT_SAME_DATA(x,y,s) _TS_ASSERT_SAME_DATA(__FILE__,__LINE__,x,y,s) - -# define _ETSM_ASSERT_SAME_DATA(f,l,m,x,y,s) ___ETS_ASSERT_SAME_DATA(f,l,x,y,s,TS_AS_STRING(m)) -# define _TSM_ASSERT_SAME_DATA(f,l,m,x,y,s) ___TS_ASSERT_SAME_DATA(f,l,x,y,s,TS_AS_STRING(m)) - -# define ETSM_ASSERT_SAME_DATA(m,x,y,s) _ETSM_ASSERT_SAME_DATA(__FILE__,__LINE__,m,x,y,s) -# define TSM_ASSERT_SAME_DATA(m,x,y,s) _TSM_ASSERT_SAME_DATA(__FILE__,__LINE__,m,x,y,s) - - // TS_ASSERT_DIFFERS -# define ___ETS_ASSERT_DIFFERS(f,l,x,y,m) CxxTest::doAssertDiffers( (f), (l), #x, (x), #y, (y), (m) ) -# define ___TS_ASSERT_DIFFERS(f,l,x,y,m) { _TS_TRY { ___ETS_ASSERT_DIFFERS(f,l,x,y,m); } __TS_CATCH(f,l) } - -# define _ETS_ASSERT_DIFFERS(f,l,x,y) ___ETS_ASSERT_DIFFERS(f,l,x,y,0) -# define _TS_ASSERT_DIFFERS(f,l,x,y) ___TS_ASSERT_DIFFERS(f,l,x,y,0) - -# define ETS_ASSERT_DIFFERS(x,y) _ETS_ASSERT_DIFFERS(__FILE__,__LINE__,x,y) -# define TS_ASSERT_DIFFERS(x,y) _TS_ASSERT_DIFFERS(__FILE__,__LINE__,x,y) - -# define _ETSM_ASSERT_DIFFERS(f,l,m,x,y) ___ETS_ASSERT_DIFFERS(f,l,x,y,TS_AS_STRING(m)) -# define _TSM_ASSERT_DIFFERS(f,l,m,x,y) ___TS_ASSERT_DIFFERS(f,l,x,y,TS_AS_STRING(m)) - -# define ETSM_ASSERT_DIFFERS(m,x,y) _ETSM_ASSERT_DIFFERS(__FILE__,__LINE__,m,x,y) -# define TSM_ASSERT_DIFFERS(m,x,y) _TSM_ASSERT_DIFFERS(__FILE__,__LINE__,m,x,y) - - // TS_ASSERT_LESS_THAN -# define ___ETS_ASSERT_LESS_THAN(f,l,x,y,m) CxxTest::doAssertLessThan( (f), (l), #x, (x), #y, (y), (m) ) -# define ___TS_ASSERT_LESS_THAN(f,l,x,y,m) { _TS_TRY { ___ETS_ASSERT_LESS_THAN(f,l,x,y,m); } __TS_CATCH(f,l) } - -# define _ETS_ASSERT_LESS_THAN(f,l,x,y) ___ETS_ASSERT_LESS_THAN(f,l,x,y,0) -# define _TS_ASSERT_LESS_THAN(f,l,x,y) ___TS_ASSERT_LESS_THAN(f,l,x,y,0) - -# define ETS_ASSERT_LESS_THAN(x,y) _ETS_ASSERT_LESS_THAN(__FILE__,__LINE__,x,y) -# define TS_ASSERT_LESS_THAN(x,y) _TS_ASSERT_LESS_THAN(__FILE__,__LINE__,x,y) - -# define _ETSM_ASSERT_LESS_THAN(f,l,m,x,y) ___ETS_ASSERT_LESS_THAN(f,l,x,y,TS_AS_STRING(m)) -# define _TSM_ASSERT_LESS_THAN(f,l,m,x,y) ___TS_ASSERT_LESS_THAN(f,l,x,y,TS_AS_STRING(m)) - -# define ETSM_ASSERT_LESS_THAN(m,x,y) _ETSM_ASSERT_LESS_THAN(__FILE__,__LINE__,m,x,y) -# define TSM_ASSERT_LESS_THAN(m,x,y) _TSM_ASSERT_LESS_THAN(__FILE__,__LINE__,m,x,y) - - // TS_ASSERT_LESS_THAN_EQUALS -# define ___ETS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,m) \ - CxxTest::doAssertLessThanEquals( (f), (l), #x, (x), #y, (y), (m) ) -# define ___TS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,m) \ - { _TS_TRY { ___ETS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,m); } __TS_CATCH(f,l) } - -# define _ETS_ASSERT_LESS_THAN_EQUALS(f,l,x,y) ___ETS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,0) -# define _TS_ASSERT_LESS_THAN_EQUALS(f,l,x,y) ___TS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,0) - -# define ETS_ASSERT_LESS_THAN_EQUALS(x,y) _ETS_ASSERT_LESS_THAN_EQUALS(__FILE__,__LINE__,x,y) -# define TS_ASSERT_LESS_THAN_EQUALS(x,y) _TS_ASSERT_LESS_THAN_EQUALS(__FILE__,__LINE__,x,y) - -# define _ETSM_ASSERT_LESS_THAN_EQUALS(f,l,m,x,y) ___ETS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,TS_AS_STRING(m)) -# define _TSM_ASSERT_LESS_THAN_EQUALS(f,l,m,x,y) ___TS_ASSERT_LESS_THAN_EQUALS(f,l,x,y,TS_AS_STRING(m)) - -# define ETSM_ASSERT_LESS_THAN_EQUALS(m,x,y) _ETSM_ASSERT_LESS_THAN_EQUALS(__FILE__,__LINE__,m,x,y) -# define TSM_ASSERT_LESS_THAN_EQUALS(m,x,y) _TSM_ASSERT_LESS_THAN_EQUALS(__FILE__,__LINE__,m,x,y) - - // TS_ASSERT_PREDICATE -# define ___ETS_ASSERT_PREDICATE(f,l,p,x,m) \ - CxxTest::doAssertPredicate( (f), (l), #p, p(), #x, (x), (m) ) -# define ___TS_ASSERT_PREDICATE(f,l,p,x,m) \ - { _TS_TRY { ___ETS_ASSERT_PREDICATE(f,l,p,x,m); } __TS_CATCH(f,l) } - -# define _ETS_ASSERT_PREDICATE(f,l,p,x) ___ETS_ASSERT_PREDICATE(f,l,p,x,0) -# define _TS_ASSERT_PREDICATE(f,l,p,x) ___TS_ASSERT_PREDICATE(f,l,p,x,0) - -# define ETS_ASSERT_PREDICATE(p,x) _ETS_ASSERT_PREDICATE(__FILE__,__LINE__,p,x) -# define TS_ASSERT_PREDICATE(p,x) _TS_ASSERT_PREDICATE(__FILE__,__LINE__,p,x) - -# define _ETSM_ASSERT_PREDICATE(f,l,m,p,x) ___ETS_ASSERT_PREDICATE(f,l,p,x,TS_AS_STRING(m)) -# define _TSM_ASSERT_PREDICATE(f,l,m,p,x) ___TS_ASSERT_PREDICATE(f,l,p,x,TS_AS_STRING(m)) - -# define ETSM_ASSERT_PREDICATE(m,p,x) _ETSM_ASSERT_PREDICATE(__FILE__,__LINE__,m,p,x) -# define TSM_ASSERT_PREDICATE(m,p,x) _TSM_ASSERT_PREDICATE(__FILE__,__LINE__,m,p,x) - - // TS_ASSERT_RELATION -# define ___ETS_ASSERT_RELATION(f,l,r,x,y,m) \ - CxxTest::doAssertRelation( (f), (l), #r, r(), #x, (x), #y, (y), (m) ) -# define ___TS_ASSERT_RELATION(f,l,r,x,y,m) \ - { _TS_TRY { ___ETS_ASSERT_RELATION(f,l,r,x,y,m); } __TS_CATCH(f,l) } - -# define _ETS_ASSERT_RELATION(f,l,r,x,y) ___ETS_ASSERT_RELATION(f,l,r,x,y,0) -# define _TS_ASSERT_RELATION(f,l,r,x,y) ___TS_ASSERT_RELATION(f,l,r,x,y,0) - -# define ETS_ASSERT_RELATION(r,x,y) _ETS_ASSERT_RELATION(__FILE__,__LINE__,r,x,y) -# define TS_ASSERT_RELATION(r,x,y) _TS_ASSERT_RELATION(__FILE__,__LINE__,r,x,y) - -# define _ETSM_ASSERT_RELATION(f,l,m,r,x,y) ___ETS_ASSERT_RELATION(f,l,r,x,y,TS_AS_STRING(m)) -# define _TSM_ASSERT_RELATION(f,l,m,r,x,y) ___TS_ASSERT_RELATION(f,l,r,x,y,TS_AS_STRING(m)) - -# define ETSM_ASSERT_RELATION(m,r,x,y) _ETSM_ASSERT_RELATION(__FILE__,__LINE__,m,r,x,y) -# define TSM_ASSERT_RELATION(m,r,x,y) _TSM_ASSERT_RELATION(__FILE__,__LINE__,m,r,x,y) - - // TS_ASSERT_DELTA -# define ___ETS_ASSERT_DELTA(f,l,x,y,d,m) CxxTest::doAssertDelta( (f), (l), #x, (x), #y, (y), #d, (d), (m) ) -# define ___TS_ASSERT_DELTA(f,l,x,y,d,m) { _TS_TRY { ___ETS_ASSERT_DELTA(f,l,x,y,d,m); } __TS_CATCH(f,l) } - -# define _ETS_ASSERT_DELTA(f,l,x,y,d) ___ETS_ASSERT_DELTA(f,l,x,y,d,0) -# define _TS_ASSERT_DELTA(f,l,x,y,d) ___TS_ASSERT_DELTA(f,l,x,y,d,0) - -# define ETS_ASSERT_DELTA(x,y,d) _ETS_ASSERT_DELTA(__FILE__,__LINE__,x,y,d) -# define TS_ASSERT_DELTA(x,y,d) _TS_ASSERT_DELTA(__FILE__,__LINE__,x,y,d) - -# define _ETSM_ASSERT_DELTA(f,l,m,x,y,d) ___ETS_ASSERT_DELTA(f,l,x,y,d,TS_AS_STRING(m)) -# define _TSM_ASSERT_DELTA(f,l,m,x,y,d) ___TS_ASSERT_DELTA(f,l,x,y,d,TS_AS_STRING(m)) - -# define ETSM_ASSERT_DELTA(m,x,y,d) _ETSM_ASSERT_DELTA(__FILE__,__LINE__,m,x,y,d) -# define TSM_ASSERT_DELTA(m,x,y,d) _TSM_ASSERT_DELTA(__FILE__,__LINE__,m,x,y,d) - - // TS_ASSERT_THROWS -# define ___TS_ASSERT_THROWS(f,l,e,t,m) { \ - bool _ts_threw_expected = false, _ts_threw_else = false; \ - _TS_TRY { e; } \ - _TS_CATCH_TYPE( (t), { _ts_threw_expected = true; } ) \ - _TS_CATCH_ABORT( { throw; } ) \ - _TS_LAST_CATCH( { _ts_threw_else = true; } ) \ - if ( !_ts_threw_expected ) { CxxTest::doFailAssertThrows( (f), (l), #e, #t, _ts_threw_else, (m) ); } } - -# define _TS_ASSERT_THROWS(f,l,e,t) ___TS_ASSERT_THROWS(f,l,e,t,0) -# define TS_ASSERT_THROWS(e,t) _TS_ASSERT_THROWS(__FILE__,__LINE__,e,t) - -# define _TSM_ASSERT_THROWS(f,l,m,e,t) ___TS_ASSERT_THROWS(f,l,e,t,TS_AS_STRING(m)) -# define TSM_ASSERT_THROWS(m,e,t) _TSM_ASSERT_THROWS(__FILE__,__LINE__,m,e,t) - - // TS_ASSERT_THROWS_ASSERT -# define ___TS_ASSERT_THROWS_ASSERT(f,l,e,t,a,m) { \ - bool _ts_threw_expected = false, _ts_threw_else = false; \ - _TS_TRY { e; } \ - _TS_CATCH_TYPE( (t), { a; _ts_threw_expected = true; } ) \ - _TS_CATCH_ABORT( { throw; } ) \ - _TS_LAST_CATCH( { _ts_threw_else = true; } ) \ - if ( !_ts_threw_expected ) { CxxTest::doFailAssertThrows( (f), (l), #e, #t, _ts_threw_else, (m) ); } } - -# define _TS_ASSERT_THROWS_ASSERT(f,l,e,t,a) ___TS_ASSERT_THROWS_ASSERT(f,l,e,t,a,0) -# define TS_ASSERT_THROWS_ASSERT(e,t,a) _TS_ASSERT_THROWS_ASSERT(__FILE__,__LINE__,e,t,a) - -# define _TSM_ASSERT_THROWS_ASSERT(f,l,m,e,t,a) ___TS_ASSERT_THROWS_ASSERT(f,l,e,t,a,TS_AS_STRING(m)) -# define TSM_ASSERT_THROWS_ASSERT(m,e,t,a) _TSM_ASSERT_THROWS_ASSERT(__FILE__,__LINE__,m,e,t,a) - - // TS_ASSERT_THROWS_EQUALS -# define TS_ASSERT_THROWS_EQUALS(e,t,x,y) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_EQUALS(x,y)) -# define TSM_ASSERT_THROWS_EQUALS(m,e,t,x,y) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_EQUALS(m,x,y)) - - // TS_ASSERT_THROWS_DIFFERS -# define TS_ASSERT_THROWS_DIFFERS(e,t,x,y) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_DIFFERS(x,y)) -# define TSM_ASSERT_THROWS_DIFFERS(m,e,t,x,y) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_DIFFERS(m,x,y)) - - // TS_ASSERT_THROWS_DELTA -# define TS_ASSERT_THROWS_DELTA(e,t,x,y,d) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_DELTA(x,y,d)) -# define TSM_ASSERT_THROWS_DELTA(m,e,t,x,y,d) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_DELTA(m,x,y,d)) - - // TS_ASSERT_THROWS_SAME_DATA -# define TS_ASSERT_THROWS_SAME_DATA(e,t,x,y,s) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_SAME_DATA(x,y,s)) -# define TSM_ASSERT_THROWS_SAME_DATA(m,e,t,x,y,s) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_SAME_DATA(m,x,y,s)) - - // TS_ASSERT_THROWS_LESS_THAN -# define TS_ASSERT_THROWS_LESS_THAN(e,t,x,y) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_LESS_THAN(x,y)) -# define TSM_ASSERT_THROWS_LESS_THAN(m,e,t,x,y) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_LESS_THAN(m,x,y)) - - // TS_ASSERT_THROWS_LESS_THAN_EQUALS -# define TS_ASSERT_THROWS_LESS_THAN_EQUALS(e,t,x,y) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_LESS_THAN_EQUALS(x,y)) -# define TSM_ASSERT_THROWS_LESS_THAN_EQUALS(m,e,t,x,y) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_LESS_THAN_EQUALS(m,x,y)) - - // TS_ASSERT_THROWS_PREDICATE -# define TS_ASSERT_THROWS_PREDICATE(e,t,p,v) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_PREDICATE(p,v)) -# define TSM_ASSERT_THROWS_PREDICATE(m,e,t,p,v) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_PREDICATE(m,p,v)) - - // TS_ASSERT_THROWS_RELATION -# define TS_ASSERT_THROWS_RELATION(e,t,r,x,y) TS_ASSERT_THROWS_ASSERT(e,t,TS_ASSERT_RELATION(r,x,y)) -# define TSM_ASSERT_THROWS_RELATION(m,e,t,r,x,y) TSM_ASSERT_THROWS_ASSERT(m,e,t,TSM_ASSERT_RELATION(m,r,x,y)) - - // TS_ASSERT_THROWS_ANYTHING -# define ___TS_ASSERT_THROWS_ANYTHING(f,l,e,m) { \ - bool _ts_threw = false; \ - _TS_TRY { e; } \ - _TS_LAST_CATCH( { _ts_threw = true; } ) \ - if ( !_ts_threw ) { CxxTest::doFailAssertThrows( (f), (l), #e, "...", false, (m) ); } } - -# define _TS_ASSERT_THROWS_ANYTHING(f,l,e) ___TS_ASSERT_THROWS_ANYTHING(f,l,e,0) -# define TS_ASSERT_THROWS_ANYTHING(e) _TS_ASSERT_THROWS_ANYTHING(__FILE__, __LINE__, e) - -# define _TSM_ASSERT_THROWS_ANYTHING(f,l,m,e) ___TS_ASSERT_THROWS_ANYTHING(f,l,e,TS_AS_STRING(m)) -# define TSM_ASSERT_THROWS_ANYTHING(m,e) _TSM_ASSERT_THROWS_ANYTHING(__FILE__,__LINE__,m,e) - - // TS_ASSERT_THROWS_NOTHING -# define ___TS_ASSERT_THROWS_NOTHING(f,l,e,m) { \ - _TS_TRY { e; } \ - _TS_CATCH_ABORT( { throw; } ) \ - _TS_LAST_CATCH( { CxxTest::doFailAssertThrowsNot( (f), (l), #e, (m) ); } ) } - -# define _TS_ASSERT_THROWS_NOTHING(f,l,e) ___TS_ASSERT_THROWS_NOTHING(f,l,e,0) -# define TS_ASSERT_THROWS_NOTHING(e) _TS_ASSERT_THROWS_NOTHING(__FILE__,__LINE__,e) - -# define _TSM_ASSERT_THROWS_NOTHING(f,l,m,e) ___TS_ASSERT_THROWS_NOTHING(f,l,e,TS_AS_STRING(m)) -# define TSM_ASSERT_THROWS_NOTHING(m,e) _TSM_ASSERT_THROWS_NOTHING(__FILE__,__LINE__,m,e) - - - // - // This takes care of "signed <-> unsigned" warnings - // -# define CXXTEST_COMPARISONS(CXXTEST_X, CXXTEST_Y, CXXTEST_T) \ - inline bool equals( CXXTEST_X x, CXXTEST_Y y ) { return (((CXXTEST_T)x) == ((CXXTEST_T)y)); } \ - inline bool equals( CXXTEST_Y y, CXXTEST_X x ) { return (((CXXTEST_T)y) == ((CXXTEST_T)x)); } \ - inline bool differs( CXXTEST_X x, CXXTEST_Y y ) { return (((CXXTEST_T)x) != ((CXXTEST_T)y)); } \ - inline bool differs( CXXTEST_Y y, CXXTEST_X x ) { return (((CXXTEST_T)y) != ((CXXTEST_T)x)); } \ - inline bool lessThan( CXXTEST_X x, CXXTEST_Y y ) { return (((CXXTEST_T)x) < ((CXXTEST_T)y)); } \ - inline bool lessThan( CXXTEST_Y y, CXXTEST_X x ) { return (((CXXTEST_T)y) < ((CXXTEST_T)x)); } \ - inline bool lessThanEquals( CXXTEST_X x, CXXTEST_Y y ) { return (((CXXTEST_T)x) <= ((CXXTEST_T)y)); } \ - inline bool lessThanEquals( CXXTEST_Y y, CXXTEST_X x ) { return (((CXXTEST_T)y) <= ((CXXTEST_T)x)); } - -# define CXXTEST_INTEGRAL(CXXTEST_T) \ - CXXTEST_COMPARISONS( signed CXXTEST_T, unsigned CXXTEST_T, unsigned CXXTEST_T ) - - CXXTEST_INTEGRAL( char ) - CXXTEST_INTEGRAL( short ) - CXXTEST_INTEGRAL( int ) - CXXTEST_INTEGRAL( long ) -# ifdef _CXXTEST_LONGLONG - CXXTEST_INTEGRAL( _CXXTEST_LONGLONG ) -# endif // _CXXTEST_LONGLONG - -# define CXXTEST_SMALL_BIG(CXXTEST_SMALL, CXXTEST_BIG) \ - CXXTEST_COMPARISONS( signed CXXTEST_SMALL, unsigned CXXTEST_BIG, unsigned CXXTEST_BIG ) \ - CXXTEST_COMPARISONS( signed CXXTEST_BIG, unsigned CXXTEST_SMALL, unsigned CXXTEST_BIG ) - - CXXTEST_SMALL_BIG( char, short ) - CXXTEST_SMALL_BIG( char, int ) - CXXTEST_SMALL_BIG( short, int ) - CXXTEST_SMALL_BIG( char, long ) - CXXTEST_SMALL_BIG( short, long ) - CXXTEST_SMALL_BIG( int, long ) - -# ifdef _CXXTEST_LONGLONG - CXXTEST_SMALL_BIG( char, _CXXTEST_LONGLONG ) - CXXTEST_SMALL_BIG( short, _CXXTEST_LONGLONG ) - CXXTEST_SMALL_BIG( int, _CXXTEST_LONGLONG ) - CXXTEST_SMALL_BIG( long, _CXXTEST_LONGLONG ) -# endif // _CXXTEST_LONGLONG -} - -#endif // __cxxtest__TestSuite_h__ diff --git a/test/cxxtest/TestTracker.cpp b/test/cxxtest/TestTracker.cpp deleted file mode 100644 index f1babcd8..00000000 --- a/test/cxxtest/TestTracker.cpp +++ /dev/null @@ -1,180 +0,0 @@ -#ifndef __cxxtest__TestTracker_cpp__ -#define __cxxtest__TestTracker_cpp__ - -#include - -namespace CxxTest { -bool TestTracker::_created = false; - -TestTracker::TestTracker() { - if (!_created) { - initialize(); - _created = true; - } -} - -TestTracker::~TestTracker() {} - -TestTracker &TestTracker::tracker() { - static TestTracker theTracker; - return theTracker; -} - -void TestTracker::initialize() { - _warnings = 0; - _failedTests = 0; - _testFailedAsserts = 0; - _suiteFailedTests = 0; - _failedSuites = 0; - setListener(0); - _world = 0; - _suite = 0; - _test = 0; -} - -const TestDescription *TestTracker::fixTest(const TestDescription *d) const { return d ? d : &dummyTest(); } - -const SuiteDescription *TestTracker::fixSuite(const SuiteDescription *d) const { return d ? d : &dummySuite(); } - -const WorldDescription *TestTracker::fixWorld(const WorldDescription *d) const { return d ? d : &dummyWorld(); } - -const TestDescription &TestTracker::dummyTest() const { return dummySuite().testDescription(0); } - -const SuiteDescription &TestTracker::dummySuite() const { return dummyWorld().suiteDescription(0); } - -const WorldDescription &TestTracker::dummyWorld() const { return _dummyWorld; } - -void TestTracker::setListener(TestListener *l) { _l = l ? l : &_dummyListener; } - -void TestTracker::enterWorld(const WorldDescription &wd) { - setWorld(&wd); - _warnings = _failedTests = _testFailedAsserts = _suiteFailedTests = _failedSuites = 0; - _l->enterWorld(wd); -} - -void TestTracker::enterSuite(const SuiteDescription &sd) { - setSuite(&sd); - _testFailedAsserts = _suiteFailedTests = 0; - _l->enterSuite(sd); -} - -void TestTracker::enterTest(const TestDescription &td) { - setTest(&td); - _testFailedAsserts = false; - _l->enterTest(td); -} - -void TestTracker::leaveTest(const TestDescription &td) { - _l->leaveTest(td); - setTest(0); -} - -void TestTracker::leaveSuite(const SuiteDescription &sd) { - _l->leaveSuite(sd); - setSuite(0); -} - -void TestTracker::leaveWorld(const WorldDescription &wd) { - _l->leaveWorld(wd); - setWorld(0); -} - -void TestTracker::trace(const char *file, unsigned line, const char *expression) { _l->trace(file, line, expression); } - -void TestTracker::warning(const char *file, unsigned line, const char *expression) { - countWarning(); - _l->warning(file, line, expression); -} - -void TestTracker::failedTest(const char *file, unsigned line, const char *expression) { - countFailure(); - _l->failedTest(file, line, expression); -} - -void TestTracker::failedAssert(const char *file, unsigned line, const char *expression) { - countFailure(); - _l->failedAssert(file, line, expression); -} - -void TestTracker::failedAssertEquals(const char *file, unsigned line, const char *xStr, const char *yStr, const char *x, - const char *y) { - countFailure(); - _l->failedAssertEquals(file, line, xStr, yStr, x, y); -} - -void TestTracker::failedAssertSameData(const char *file, unsigned line, const char *xStr, const char *yStr, - const char *sizeStr, const void *x, const void *y, unsigned size) { - countFailure(); - _l->failedAssertSameData(file, line, xStr, yStr, sizeStr, x, y, size); -} - -void TestTracker::failedAssertDelta(const char *file, unsigned line, const char *xStr, const char *yStr, - const char *dStr, const char *x, const char *y, const char *d) { - countFailure(); - _l->failedAssertDelta(file, line, xStr, yStr, dStr, x, y, d); -} - -void TestTracker::failedAssertDiffers(const char *file, unsigned line, const char *xStr, const char *yStr, - const char *value) { - countFailure(); - _l->failedAssertDiffers(file, line, xStr, yStr, value); -} - -void TestTracker::failedAssertLessThan(const char *file, unsigned line, const char *xStr, const char *yStr, - const char *x, const char *y) { - countFailure(); - _l->failedAssertLessThan(file, line, xStr, yStr, x, y); -} - -void TestTracker::failedAssertLessThanEquals(const char *file, unsigned line, const char *xStr, const char *yStr, - const char *x, const char *y) { - countFailure(); - _l->failedAssertLessThanEquals(file, line, xStr, yStr, x, y); -} - -void TestTracker::failedAssertPredicate(const char *file, unsigned line, const char *predicate, const char *xStr, - const char *x) { - countFailure(); - _l->failedAssertPredicate(file, line, predicate, xStr, x); -} - -void TestTracker::failedAssertRelation(const char *file, unsigned line, const char *relation, const char *xStr, - const char *yStr, const char *x, const char *y) { - countFailure(); - _l->failedAssertRelation(file, line, relation, xStr, yStr, x, y); -} - -void TestTracker::failedAssertThrows(const char *file, unsigned line, const char *expression, const char *type, - bool otherThrown) { - countFailure(); - _l->failedAssertThrows(file, line, expression, type, otherThrown); -} - -void TestTracker::failedAssertThrowsNot(const char *file, unsigned line, const char *expression) { - countFailure(); - _l->failedAssertThrowsNot(file, line, expression); -} - -void TestTracker::setWorld(const WorldDescription *w) { - _world = fixWorld(w); - setSuite(0); -} - -void TestTracker::setSuite(const SuiteDescription *s) { - _suite = fixSuite(s); - setTest(0); -} - -void TestTracker::setTest(const TestDescription *t) { _test = fixTest(t); } - -void TestTracker::countWarning() { ++_warnings; } - -void TestTracker::countFailure() { - if (++_testFailedAsserts == 1) { - ++_failedTests; - if (++_suiteFailedTests == 1) ++_failedSuites; - } -} -} // namespace CxxTest - -#endif // __cxxtest__TestTracker_cpp__ diff --git a/test/cxxtest/TestTracker.h b/test/cxxtest/TestTracker.h deleted file mode 100644 index 3f77ae41..00000000 --- a/test/cxxtest/TestTracker.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef __cxxtest__TestTracker_h__ -#define __cxxtest__TestTracker_h__ - -// -// The TestTracker tracks running tests -// The actual work is done in CountingListenerProxy, -// but this way avoids cyclic references TestListener<->CountingListenerProxy -// - -#include -#include - -namespace CxxTest -{ - class TestListener; - - class TestTracker : public TestListener - { - public: - virtual ~TestTracker(); - - static TestTracker &tracker(); - - const TestDescription *fixTest( const TestDescription *d ) const; - const SuiteDescription *fixSuite( const SuiteDescription *d ) const; - const WorldDescription *fixWorld( const WorldDescription *d ) const; - - const TestDescription &test() const { return *_test; } - const SuiteDescription &suite() const { return *_suite; } - const WorldDescription &world() const { return *_world; } - - bool testFailed() const { return (testFailedAsserts() > 0); } - bool suiteFailed() const { return (suiteFailedTests() > 0); } - bool worldFailed() const { return (failedSuites() > 0); } - - unsigned warnings() const { return _warnings; } - unsigned failedTests() const { return _failedTests; } - unsigned testFailedAsserts() const { return _testFailedAsserts; } - unsigned suiteFailedTests() const { return _suiteFailedTests; } - unsigned failedSuites() const { return _failedSuites; } - - void enterWorld( const WorldDescription &wd ); - void enterSuite( const SuiteDescription &sd ); - void enterTest( const TestDescription &td ); - void leaveTest( const TestDescription &td ); - void leaveSuite( const SuiteDescription &sd ); - void leaveWorld( const WorldDescription &wd ); - void trace( const char *file, unsigned line, const char *expression ); - void warning( const char *file, unsigned line, const char *expression ); - void failedTest( const char *file, unsigned line, const char *expression ); - void failedAssert( const char *file, unsigned line, const char *expression ); - void failedAssertEquals( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *x, const char *y ); - void failedAssertSameData( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *sizeStr, const void *x, - const void *y, unsigned size ); - void failedAssertDelta( const char *file, unsigned line, - const char *xStr, const char *yStr, const char *dStr, - const char *x, const char *y, const char *d ); - void failedAssertDiffers( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *value ); - void failedAssertLessThan( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *x, const char *y ); - void failedAssertLessThanEquals( const char *file, unsigned line, - const char *xStr, const char *yStr, - const char *x, const char *y ); - void failedAssertPredicate( const char *file, unsigned line, - const char *predicate, const char *xStr, const char *x ); - void failedAssertRelation( const char *file, unsigned line, - const char *relation, const char *xStr, const char *yStr, - const char *x, const char *y ); - void failedAssertThrows( const char *file, unsigned line, - const char *expression, const char *type, - bool otherThrown ); - void failedAssertThrowsNot( const char *file, unsigned line, const char *expression ); - - private: - TestTracker( const TestTracker & ); - TestTracker &operator=( const TestTracker & ); - - static bool _created; - TestListener _dummyListener; - DummyWorldDescription _dummyWorld; - unsigned _warnings, _failedTests, _testFailedAsserts, _suiteFailedTests, _failedSuites; - TestListener *_l; - const WorldDescription *_world; - const SuiteDescription *_suite; - const TestDescription *_test; - - const TestDescription &dummyTest() const; - const SuiteDescription &dummySuite() const; - const WorldDescription &dummyWorld() const; - - void setWorld( const WorldDescription *w ); - void setSuite( const SuiteDescription *s ); - void setTest( const TestDescription *t ); - void countWarning(); - void countFailure(); - - friend class TestRunner; - - TestTracker(); - void initialize(); - void setListener( TestListener *l ); - }; - - inline TestTracker &tracker() { return TestTracker::tracker(); } -} - -#endif // __cxxtest__TestTracker_h__ diff --git a/test/cxxtest/ValueTraits.cpp b/test/cxxtest/ValueTraits.cpp deleted file mode 100644 index af56f0f0..00000000 --- a/test/cxxtest/ValueTraits.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef __cxxtest__ValueTraits_cpp__ -#define __cxxtest__ValueTraits_cpp__ - -#include - -namespace CxxTest { -// -// Non-inline functions from ValueTraits.h -// - -char digitToChar(unsigned digit) { - if (digit < 10) return (char)('0' + digit); - if (digit <= 10 + 'Z' - 'A') return (char)('A' + digit - 10); - return '?'; -} - -const char *byteToHex(unsigned char byte) { - static char asHex[3]; - asHex[0] = digitToChar(byte >> 4); - asHex[1] = digitToChar(byte & 0x0F); - asHex[2] = '\0'; - return asHex; -} - -char *copyString(char *dst, const char *src) { - while ((*dst = *src) != '\0') { - ++dst; - ++src; - } - return dst; -} - -bool stringsEqual(const char *s1, const char *s2) { - char c; - while ((c = *s1++) == *s2++) - if (c == '\0') return true; - return false; -} - -char *charToString(unsigned long c, char *s) { - switch (c) { - case '\\': - return copyString(s, "\\\\"); - case '\"': - return copyString(s, "\\\""); - case '\'': - return copyString(s, "\\\'"); - case '\0': - return copyString(s, "\\0"); - case '\a': - return copyString(s, "\\a"); - case '\b': - return copyString(s, "\\b"); - case '\n': - return copyString(s, "\\n"); - case '\r': - return copyString(s, "\\r"); - case '\t': - return copyString(s, "\\t"); - } - if (c >= 32 && c <= 127) { - s[0] = (char)c; - s[1] = '\0'; - return s + 1; - } else { - s[0] = '\\'; - s[1] = 'x'; - if (c < 0x10) { - s[2] = '0'; - ++s; - } - return numberToString(c, s + 2, 16UL); - } -} - -char *charToString(char c, char *s) { return charToString((unsigned long)(unsigned char)c, s); } - -char *bytesToString(const unsigned char *bytes, unsigned numBytes, unsigned maxBytes, char *s) { - bool truncate = (numBytes > maxBytes); - if (truncate) numBytes = maxBytes; - - s = copyString(s, "{ "); - for (unsigned i = 0; i < numBytes; ++i, ++bytes) s = copyString(copyString(s, byteToHex(*bytes)), " "); - if (truncate) s = copyString(s, "..."); - return copyString(s, " }"); -} - -#ifndef CXXTEST_USER_VALUE_TRAITS -unsigned ValueTraits::requiredDigitsOnLeft(double t) { - unsigned digits = 1; - for (t = (t < 0.0) ? -t : t; t > 1.0; t /= BASE) ++digits; - return digits; -} - -char *ValueTraits::doNegative(double &t) { - if (t >= 0) return _asString; - _asString[0] = '-'; - t = -t; - return _asString + 1; -} - -void ValueTraits::hugeNumber(double t) { - char *s = doNegative(t); - s = doubleToString(t, s, 0, 1); - s = copyString(s, "."); - s = doubleToString(t, s, 1, DIGITS_ON_RIGHT); - s = copyString(s, "E"); - s = numberToString(requiredDigitsOnLeft(t) - 1, s); -} - -void ValueTraits::normalNumber(double t) { - char *s = doNegative(t); - s = doubleToString(t, s); - s = copyString(s, "."); - for (unsigned i = 0; i < DIGITS_ON_RIGHT; ++i) s = numberToString((unsigned)(t *= BASE) % BASE, s); -} - -char *ValueTraits::doubleToString(double t, char *s, unsigned skip, unsigned max) { - return numberToString(t, s, BASE, skip, max); -} -#endif // !CXXTEST_USER_VALUE_TRAITS -} // namespace CxxTest - -#endif // __cxxtest__ValueTraits_cpp__ diff --git a/test/cxxtest/ValueTraits.h b/test/cxxtest/ValueTraits.h deleted file mode 100644 index 31035e88..00000000 --- a/test/cxxtest/ValueTraits.h +++ /dev/null @@ -1,377 +0,0 @@ -#ifndef __cxxtest__ValueTraits_h__ -#define __cxxtest__ValueTraits_h__ - -// -// ValueTraits are used by CxxTest to convert arbitrary -// values used in TS_ASSERT_EQUALS() to a string representation. -// -// This header file contains value traits for builtin integral types. -// To declare value traits for new types you should instantiate the class -// ValueTraits. -// - -#include - -#ifdef _CXXTEST_OLD_TEMPLATE_SYNTAX -# define CXXTEST_TEMPLATE_INSTANTIATION -#else // !_CXXTEST_OLD_TEMPLATE_SYNTAX -# define CXXTEST_TEMPLATE_INSTANTIATION template<> -#endif // _CXXTEST_OLD_TEMPLATE_SYNTAX - -namespace CxxTest -{ - // - // This is how we use the value traits - // -# define TS_AS_STRING(x) CxxTest::traits(x).asString() - - // - // Char representation of a digit - // - char digitToChar( unsigned digit ); - - // - // Convert byte value to hex digits - // Returns pointer to internal buffer - // - const char *byteToHex( unsigned char byte ); - - // - // Convert byte values to string - // Returns one past the copied data - // - char *bytesToString( const unsigned char *bytes, unsigned numBytes, unsigned maxBytes, char *s ); - - // - // Copy a string. - // Returns one past the end of the destination string - // Remember -- we can't use the standard library! - // - char *copyString( char *dst, const char *src ); - - // - // Compare two strings. - // Remember -- we can't use the standard library! - // - bool stringsEqual( const char *s1, const char *s2 ); - - // - // Represent a character value as a string - // Returns one past the end of the string - // This will be the actual char if printable or '\xXXXX' otherwise - // - char *charToString( unsigned long c, char *s ); - - // - // Prevent problems with negative (signed char)s - // - char *charToString( char c, char *s ); - - // - // The default ValueTraits class dumps up to 8 bytes as hex values - // - template - class ValueTraits - { - enum { MAX_BYTES = 8 }; - char _asString[sizeof("{ ") + sizeof("XX ") * MAX_BYTES + sizeof("... }")]; - - public: - ValueTraits( const T &t ) { bytesToString( (const unsigned char *)&t, sizeof(T), MAX_BYTES, _asString ); } - const char *asString( void ) const { return _asString; } - }; - - // - // traits( T t ) - // Creates an object of type ValueTraits - // - template - inline ValueTraits traits( T t ) - { - return ValueTraits( t ); - } - - // - // You can duplicate the implementation of an existing ValueTraits - // -# define CXXTEST_COPY_TRAITS(CXXTEST_NEW_CLASS, CXXTEST_OLD_CLASS) \ - CXXTEST_TEMPLATE_INSTANTIATION \ - class ValueTraits< CXXTEST_NEW_CLASS > \ - { \ - ValueTraits< CXXTEST_OLD_CLASS > _old; \ - public: \ - ValueTraits( CXXTEST_NEW_CLASS n ) : _old( (CXXTEST_OLD_CLASS)n ) {} \ - const char *asString( void ) const { return _old.asString(); } \ - } - - // - // Certain compilers need separate declarations for T and const T - // -# ifdef _CXXTEST_NO_COPY_CONST -# define CXXTEST_COPY_CONST_TRAITS(CXXTEST_CLASS) -# else // !_CXXTEST_NO_COPY_CONST -# define CXXTEST_COPY_CONST_TRAITS(CXXTEST_CLASS) CXXTEST_COPY_TRAITS(CXXTEST_CLASS, const CXXTEST_CLASS) -# endif // _CXXTEST_NO_COPY_CONST - - // - // Avoid compiler warnings about unsigned types always >= 0 - // - template inline bool negative( N n ) { return n < 0; } - template inline N abs( N n ) { return negative(n) ? -n : n; } - -# define CXXTEST_NON_NEGATIVE(Type) \ - CXXTEST_TEMPLATE_INSTANTIATION \ - inline bool negative( Type ) { return false; } \ - CXXTEST_TEMPLATE_INSTANTIATION \ - inline Type abs( Type value ) { return value; } - - CXXTEST_NON_NEGATIVE( bool ) - CXXTEST_NON_NEGATIVE( unsigned char ) - CXXTEST_NON_NEGATIVE( unsigned short int ) - CXXTEST_NON_NEGATIVE( unsigned int ) - CXXTEST_NON_NEGATIVE( unsigned long int ) -# ifdef _CXXTEST_LONGLONG - CXXTEST_NON_NEGATIVE( unsigned _CXXTEST_LONGLONG ) -# endif // _CXXTEST_LONGLONG - - // - // Represent (integral) number as a string - // Returns one past the end of the string - // Remember -- we can't use the standard library! - // - template - char *numberToString( N n, char *s, - N base = 10, - unsigned skipDigits = 0, - unsigned maxDigits = (unsigned)-1 ) - { - if ( negative(n) ) { - *s++ = '-'; - n = abs(n); - } - - N digit = 1; - while ( digit <= (n / base) ) - digit *= base; - N digitValue; - for ( ; digit >= 1 && skipDigits; n -= digit * digitValue, digit /= base, -- skipDigits ) - digitValue = (unsigned)(n / digit); - for ( ; digit >= 1 && maxDigits; n -= digit * digitValue, digit /= base, -- maxDigits ) - *s++ = digitToChar( (unsigned)(digitValue = (unsigned)(n / digit)) ); - - *s = '\0'; - return s; - } - - // - // All the specific ValueTraits follow. - // You can #define CXXTEST_USER_VALUE_TRAITS if you don't want them - // - -#ifndef CXXTEST_USER_VALUE_TRAITS - // - // ValueTraits: const char * const & - // This is used for printing strings, as in TS_FAIL( "Message" ) - // - CXXTEST_TEMPLATE_INSTANTIATION - class ValueTraits - { - ValueTraits &operator=( const ValueTraits & ); - const char *_asString; - - public: - ValueTraits( const char * const &value ) : _asString( value ) {} - ValueTraits( const ValueTraits &other ) : _asString( other._asString ) {} - const char *asString( void ) const { return _asString; } - }; - - CXXTEST_COPY_TRAITS( const char *, const char * const & ); - CXXTEST_COPY_TRAITS( char *, const char * const & ); - - // - // ValueTraits: bool - // - CXXTEST_TEMPLATE_INSTANTIATION - class ValueTraits - { - bool _value; - - public: - ValueTraits( const bool value ) : _value( value ) {} - const char *asString( void ) const { return _value ? "true" : "false"; } - }; - - CXXTEST_COPY_CONST_TRAITS( bool ); - -# ifdef _CXXTEST_LONGLONG - // - // ValueTraits: signed long long - // - CXXTEST_TEMPLATE_INSTANTIATION - class ValueTraits - { - typedef _CXXTEST_LONGLONG T; - char _asString[2 + 3 * sizeof(T)]; - public: - ValueTraits( T t ) { numberToString( t, _asString ); } - const char *asString( void ) const { return _asString; } - }; - - CXXTEST_COPY_CONST_TRAITS( signed _CXXTEST_LONGLONG ); - - // - // ValueTraits: unsigned long long - // - CXXTEST_TEMPLATE_INSTANTIATION - class ValueTraits - { - typedef unsigned _CXXTEST_LONGLONG T; - char _asString[1 + 3 * sizeof(T)]; - public: - ValueTraits( T t ) { numberToString( t, _asString ); } - const char *asString( void ) const { return _asString; } - }; - - CXXTEST_COPY_CONST_TRAITS( unsigned _CXXTEST_LONGLONG ); -# endif // _CXXTEST_LONGLONG - - // - // ValueTraits: signed long - // - CXXTEST_TEMPLATE_INSTANTIATION - class ValueTraits - { - typedef signed long int T; - char _asString[2 + 3 * sizeof(T)]; - public: - ValueTraits( T t ) { numberToString( t, _asString ); } - const char *asString( void ) const { return _asString; } - }; - - CXXTEST_COPY_CONST_TRAITS( signed long int ); - - // - // ValueTraits: unsigned long - // - CXXTEST_TEMPLATE_INSTANTIATION - class ValueTraits - { - typedef unsigned long int T; - char _asString[1 + 3 * sizeof(T)]; - public: - ValueTraits( T t ) { numberToString( t, _asString ); } - const char *asString( void ) const { return _asString; } - }; - - CXXTEST_COPY_CONST_TRAITS( unsigned long int ); - - // - // All decimals are the same as the long version - // - - CXXTEST_COPY_TRAITS( const signed int, const signed long int ); - CXXTEST_COPY_TRAITS( const unsigned int, const unsigned long int ); - CXXTEST_COPY_TRAITS( const signed short int, const signed long int ); - CXXTEST_COPY_TRAITS( const unsigned short int, const unsigned long int ); - CXXTEST_COPY_TRAITS( const unsigned char, const unsigned long int ); - - CXXTEST_COPY_CONST_TRAITS( signed int ); - CXXTEST_COPY_CONST_TRAITS( unsigned int ); - CXXTEST_COPY_CONST_TRAITS( signed short int ); - CXXTEST_COPY_CONST_TRAITS( unsigned short int ); - CXXTEST_COPY_CONST_TRAITS( unsigned char ); - - // - // ValueTraits: char - // Returns 'x' for printable chars, '\x??' for others - // - CXXTEST_TEMPLATE_INSTANTIATION - class ValueTraits - { - char _asString[sizeof("'\\xXX'")]; - public: - ValueTraits( char c ) { copyString( charToString( c, copyString( _asString, "'" ) ), "'" ); } - const char *asString( void ) const { return _asString; } - }; - - CXXTEST_COPY_CONST_TRAITS( char ); - - // - // ValueTraits: signed char - // Same as char, some compilers need it - // - CXXTEST_COPY_TRAITS( const signed char, const char ); - CXXTEST_COPY_CONST_TRAITS( signed char ); - - // - // ValueTraits: double - // - CXXTEST_TEMPLATE_INSTANTIATION - class ValueTraits - { - public: - ValueTraits( double t ) - { - ( requiredDigitsOnLeft( t ) > MAX_DIGITS_ON_LEFT ) ? - hugeNumber( t ) : - normalNumber( t ); - } - - const char *asString( void ) const { return _asString; } - - private: - enum { MAX_DIGITS_ON_LEFT = 24, DIGITS_ON_RIGHT = 4, BASE = 10 }; - char _asString[1 + MAX_DIGITS_ON_LEFT + 1 + DIGITS_ON_RIGHT + 1]; - - static unsigned requiredDigitsOnLeft( double t ); - char *doNegative( double &t ); - void hugeNumber( double t ); - void normalNumber( double t ); - char *doubleToString( double t, char *s, unsigned skip = 0, unsigned max = (unsigned)-1 ); - }; - - CXXTEST_COPY_CONST_TRAITS( double ); - - // - // ValueTraits: float - // - CXXTEST_COPY_TRAITS( const float, const double ); - CXXTEST_COPY_CONST_TRAITS( float ); -#endif // !CXXTEST_USER_VALUE_TRAITS -} - -#ifdef _CXXTEST_HAVE_STD -# include -#endif // _CXXTEST_HAVE_STD - -// -// CXXTEST_ENUM_TRAITS -// -#define CXXTEST_ENUM_TRAITS( TYPE, VALUES ) \ - namespace CxxTest \ - { \ - CXXTEST_TEMPLATE_INSTANTIATION \ - class ValueTraits \ - { \ - TYPE _value; \ - char _fallback[sizeof("(" #TYPE ")") + 3 * sizeof(TYPE)]; \ - public: \ - ValueTraits( TYPE value ) { \ - _value = value; \ - numberToString( _value, copyString( _fallback, "(" #TYPE ")" ) ); \ - } \ - const char *asString( void ) const \ - { \ - switch ( _value ) \ - { \ - VALUES \ - default: return _fallback; \ - } \ - } \ - }; \ - } - -#define CXXTEST_ENUM_MEMBER( MEMBER ) \ - case MEMBER: return #MEMBER; - -#endif // __cxxtest__ValueTraits_h__ diff --git a/test/cxxtest/Win32Gui.h b/test/cxxtest/Win32Gui.h deleted file mode 100644 index 6b3e7583..00000000 --- a/test/cxxtest/Win32Gui.h +++ /dev/null @@ -1,531 +0,0 @@ -#ifndef __cxxtest__Win32Gui_h__ -#define __cxxtest__Win32Gui_h__ - -// -// The Win32Gui displays a simple progress bar using the Win32 API. -// -// It accepts the following command line options: -// -minimized Start minimized, pop up on error -// -keep Don't close the window at the end -// -title TITLE Set the window caption -// -// If both -minimized and -keep are specified, GUI will only keep the -// window if it's in focus. -// -// N.B. If you're wondering why this class doesn't use any standard -// library or STL ( would have been nice) it's because it only -// uses "straight" Win32 API. -// - -#include - -#include -#include - -namespace CxxTest -{ - class Win32Gui : public GuiListener - { - public: - void enterGui( int &argc, char **argv ) - { - parseCommandLine( argc, argv ); - } - - void enterWorld( const WorldDescription &wd ) - { - getTotalTests( wd ); - _testsDone = 0; - startGuiThread(); - } - - void guiEnterSuite( const char *suiteName ) - { - showSuiteName( suiteName ); - reset( _suiteStart ); - } - - void guiEnterTest( const char *suiteName, const char *testName ) - { - ++ _testsDone; - setTestCaption( suiteName, testName ); - showTestName( testName ); - showTestsDone(); - progressBarMessage( PBM_STEPIT ); - reset( _testStart ); - } - - void yellowBar() - { - setColor( 255, 255, 0 ); - setIcon( IDI_WARNING ); - getTotalTests(); - } - - void redBar() - { - if ( _startMinimized ) - showMainWindow( SW_SHOWNORMAL ); - setColor( 255, 0, 0 ); - setIcon( IDI_ERROR ); - getTotalTests(); - } - - void leaveGui() - { - if ( keep() ) - { - showSummary(); - WaitForSingleObject( _gui, INFINITE ); - } - DestroyWindow( _mainWindow ); - } - - private: - const char *_title; - bool _startMinimized, _keep; - HANDLE _gui; - WNDCLASSEX _windowClass; - HWND _mainWindow, _progressBar, _statusBar; - HANDLE _canStartTests; - unsigned _numTotalTests, _testsDone; - char _strTotalTests[WorldDescription::MAX_STRLEN_TOTAL_TESTS]; - enum { - STATUS_SUITE_NAME, STATUS_SUITE_TIME, - STATUS_TEST_NAME, STATUS_TEST_TIME, - STATUS_TESTS_DONE, STATUS_WORLD_TIME, - STATUS_TOTAL_PARTS - }; - int _statusWidths[STATUS_TOTAL_PARTS]; - unsigned _statusOffsets[STATUS_TOTAL_PARTS]; - unsigned _statusTotal; - char _statusTestsDone[sizeof("1000000000 of (100%)") + WorldDescription::MAX_STRLEN_TOTAL_TESTS]; - DWORD _worldStart, _suiteStart, _testStart; - char _timeString[sizeof("00:00:00")]; - - void parseCommandLine( int argc, char **argv ) - { - _startMinimized = _keep = false; - _title = argv[0]; - - for ( int i = 1; i < argc; ++ i ) - { - if ( !lstrcmpA( argv[i], "-minimized" ) ) - _startMinimized = true; - else if ( !lstrcmpA( argv[i], "-keep" ) ) - _keep = true; - else if ( !lstrcmpA( argv[i], "-title" ) && (i + 1 < argc) ) - _title = argv[++i]; - } - } - - void getTotalTests() - { - getTotalTests( tracker().world() ); - } - - void getTotalTests( const WorldDescription &wd ) - { - _numTotalTests = wd.numTotalTests(); - wd.strTotalTests( _strTotalTests ); - } - - void startGuiThread() - { - _canStartTests = CreateEvent( NULL, TRUE, FALSE, NULL ); - DWORD threadId; - _gui = CreateThread( NULL, 0, &(Win32Gui::guiThread), (LPVOID)this, 0, &threadId ); - WaitForSingleObject( _canStartTests, INFINITE ); - } - - static DWORD WINAPI guiThread( LPVOID parameter ) - { - ((Win32Gui *)parameter)->gui(); - return 0; - } - - void gui() - { - registerWindowClass(); - createMainWindow(); - initCommonControls(); - createProgressBar(); - createStatusBar(); - centerMainWindow(); - showMainWindow(); - startTimer(); - startTests(); - - messageLoop(); - } - - void registerWindowClass() - { - _windowClass.cbSize = sizeof(_windowClass); - _windowClass.style = CS_HREDRAW | CS_VREDRAW; - _windowClass.lpfnWndProc = &(Win32Gui::windowProcedure); - _windowClass.cbClsExtra = 0; - _windowClass.cbWndExtra = sizeof(LONG); - _windowClass.hInstance = (HINSTANCE)NULL; - _windowClass.hIcon = (HICON)NULL; - _windowClass.hCursor = (HCURSOR)NULL; - _windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); - _windowClass.lpszMenuName = NULL; - _windowClass.lpszClassName = TEXT("CxxTest Window Class"); - _windowClass.hIconSm = (HICON)NULL; - - RegisterClassEx( &_windowClass ); - } - - void createMainWindow() - { - _mainWindow = createWindow( _windowClass.lpszClassName, WS_OVERLAPPEDWINDOW ); - } - - void initCommonControls() - { - HMODULE dll = LoadLibraryA( "comctl32.dll" ); - if ( !dll ) - return; - - typedef void (WINAPI *FUNC)( void ); - FUNC func = (FUNC)GetProcAddress( dll, "InitCommonControls" ); - if ( !func ) - return; - - func(); - } - - void createProgressBar() - { - _progressBar = createWindow( PROGRESS_CLASS, WS_CHILD | WS_VISIBLE | PBS_SMOOTH, _mainWindow ); - -#ifdef PBM_SETRANGE32 - progressBarMessage( PBM_SETRANGE32, 0, _numTotalTests ); -#else // No PBM_SETRANGE32, use PBM_SETRANGE - progressBarMessage( PBM_SETRANGE, 0, MAKELPARAM( 0, (WORD)_numTotalTests ) ); -#endif // PBM_SETRANGE32 - progressBarMessage( PBM_SETPOS, 0 ); - progressBarMessage( PBM_SETSTEP, 1 ); - greenBar(); - UpdateWindow( _progressBar ); - } - - void createStatusBar() - { - _statusBar = createWindow( STATUSCLASSNAME, WS_CHILD | WS_VISIBLE, _mainWindow ); - setRatios( 4, 1, 3, 1, 3, 1 ); - } - - void setRatios( unsigned suiteNameRatio, unsigned suiteTimeRatio, - unsigned testNameRatio, unsigned testTimeRatio, - unsigned testsDoneRatio, unsigned worldTimeRatio ) - { - _statusTotal = 0; - _statusOffsets[STATUS_SUITE_NAME] = (_statusTotal += suiteNameRatio); - _statusOffsets[STATUS_SUITE_TIME] = (_statusTotal += suiteTimeRatio); - _statusOffsets[STATUS_TEST_NAME] = (_statusTotal += testNameRatio); - _statusOffsets[STATUS_TEST_TIME] = (_statusTotal += testTimeRatio); - _statusOffsets[STATUS_TESTS_DONE] = (_statusTotal += testsDoneRatio); - _statusOffsets[STATUS_WORLD_TIME] = (_statusTotal += worldTimeRatio); - } - - HWND createWindow( LPCTSTR className, DWORD style, HWND parent = (HWND)NULL ) - { - return CreateWindow( className, NULL, style, 0, 0, 0, 0, parent, - (HMENU)NULL, (HINSTANCE)NULL, (LPVOID)this ); - } - - void progressBarMessage( UINT message, WPARAM wParam = 0, LPARAM lParam = 0 ) - { - SendMessage( _progressBar, message, wParam, lParam ); - } - - void centerMainWindow() - { - RECT screen; - getScreenArea( screen ); - - LONG screenWidth = screen.right - screen.left; - LONG screenHeight = screen.bottom - screen.top; - - LONG xCenter = (screen.right + screen.left) / 2; - LONG yCenter = (screen.bottom + screen.top) / 2; - - LONG windowWidth = (screenWidth * 4) / 5; - LONG windowHeight = screenHeight / 10; - LONG minimumHeight = 2 * (GetSystemMetrics( SM_CYCAPTION ) + GetSystemMetrics( SM_CYFRAME )); - if ( windowHeight < minimumHeight ) - windowHeight = minimumHeight; - - SetWindowPos( _mainWindow, HWND_TOP, - xCenter - (windowWidth / 2), yCenter - (windowHeight / 2), - windowWidth, windowHeight, 0 ); - } - - void getScreenArea( RECT &area ) - { - if ( !getScreenAreaWithoutTaskbar( area ) ) - getWholeScreenArea( area ); - } - - bool getScreenAreaWithoutTaskbar( RECT &area ) - { - return (SystemParametersInfo( SPI_GETWORKAREA, sizeof(RECT), &area, 0 ) != 0); - } - - void getWholeScreenArea( RECT &area ) - { - area.left = area.top = 0; - area.right = GetSystemMetrics( SM_CXSCREEN ); - area.bottom = GetSystemMetrics( SM_CYSCREEN ); - } - - void showMainWindow() - { - showMainWindow( _startMinimized ? SW_MINIMIZE : SW_SHOWNORMAL ); - UpdateWindow( _mainWindow ); - } - - void showMainWindow( int mode ) - { - ShowWindow( _mainWindow, mode ); - } - - enum { TIMER_ID = 1, TIMER_DELAY = 1000 }; - - void startTimer() - { - reset( _worldStart ); - reset( _suiteStart ); - reset( _testStart ); - SetTimer( _mainWindow, TIMER_ID, TIMER_DELAY, 0 ); - } - - void reset( DWORD &tick ) - { - tick = GetTickCount(); - } - - void startTests() - { - SetEvent( _canStartTests ); - } - - void messageLoop() - { - MSG message; - while ( BOOL haveMessage = GetMessage( &message, NULL, 0, 0 ) ) - if ( haveMessage != -1 ) - DispatchMessage( &message ); - } - - static LRESULT CALLBACK windowProcedure( HWND window, UINT message, WPARAM wParam, LPARAM lParam ) - { - if ( message == WM_CREATE ) - setUp( window, (LPCREATESTRUCT)lParam ); - - Win32Gui *that = (Win32Gui *)GetWindowLong( window, GWL_USERDATA ); - return that->handle( window, message, wParam, lParam ); - } - - static void setUp( HWND window, LPCREATESTRUCT create ) - { - SetWindowLong( window, GWL_USERDATA, (LONG)create->lpCreateParams ); - } - - LRESULT handle( HWND window, UINT message, WPARAM wParam, LPARAM lParam ) - { - switch ( message ) - { - case WM_SIZE: resizeControls(); break; - - case WM_TIMER: updateTime(); break; - - case WM_CLOSE: - case WM_DESTROY: - case WM_QUIT: - ExitProcess( 0 ); - - default: return DefWindowProc( window, message, wParam, lParam ); - } - return 0; - } - - void resizeControls() - { - RECT r; - GetClientRect( _mainWindow, &r ); - LONG width = r.right - r.left; - LONG height = r.bottom - r.top; - - GetClientRect( _statusBar, &r ); - LONG statusHeight = r.bottom - r.top; - LONG resizeGripWidth = statusHeight; - LONG progressHeight = height - statusHeight; - - SetWindowPos( _progressBar, HWND_TOP, 0, 0, width, progressHeight, 0 ); - SetWindowPos( _statusBar, HWND_TOP, 0, progressHeight, width, statusHeight, 0 ); - setStatusParts( width - resizeGripWidth ); - } - - void setStatusParts( LONG width ) - { - for ( unsigned i = 0; i < STATUS_TOTAL_PARTS; ++ i ) - _statusWidths[i] = (width * _statusOffsets[i]) / _statusTotal; - - statusBarMessage( SB_SETPARTS, STATUS_TOTAL_PARTS, _statusWidths ); - } - - void statusBarMessage( UINT message, WPARAM wParam = 0, const void *lParam = 0 ) - { - SendMessage( _statusBar, message, wParam, (LPARAM)lParam ); - } - - void greenBar() - { - setColor( 0, 255, 0 ); - setIcon( IDI_INFORMATION ); - } - -#ifdef PBM_SETBARCOLOR - void setColor( BYTE red, BYTE green, BYTE blue ) - { - progressBarMessage( PBM_SETBARCOLOR, 0, RGB( red, green, blue ) ); - } -#else // !PBM_SETBARCOLOR - void setColor( BYTE, BYTE, BYTE ) - { - } -#endif // PBM_SETBARCOLOR - - void setIcon( LPCTSTR icon ) - { - SendMessage( _mainWindow, WM_SETICON, ICON_BIG, (LPARAM)loadStandardIcon( icon ) ); - } - - HICON loadStandardIcon( LPCTSTR icon ) - { - return LoadIcon( (HINSTANCE)NULL, icon ); - } - - void setTestCaption( const char *suiteName, const char *testName ) - { - setCaption( suiteName, "::", testName, "()" ); - } - - void setCaption( const char *a = "", const char *b = "", const char *c = "", const char *d = "" ) - { - unsigned length = lstrlenA( _title ) + sizeof( " - " ) + - lstrlenA( a ) + lstrlenA( b ) + lstrlenA( c ) + lstrlenA( d ); - char *name = allocate( length ); - lstrcpyA( name, _title ); - lstrcatA( name, " - " ); - lstrcatA( name, a ); - lstrcatA( name, b ); - lstrcatA( name, c ); - lstrcatA( name, d ); - SetWindowTextA( _mainWindow, name ); - deallocate( name ); - } - - void showSuiteName( const char *suiteName ) - { - setStatusPart( STATUS_SUITE_NAME, suiteName ); - } - - void showTestName( const char *testName ) - { - setStatusPart( STATUS_TEST_NAME, testName ); - } - - void showTestsDone() - { - wsprintfA( _statusTestsDone, "%u of %s (%u%%)", - _testsDone, _strTotalTests, - (_testsDone * 100) / _numTotalTests ); - setStatusPart( STATUS_TESTS_DONE, _statusTestsDone ); - } - - void updateTime() - { - setStatusTime( STATUS_WORLD_TIME, _worldStart ); - setStatusTime( STATUS_SUITE_TIME, _suiteStart ); - setStatusTime( STATUS_TEST_TIME, _testStart ); - } - - void setStatusTime( unsigned part, DWORD start ) - { - unsigned total = (GetTickCount() - start) / 1000; - unsigned hours = total / 3600; - unsigned minutes = (total / 60) % 60; - unsigned seconds = total % 60; - - if ( hours ) - wsprintfA( _timeString, "%u:%02u:%02u", hours, minutes, seconds ); - else - wsprintfA( _timeString, "%02u:%02u", minutes, seconds ); - - setStatusPart( part, _timeString ); - } - - bool keep() - { - if ( !_keep ) - return false; - if ( !_startMinimized ) - return true; - return (_mainWindow == GetForegroundWindow()); - } - - void showSummary() - { - stopTimer(); - setSummaryStatusBar(); - setSummaryCaption(); - } - - void setStatusPart( unsigned part, const char *text ) - { - statusBarMessage( SB_SETTEXTA, part, text ); - } - - void stopTimer() - { - KillTimer( _mainWindow, TIMER_ID ); - setStatusTime( STATUS_WORLD_TIME, _worldStart ); - } - - void setSummaryStatusBar() - { - setRatios( 0, 0, 0, 0, 1, 1 ); - resizeControls(); - - const char *tests = (_numTotalTests == 1) ? "test" : "tests"; - if ( tracker().failedTests() ) - wsprintfA( _statusTestsDone, "Failed %u of %s %s", - tracker().failedTests(), _strTotalTests, tests ); - else - wsprintfA( _statusTestsDone, "%s %s passed", _strTotalTests, tests ); - - setStatusPart( STATUS_TESTS_DONE, _statusTestsDone ); - } - - void setSummaryCaption() - { - setCaption( _statusTestsDone ); - } - - char *allocate( unsigned length ) - { - return (char *)HeapAlloc( GetProcessHeap(), 0, length ); - } - - void deallocate( char *data ) - { - HeapFree( GetProcessHeap(), 0, data ); - } - }; -}; - -#endif // __cxxtest__Win32Gui_h__ diff --git a/test/cxxtest/X11Gui.h b/test/cxxtest/X11Gui.h deleted file mode 100644 index f14431d9..00000000 --- a/test/cxxtest/X11Gui.h +++ /dev/null @@ -1,327 +0,0 @@ -#ifndef __cxxtest__X11Gui_h__ -#define __cxxtest__X11Gui_h__ - -// -// X11Gui displays a simple progress bar using X11 -// -// It accepts the following command-line arguments: -// -title - Sets the application title -// -fn or -font <font> - Sets the font -// -bg or -background <color> - Sets the background color (default=Grey) -// -fg or -foreground <color> - Sets the text color (default=Black) -// -green/-yellow/-red <color> - Sets the colors of the bar -// - -#include <cxxtest/Gui.h> - -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -namespace CxxTest -{ - class X11Gui : public GuiListener - { - public: - void enterGui( int &argc, char **argv ) - { - parseCommandLine( argc, argv ); - } - - void enterWorld( const WorldDescription &wd ) - { - openDisplay(); - if ( _display ) { - createColors(); - createWindow(); - createGc(); - createFont(); - centerWindow(); - initializeEvents(); - initializeBar( wd ); - processEvents(); - } - } - - void guiEnterTest( const char *suiteName, const char *testName ) - { - if ( _display ) { - ++ _testsDone; - setWindowName( suiteName, testName ); - redraw(); - } - } - - void yellowBar() - { - if ( _display ) { - _barColor = getColor( _yellowName ); - getTotalTests(); - processEvents(); - } - } - - void redBar() - { - if ( _display ) { - _barColor = getColor( _redName ); - getTotalTests(); - processEvents(); - } - } - - void leaveGui() - { - if ( _display ) { - freeFontInfo(); - destroyGc(); - destroyWindow(); - closeDisplay(); - } - } - - private: - const char *_programName; - Display *_display; - Window _window; - unsigned _numTotalTests, _testsDone; - char _strTotalTests[WorldDescription::MAX_STRLEN_TOTAL_TESTS]; - const char *_foregroundName, *_backgroundName; - const char *_greenName, *_yellowName, *_redName; - unsigned long _foreground, _background, _barColor; - int _width, _height; - GC _gc; - const char *_fontName; - XID _fontId; - XFontStruct *_fontInfo; - int _textHeight, _textDescent; - long _eventMask; - Colormap _colormap; - - void parseCommandLine( int &argc, char **argv ) - { - _programName = argv[0]; - - _fontName = 0; - _foregroundName = "Black"; - _backgroundName = "Grey"; - _greenName = "Green"; - _yellowName = "Yellow"; - _redName = "Red"; - - for ( int i = 1; i + 1 < argc; ++ i ) { - if ( !strcmp( argv[i], "-title" ) ) - _programName = argv[++ i]; - else if ( !strcmp( argv[i], "-fn" ) || !strcmp( argv[i], "-font" ) ) - _fontName = argv[++ i]; - else if ( !strcmp( argv[i], "-fg" ) || !strcmp( argv[i], "-foreground" ) ) - _foregroundName = argv[++ i]; - else if ( !strcmp( argv[i], "-bg" ) || !strcmp( argv[i], "-background" ) ) - _backgroundName = argv[++ i]; - else if ( !strcmp( argv[i], "-green" ) ) - _greenName = argv[++ i]; - else if ( !strcmp( argv[i], "-yellow" ) ) - _yellowName = argv[++ i]; - else if ( !strcmp( argv[i], "-red" ) ) - _redName = argv[++ i]; - } - } - - void openDisplay() - { - _display = XOpenDisplay( NULL ); - } - - void createColors() - { - _colormap = DefaultColormap( _display, 0 ); - _foreground = getColor( _foregroundName ); - _background = getColor( _backgroundName ); - } - - unsigned long getColor( const char *colorName ) - { - XColor color; - XParseColor( _display, _colormap, colorName, &color ); - XAllocColor( _display, _colormap, &color ); - return color.pixel; - } - - void createWindow() - { - _window = XCreateSimpleWindow( _display, RootWindow( _display, 0 ), 0, 0, 1, 1, 0, 0, _background ); - } - - void createGc() - { - _gc = XCreateGC( _display, _window, 0, 0 ); - } - - void createFont() - { - if ( !loadFont() ) - useDefaultFont(); - getFontInfo(); - _textHeight = _fontInfo->ascent + _fontInfo->descent; - _textDescent = _fontInfo->descent; - } - - bool loadFont() - { - if ( !_fontName ) - return false; - _fontId = XLoadFont( _display, _fontName ); - return (XSetFont( _display, _gc, _fontId ) == Success); - } - - void useDefaultFont() - { - _fontId = XGContextFromGC( _gc ); - } - - void getFontInfo() - { - _fontInfo = XQueryFont( _display, _fontId ); - } - - void freeFontInfo() - { - XFreeFontInfo( NULL, _fontInfo, 1 ); - } - - void initializeEvents() - { - _eventMask = ExposureMask; - XSelectInput( _display, _window, _eventMask ); - } - - void initializeBar( const WorldDescription &wd ) - { - getTotalTests( wd ); - _testsDone = 0; - _barColor = getColor( _greenName ); - } - - void getTotalTests() - { - getTotalTests( tracker().world() ); - } - - void getTotalTests( const WorldDescription &wd ) - { - _numTotalTests = wd.numTotalTests(); - wd.strTotalTests( _strTotalTests ); - } - - void centerWindow() - { - XMapWindow( _display, _window ); - - Screen *screen = XDefaultScreenOfDisplay( _display ); - int screenWidth = WidthOfScreen( screen ); - int screenHeight = HeightOfScreen( screen ); - int xCenter = screenWidth / 2; - int yCenter = screenHeight / 2; - - _width = (screenWidth * 4) / 5; - _height = screenHeight / 14; - - XMoveResizeWindow( _display, _window, xCenter - (_width / 2), yCenter - (_height / 2), _width, _height ); - } - - void processEvents() - { - redraw(); - - XEvent event; - while( XCheckMaskEvent( _display, _eventMask, &event ) ) - redraw(); - } - - void setWindowName( const char *suiteName, const char *testName ) - { - unsigned length = strlen( _programName ) + strlen( suiteName ) + strlen( testName ) + sizeof( " - ::()" ); - char *name = (char *)malloc( length ); - sprintf( name, "%s - %s::%s()", _programName, suiteName, testName ); - XSetStandardProperties( _display, _window, name, 0, 0, 0, 0, 0 ); - free( name ); - } - - void redraw() - { - getWindowSize(); - drawSolidBar(); - drawDividers(); - drawPercentage(); - flush(); - } - - void getWindowSize() - { - XWindowAttributes attributes; - XGetWindowAttributes( _display, _window, &attributes ); - _width = attributes.width; - _height = attributes.height; - } - - void drawSolidBar() - { - unsigned barWidth = (_width * _testsDone) / _numTotalTests; - - XSetForeground( _display, _gc, _barColor ); - XFillRectangle( _display, _window, _gc, 0, 0, barWidth, _height ); - - XSetForeground( _display, _gc, _background ); - XFillRectangle( _display, _window, _gc, barWidth, 0, _width + 1 - barWidth, _height ); - } - - void drawDividers() - { - if(_width / _numTotalTests < 5) - return; - for ( unsigned i = 1; i < _testsDone; ++ i ) { - int x = (_width * i) / _numTotalTests; - XDrawLine( _display, _window, _gc, x, 0, x, _height); - } - } - - void drawPercentage() - { - XSetForeground( _display, _gc, _foreground ); - - char str[sizeof("1000000000 of ") + sizeof(_strTotalTests) + sizeof(" (100%)")]; - sprintf( str, "%u of %s (%u%%)", _testsDone, _strTotalTests, (_testsDone * 100) / _numTotalTests ); - unsigned len = strlen( str ); - - int textWidth = XTextWidth( _fontInfo, str, len ); - - XDrawString( _display, _window, _gc, - (_width - textWidth) / 2, ((_height + _textHeight) / 2) - _textDescent, - str, len ); - } - - void flush() - { - XFlush( _display ); - } - - void destroyGc() - { - XFreeGC( _display, _gc ); - } - - void destroyWindow() - { - XDestroyWindow( _display, _window ); - } - - void closeDisplay() - { - XCloseDisplay( _display ); - } - }; -}; - -#endif //__cxxtest__X11Gui_h__ diff --git a/test/cxxtest/YesNoRunner.h b/test/cxxtest/YesNoRunner.h deleted file mode 100644 index e7b83b6b..00000000 --- a/test/cxxtest/YesNoRunner.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef __cxxtest__YesNoRunner_h__ -#define __cxxtest__YesNoRunner_h__ - -// -// The YesNoRunner is a simple TestListener that -// just returns true iff all tests passed. -// - -#include <cxxtest/TestRunner.h> -#include <cxxtest/TestListener.h> - -namespace CxxTest -{ - class YesNoRunner : public TestListener - { - public: - YesNoRunner() - { - } - - int run() - { - TestRunner::runAllTests( *this ); - return tracker().failedTests(); - } - }; -} - -#endif // __cxxtest__YesNoRunner_h__ diff --git a/test/cxxtestgen.pl b/test/cxxtestgen.pl deleted file mode 100755 index 378b0a38..00000000 --- a/test/cxxtestgen.pl +++ /dev/null @@ -1,551 +0,0 @@ -#!/usr/bin/perl -w -use strict; -use Getopt::Long; - -sub usage() { - print STDERR "Usage: $0 [OPTIONS] <input file(s)>\n"; - print STDERR "Generate test source file for CxxTest.\n"; - print STDERR "\n"; - print STDERR " -v, --version Write CxxTest version\n"; - print STDERR " -o, --output=NAME Write output to file NAME\n"; - print STDERR " --runner=CLASS Create a main() function that runs CxxTest::CLASS\n"; - print STDERR " --gui=CLASS Like --runner, with GUI component\n"; - print STDERR " --error-printer Same as --runner=ErrorPrinter\n"; - print STDERR " --abort-on-fail Abort tests on failed asserts (like xUnit)\n"; - print STDERR " --have-std Use standard library (even if not found in tests)\n"; - print STDERR " --no-std Don't use standard library (even if found in tests)\n"; - print STDERR " --have-eh Use exception handling (even if not found in tests)\n"; - print STDERR " --no-eh Don't use exception handling (even if found in tests)\n"; - print STDERR " --longlong=[TYPE] Use TYPE as `long long' (defaut = long long)\n"; - print STDERR " --template=TEMPLATE Use TEMPLATE file to generate the test runner\n"; - print STDERR " --include=HEADER Include \"HEADER\" in test runner before other headers\n"; - print STDERR " --root Write CxxTest globals\n"; - print STDERR " --part Don't write CxxTest globals\n"; - print STDERR " --no-static-init Don't rely on static initialization\n"; - exit -1; -} - -main(); - -sub main { - parseCommandline(); - scanInputFiles(); - writeOutput(); -} - -# -# Handling the command line -# - -my ($output, $runner, $gui, $template, $abortOnFail, $haveEh, $noEh, $haveStd, $noStd); -my ($root, $part, $noStaticInit, $longlong, $factor); -my @headers = (); - -sub parseCommandline() { - @ARGV = expandWildcards(@ARGV); - GetOptions( 'version' => \&printVersion, - 'output=s' => \$output, - 'template=s' => \$template, - 'runner=s' => \$runner, - 'gui=s', => \$gui, - 'error-printer' => sub { $runner = 'ErrorPrinter'; $haveStd = 1; }, - 'abort-on-fail' => \$abortOnFail, - 'have-eh' => \$haveEh, - 'no-eh' => \$noEh, - 'have-std' => \$haveStd, - 'no-std' => \$noStd, - 'include=s' => \@headers, - 'root' => \$root, - 'part' => \$part, - 'no-static-init' => \$noStaticInit, - 'factor' => \$factor, - 'longlong:s' => \$longlong - ) or usage(); - scalar @ARGV or $root or usage(); - - if ( defined($noStaticInit) && (defined($root) || defined($part)) ) { - die "--no-static-init cannot be used with --root/--part\n"; - } - - if ( $gui && !$runner ) { - $runner = 'StdioPrinter'; - } - - if ( defined($longlong) && !$longlong ) { - $longlong = 'long long'; - } - - foreach my $header (@headers) { - if ( !($header =~ m/^["<].*[>"]$/) ) { - $header = "\"$header\""; - } - } -} - -sub printVersion() { - print "This is CxxTest version 3.10.1.\n"; - exit 0; -} - -sub expandWildcards() { - my @result = (); - while( my $fn = shift @_ ) { - push @result, glob($fn); - } - return @result; -} - -# -# Reading the input files and scanning for test cases -# - -my (@suites, $suite, $test, $inBlock); -my $numTotalTests = 0; - -sub scanInputFiles() { - foreach my $file (@ARGV) { - scanInputFile( $file ); - } - scalar @suites or $root or die("No tests defined\n"); -} - -sub scanInputFile($) { - my ($file) = @_; - open FILE, "<$file" or die("Cannot open input file \"$file\"\n"); - - my $line; - while (defined($line = <FILE>)) { - scanLineForExceptionHandling( $line ); - scanLineForStandardLibrary( $line ); - - scanLineForSuiteStart( $file, $., $line ); - - if ( $suite ) { - if ( lineBelongsToSuite( $suite, $., $line ) ) { - scanLineForTest( $., $line ); - scanLineForCreate( $., $line ); - scanLineForDestroy( $., $line ); - } - } - } - closeSuite(); - close FILE; -} - -sub lineBelongsToSuite($$$) { - my ($suite, $lineNo, $line) = @_; - if ( !$suite->{'generated'} ) { - return 1; - } - - if ( !$inBlock ) { - $inBlock = lineStartsBlock( $line ); - } - if ( $inBlock ) { - addLineToBlock( $suite->{'file'}, $lineNo, $line ); - } - return $inBlock; -} - -sub scanLineForExceptionHandling($) { - my ($line) = @_; - if ( $line =~ m/\b(try|throw|catch|TSM?_ASSERT_THROWS[A-Z_]*)\b/ ) { - addExceptionHandling(); - } -} - -sub scanLineForStandardLibrary($) { - my ($line) = @_; - if ( $line =~ m/\b(std\s*::|CXXTEST_STD|using\s+namespace\s+std\b|^\s*\#\s*include\s+<[a-z0-9]+>)/ ) { - addStandardLibrary(); - } -} - -sub scanLineForSuiteStart($$$) { - my ($fileName, $lineNo, $line) = @_; - if ( $line =~ m/\bclass\s+(\w+)\s*:\s*public\s+((::)?\s*CxxTest\s*::\s*)?TestSuite\b/ ) { - startSuite( $1, $fileName, $lineNo, 0 ); - } - if ( $line =~ m/\bCXXTEST_SUITE\s*\(\s*(\w*)\s*\)/ ) { - print "$fileName:$lineNo: Warning: Inline test suites are deprecated.\n"; - startSuite( $1, $fileName, $lineNo, 1 ); - } -} - -sub startSuite($$$$) { - my ($name, $file, $line, $generated) = @_; - closeSuite(); - $suite = { 'name' => $name, - 'file' => $file, - 'line' => $line, - 'generated' => $generated, - 'create' => 0, - 'destroy' => 0, - 'tests' => [], - 'lines' => [] }; -} - -sub lineStartsBlock($) { - my ($line) = @_; - return $line =~ m/\bCXXTEST_CODE\s*\(/; -} - -sub scanLineForTest($$) { - my ($lineNo, $line) = @_; - if ( $line =~ m/^([^\/]|\/[^\/])*\bvoid\s+([Tt]est\w+)\s*\(\s*(void)?\s*\)/ ) { - addTest( $2, $lineNo ); - } -} - -sub addTest($$$) { - my ($name, $line) = @_; - $test = { 'name' => $name, - 'line' => $line }; - push @{suiteTests()}, $test; -} - -sub addLineToBlock($$$) { - my ($fileName, $lineNo, $line) = @_; - $line = fixBlockLine( $fileName, $lineNo, $line ); - $line =~ s/^.*\{\{//; - my $end = ($line =~ s/\}\}.*//s); - push @{$suite->{'lines'}}, $line; - if ( $end ) { - $inBlock = 0; - } -} - -sub fixBlockLine($$$) { - my ($fileName, $lineNo, $line) = @_; - my $fileLine = cstr($fileName) . "," . $lineNo; - $line =~ s/\b(E?TSM?_(ASSERT[A-Z_]*|FAIL))\s*\(/_$1($fileLine,/g; - return $line; -} - -sub scanLineForCreate($$) { - my ($lineNo, $line) = @_; - if ( $line =~ m/\bstatic\s+\w+\s*\*\s*createSuite\s*\(\s*(void)?\s*\)/ ) { - addCreateSuite( $lineNo ); - } -} - -sub scanLineForDestroy($$) { - my ($lineNo, $line) = @_; - if ( $line =~ m/\bstatic\s+void\s+destroySuite\s*\(\s*\w+\s*\*\s*\w*\s*\)/ ) { - addDestroySuite( $lineNo ); - } -} - -sub closeSuite() { - if ( $suite && scalar @{suiteTests()} ) { - verifySuite(); - rememberSuite(); - } - undef $suite; -} - -sub addCreateSuite($) { - $suite->{'createSuite'} = $_[0]; -} - -sub addDestroySuite($) { - $suite->{'destroySuite'} = $_[0]; -} - -sub addExceptionHandling() { - $haveEh = 1 unless defined($noEh); -} - -sub addStandardLibrary() { - $haveStd = 1 unless defined($noStd); -} - -sub verifySuite() { - if (suiteCreateLine() || suiteDestroyLine()) { - die("Suite ", suiteName(), " must have both createSuite() and destroySuite()\n") - unless (suiteCreateLine() && suiteDestroyLine()); - } -} - -sub rememberSuite() { - push @suites, $suite; - $numTotalTests += scalar @{$suite->{'tests'}}; -} - -sub suiteName() { return $suite->{'name'}; } -sub suiteTests() { return $suite->{'tests'}; } -sub suiteCreateLine() { return $suite->{'createSuite'}; } -sub suiteDestroyLine() { return $suite->{'destroySuite'}; } -sub fileName() { return $suite->{'file'}; } -sub fileString() { return cstr(fileName()); } -sub testName() { return $test->{'name'}; } -sub testLine() { return $test->{'line'}; } - -sub suiteObject() { return "suite_".suiteName(); } - -sub cstr($) { - my $file = $_[0]; - $file =~ s/\\/\\\\/g; - return "\"".$file."\""; -} - -# -# Writing the test source file -# - -sub writeOutput() { - $template ? writeTemplateOutput() : writeSimpleOutput(); -} - -sub startOutputFile() { - if ( !standardOutput() ) { - open OUTPUT_FILE,">$output" or die("Cannot create output file \"$output\"\n"); - select OUTPUT_FILE; - } - print "/* Generated file, do not edit */\n\n"; -} - -sub standardOutput() { - return !$output; -} - -sub writeSimpleOutput() { - startOutputFile(); - writePreamble(); - writeMain(); - writeWorld(); -} - -my ($didPreamble, $didWorld); - -sub writeTemplateOutput() { - openTemplateFile(); - startOutputFile(); - my $line; - while (defined($line = <TEMPLATE_FILE>)) { - if ( $line =~ m/^\s*\#\s*include\s*<cxxtest\// ) { - writePreamble(); - print $line; - } elsif ( $line =~ m/^\s*<CxxTest\s+preamble>\s*$/ ) { - writePreamble(); - } elsif ( $line =~ m/^\s*<CxxTest\s+world>\s*$/ ) { - writeWorld(); - } else { - print $line; - } - } -} - -sub openTemplateFile() { - open TEMPLATE_FILE, "<$template" or die("Cannot open template file \"$template\"\n"); -} - -sub writePreamble() { - return if $didPreamble; - print "#ifndef CXXTEST_RUNNING\n"; - print "#define CXXTEST_RUNNING\n"; - print "#endif\n"; - print "\n"; - if ( $haveStd ) { - print "#define _CXXTEST_HAVE_STD\n"; - } - if ( $haveEh ) { - print "#define _CXXTEST_HAVE_EH\n"; - } - if ( $abortOnFail ) { - print "#define _CXXTEST_ABORT_TEST_ON_FAIL\n"; - } - if ( $longlong ) { - print "#define _CXXTEST_LONGLONG $longlong\n"; - } - if ( $factor ) { - print "#define _CXXTEST_FACTOR\n"; - } - foreach my $header (@headers) { - print "#include $header\n"; - } - print "#include <cxxtest/TestListener.h>\n"; - print "#include <cxxtest/TestTracker.h>\n"; - print "#include <cxxtest/TestRunner.h>\n"; - print "#include <cxxtest/RealDescriptions.h>\n"; - print "#include <cxxtest/$runner.h>\n" if $runner; - print "#include <cxxtest/$gui.h>\n" if $gui; - print "\n"; - $didPreamble = 1; -} - -sub writeWorld() { - return if $didWorld; - writePreamble(); - writeSuites(); - ($root or !$part) and writeRoot(); - $noStaticInit and writeInitialize(); - $didWorld = 1; -} - -sub writeSuites() { - foreach (@suites) { - $suite = $_; - writeInclude(fileName()); - if ( $suite->{'generated'} ) { generateSuite(); } - dynamicSuite() ? writeSuitePointer() : writeSuiteObject(); - writeTestList(); - writeSuiteDescription(); - writeTestDescriptions(); - } -} - -sub dynamicSuite() { - return suiteCreateLine(); -} - -my $lastIncluded; - -sub writeInclude($) { - my $file = $_[0]; - return if $lastIncluded && ($file eq $lastIncluded); - print "#include \"$file\"\n\n"; - $lastIncluded = $file; -} - -sub generateSuite() { - print "class ", suiteName(), " : public CxxTest::TestSuite {\n"; - print "public:\n"; - foreach my $line (@{$suite->{'lines'}}) { - print $line; - } - print "};\n\n"; -} - -sub writeTestDescriptionsBase() { - my $class = "TestDescriptionBase_" . suiteName(); - print "class $class : public CxxTest::TestDescription {\n"; - print "public:\n"; - print " const char *file() const { return ", fileString(), "; }\n"; - print " const char *suiteName() const { return \"", suiteName(), "\"; }\n"; - print "};\n\n"; -} - -sub writeSuitePointer() { - if ( $noStaticInit ) { - print "static ", suiteName(), " *", suiteObject(), ";\n\n"; - } else { - print "static ", suiteName(), " *", suiteObject(), " = 0;\n\n"; - } -} - -sub writeSuiteObject() { - print "static ", suiteName(), " ", suiteObject(), ";\n\n"; -} - -sub testList() { - return "Tests_" . suiteName(); -} - -sub writeTestList() { - if ( $noStaticInit ) { - printf "static CxxTest::List %s;\n", testList(); - } else { - printf "static CxxTest::List %s = { 0, 0 };\n", testList(); - } -} - -sub writeTestDescriptions() { - foreach (@{suiteTests()}) { - $test = $_; - writeTestDescription(); - } -} - -sub suiteDescription() { - return "suiteDescription_" . suiteName(); -} - -sub writeTestDescription() { - my $class = "TestDescription_" . suiteName() . "_" . testName(); - printf "static class $class : public CxxTest::RealTestDescription {\n"; - printf "public:\n"; - $noStaticInit or - printf " $class() : CxxTest::RealTestDescription( %s, %s, %s, \"%s\" ) {}\n", - testList(), suiteDescription(), testLine(), testName(); - printf " void runTest() { %s }\n", dynamicSuite() ? dynamicRun() : staticRun(); - printf "} testDescription_%s_%s;\n\n", suiteName(), testName(); -} - -sub dynamicRun() { - return sprintf( "if ( %s ) %s->%s();", suiteObject(), suiteObject(), testName() ); -} - -sub staticRun() { - return sprintf( "%s.%s();", suiteObject(), testName() ); -} - -sub writeSuiteDescription() { - dynamicSuite() ? writeDynamicDescription() : writeStaticDescription(); -} - -sub writeDynamicDescription() { - printf "CxxTest::DynamicSuiteDescription<%s> %s", suiteName(), suiteDescription(); - if ( !$noStaticInit ) { - printf "( %s, %s, \"%s\", %s, %s, %s, %s )", - fileString(), $suite->{'line'}, suiteName(), testList(), - suiteObject(), suiteCreateLine(), suiteDestroyLine(); - } - print ";\n\n"; -} - -sub writeStaticDescription() { - printf "CxxTest::StaticSuiteDescription %s", suiteDescription(); - if ( !$noStaticInit ) { - printf "( %s, %s, \"%s\", %s, %s )", fileString(), $suite->{'line'}, suiteName(), suiteObject(), testList(); - } - print ";\n\n"; -} - -sub writeRoot() { - print "#include <cxxtest/Root.cpp>\n"; -} - -sub writeInitialize() { - print "namespace CxxTest {\n"; - print " void initialize()\n"; - print " {\n"; - foreach (@suites) { - $suite = $_; - printf " %s.initialize();\n", testList(); - if ( dynamicSuite() ) { - printf " %s = 0;\n", suiteObject(); - printf " %s.initialize( %s, %s, \"%s\", %s, %s, %s, %s );\n", - suiteDescription(), fileString(), $suite->{'line'}, suiteName(), testList(), - suiteObject(), suiteCreateLine(), suiteDestroyLine(); - } else { - printf " %s.initialize( %s, %s, \"%s\", %s, %s );\n", - suiteDescription(), fileString(), $suite->{'line'}, suiteName(), suiteObject(), testList(); - } - - foreach (@{suiteTests()}) { - $test = $_; - printf " testDescription_%s_%s.initialize( %s, %s, %s, \"%s\" );\n", - suiteName(), testName(), testList(), suiteDescription(), testLine(), testName(); - } - } - print " }\n"; - print "}\n"; -} - -sub writeMain() { - if ( $gui ) { - print "int main( int argc, char *argv[] ) {\n"; - $noStaticInit && - print " CxxTest::initialize();\n"; - print " return CxxTest::GuiTuiRunner<CxxTest::$gui, CxxTest::$runner>( argc, argv ).run();\n"; - print "}\n"; - } - elsif ( $runner ) { - print "int main() {\n"; - $noStaticInit && - print " CxxTest::initialize();\n"; - print " return CxxTest::$runner().run();\n"; - print "}\n"; - } -} diff --git a/test/cxxtestgen.py b/test/cxxtestgen.py deleted file mode 100755 index 831d23ab..00000000 --- a/test/cxxtestgen.py +++ /dev/null @@ -1,593 +0,0 @@ -#!/usr/bin/python -'''Usage: %s [OPTIONS] <input file(s)> -Generate test source file for CxxTest. - - -v, --version Write CxxTest version - -o, --output=NAME Write output to file NAME - --runner=CLASS Create a main() function that runs CxxTest::CLASS - --gui=CLASS Like --runner, with GUI component - --error-printer Same as --runner=ErrorPrinter - --abort-on-fail Abort tests on failed asserts (like xUnit) - --have-std Use standard library (even if not found in tests) - --no-std Don\'t use standard library (even if found in tests) - --have-eh Use exception handling (even if not found in tests) - --no-eh Don\'t use exception handling (even if found in tests) - --longlong=[TYPE] Use TYPE (default: long long) as long long - --template=TEMPLATE Use TEMPLATE file to generate the test runner - --include=HEADER Include HEADER in test runner before other headers - --root Write CxxTest globals - --part Don\'t write CxxTest globals - --no-static-init Don\'t rely on static initialization -''' - -import re -import sys -import getopt -import glob -import string - -# Global variables -suites = [] -suite = None -inBlock = 0 - -outputFileName = None -runner = None -gui = None -root = None -part = None -noStaticInit = None -templateFileName = None -headers = [] - -haveExceptionHandling = 0 -noExceptionHandling = 0 -haveStandardLibrary = 0 -noStandardLibrary = 0 -abortOnFail = 0 -factor = 0 -longlong = 0 - -def main(): - '''The main program''' - files = parseCommandline() - scanInputFiles( files ) - writeOutput() - -def usage( problem = None ): - '''Print usage info and exit''' - if problem is None: - print usageString() - sys.exit(0) - else: - sys.stderr.write( usageString() ) - abort( problem ) - -def usageString(): - '''Construct program usage string''' - return __doc__ % sys.argv[0] - -def abort( problem ): - '''Print error message and exit''' - sys.stderr.write( '\n' ) - sys.stderr.write( problem ) - sys.stderr.write( '\n\n' ) - sys.exit(2) - -def parseCommandline(): - '''Analyze command line arguments''' - try: - options, patterns = getopt.getopt( sys.argv[1:], 'o:r:', - ['version', 'output=', 'runner=', 'gui=', - 'error-printer', 'abort-on-fail', 'have-std', 'no-std', - 'have-eh', 'no-eh', 'template=', 'include=', - 'root', 'part', 'no-static-init', 'factor', 'longlong='] ) - except getopt.error, problem: - usage( problem ) - setOptions( options ) - return setFiles( patterns ) - -def setOptions( options ): - '''Set options specified on command line''' - global outputFileName, templateFileName, runner, gui, haveStandardLibrary, factor, longlong - global haveExceptionHandling, noExceptionHandling, abortOnFail, headers, root, part, noStaticInit - for o, a in options: - if o in ('-v', '--version'): - printVersion() - elif o in ('-o', '--output'): - outputFileName = a - elif o == '--template': - templateFileName = a - elif o == '--runner': - runner = a - elif o == '--gui': - gui = a - elif o == '--include': - if not re.match( r'^["<].*[>"]$', a ): - a = ('"%s"' % a) - headers.append( a ) - elif o == '--error-printer': - runner = 'ErrorPrinter' - haveStandardLibrary = 1 - elif o == '--abort-on-fail': - abortOnFail = 1 - elif o == '--have-std': - haveStandardLibrary = 1 - elif o == '--no-std': - noStandardLibrary = 1 - elif o == '--have-eh': - haveExceptionHandling = 1 - elif o == '--no-eh': - noExceptionHandling = 1 - elif o == '--root': - root = 1 - elif o == '--part': - part = 1 - elif o == '--no-static-init': - noStaticInit = 1 - elif o == '--factor': - factor = 1 - elif o == '--longlong': - if a: - longlong = a - else: - longlong = 'long long' - - if noStaticInit and (root or part): - abort( '--no-static-init cannot be used with --root/--part' ) - - if gui and not runner: - runner = 'StdioPrinter' - -def printVersion(): - '''Print CxxTest version and exit''' - sys.stdout.write( "This is CxxTest version 3.10.1.\n" ) - sys.exit(0) - -def setFiles( patterns ): - '''Set input files specified on command line''' - files = expandWildcards( patterns ) - if len(files) is 0 and not root: - usage( "No input files found" ) - return files - -def expandWildcards( patterns ): - '''Expand all wildcards in an array (glob)''' - fileNames = [] - for pathName in patterns: - patternFiles = glob.glob( pathName ) - for fileName in patternFiles: - fileNames.append( fixBackslashes( fileName ) ) - return fileNames - -def fixBackslashes( fileName ): - '''Convert backslashes to slashes in file name''' - return re.sub( r'\\', '/', fileName, 0 ) - -def scanInputFiles(files): - '''Scan all input files for test suites''' - for file in files: - scanInputFile(file) - global suites - if len(suites) is 0 and not root: - abort( 'No tests defined' ) - -def scanInputFile(fileName): - '''Scan single input file for test suites''' - file = open(fileName) - lineNo = 0 - while 1: - line = file.readline() - if not line: - break - lineNo = lineNo + 1 - - scanInputLine( fileName, lineNo, line ) - closeSuite() - file.close() - -def scanInputLine( fileName, lineNo, line ): - '''Scan single input line for interesting stuff''' - scanLineForExceptionHandling( line ) - scanLineForStandardLibrary( line ) - - scanLineForSuiteStart( fileName, lineNo, line ) - - global suite - if suite: - scanLineInsideSuite( suite, lineNo, line ) - -def scanLineInsideSuite( suite, lineNo, line ): - '''Analyze line which is part of a suite''' - global inBlock - if lineBelongsToSuite( suite, lineNo, line ): - scanLineForTest( suite, lineNo, line ) - scanLineForCreate( suite, lineNo, line ) - scanLineForDestroy( suite, lineNo, line ) - -def lineBelongsToSuite( suite, lineNo, line ): - '''Returns whether current line is part of the current suite. - This can be false when we are in a generated suite outside of CXXTEST_CODE() blocks - If the suite is generated, adds the line to the list of lines''' - if not suite['generated']: - return 1 - - global inBlock - if not inBlock: - inBlock = lineStartsBlock( line ) - if inBlock: - inBlock = addLineToBlock( suite, lineNo, line ) - return inBlock - - -std_re = re.compile( r"\b(std\s*::|CXXTEST_STD|using\s+namespace\s+std\b|^\s*\#\s*include\s+<[a-z0-9]+>)" ) -def scanLineForStandardLibrary( line ): - '''Check if current line uses standard library''' - global haveStandardLibrary, noStandardLibrary - if not haveStandardLibrary and std_re.search(line): - if not noStandardLibrary: - haveStandardLibrary = 1 - -exception_re = re.compile( r"\b(throw|try|catch|TSM?_ASSERT_THROWS[A-Z_]*)\b" ) -def scanLineForExceptionHandling( line ): - '''Check if current line uses exception handling''' - global haveExceptionHandling, noExceptionHandling - if not haveExceptionHandling and exception_re.search(line): - if not noExceptionHandling: - haveExceptionHandling = 1 - -suite_re = re.compile( r'\bclass\s+(\w+)\s*:\s*public\s+((::)?\s*CxxTest\s*::\s*)?TestSuite\b' ) -generatedSuite_re = re.compile( r'\bCXXTEST_SUITE\s*\(\s*(\w*)\s*\)' ) -def scanLineForSuiteStart( fileName, lineNo, line ): - '''Check if current line starts a new test suite''' - m = suite_re.search( line ) - if m: - startSuite( m.group(1), fileName, lineNo, 0 ) - m = generatedSuite_re.search( line ) - if m: - sys.stdout.write( "%s:%s: Warning: Inline test suites are deprecated.\n" % (fileName, lineNo) ) - startSuite( m.group(1), fileName, lineNo, 1 ) - -def startSuite( name, file, line, generated ): - '''Start scanning a new suite''' - global suite - closeSuite() - suite = { 'name' : name, - 'file' : file, - 'cfile' : cstr(file), - 'line' : line, - 'generated' : generated, - 'object' : 'suite_%s' % name, - 'dobject' : 'suiteDescription_%s' % name, - 'tlist' : 'Tests_%s' % name, - 'tests' : [], - 'lines' : [] } - -def lineStartsBlock( line ): - '''Check if current line starts a new CXXTEST_CODE() block''' - return re.search( r'\bCXXTEST_CODE\s*\(', line ) is not None - -test_re = re.compile( r'^([^/]|/[^/])*\bvoid\s+([Tt]est\w+)\s*\(\s*(void)?\s*\)' ) -def scanLineForTest( suite, lineNo, line ): - '''Check if current line starts a test''' - m = test_re.search( line ) - if m: - addTest( suite, m.group(2), lineNo ) - -def addTest( suite, name, line ): - '''Add a test function to the current suite''' - test = { 'name' : name, - 'suite' : suite, - 'class' : 'TestDescription_%s_%s' % (suite['name'], name), - 'object' : 'testDescription_%s_%s' % (suite['name'], name), - 'line' : line, - } - suite['tests'].append( test ) - -def addLineToBlock( suite, lineNo, line ): - '''Append the line to the current CXXTEST_CODE() block''' - line = fixBlockLine( suite, lineNo, line ) - line = re.sub( r'^.*\{\{', '', line ) - - e = re.search( r'\}\}', line ) - if e: - line = line[:e.start()] - suite['lines'].append( line ) - return e is None - -def fixBlockLine( suite, lineNo, line): - '''Change all [E]TS_ macros used in a line to _[E]TS_ macros with the correct file/line''' - return re.sub( r'\b(E?TSM?_(ASSERT[A-Z_]*|FAIL))\s*\(', - r'_\1(%s,%s,' % (suite['cfile'], lineNo), - line, 0 ) - -create_re = re.compile( r'\bstatic\s+\w+\s*\*\s*createSuite\s*\(\s*(void)?\s*\)' ) -def scanLineForCreate( suite, lineNo, line ): - '''Check if current line defines a createSuite() function''' - if create_re.search( line ): - addSuiteCreateDestroy( suite, 'create', lineNo ) - -destroy_re = re.compile( r'\bstatic\s+void\s+destroySuite\s*\(\s*\w+\s*\*\s*\w*\s*\)' ) -def scanLineForDestroy( suite, lineNo, line ): - '''Check if current line defines a destroySuite() function''' - if destroy_re.search( line ): - addSuiteCreateDestroy( suite, 'destroy', lineNo ) - -def cstr( str ): - '''Convert a string to its C representation''' - return '"' + string.replace( str, '\\', '\\\\' ) + '"' - - -def addSuiteCreateDestroy( suite, which, line ): - '''Add createSuite()/destroySuite() to current suite''' - if suite.has_key(which): - abort( '%s:%s: %sSuite() already declared' % ( suite['file'], str(line), which ) ) - suite[which] = line - -def closeSuite(): - '''Close current suite and add it to the list if valid''' - global suite - if suite is not None: - if len(suite['tests']) is not 0: - verifySuite(suite) - rememberSuite(suite) - suite = None - -def verifySuite(suite): - '''Verify current suite is legal''' - if suite.has_key('create') and not suite.has_key('destroy'): - abort( '%s:%s: Suite %s has createSuite() but no destroySuite()' % - (suite['file'], suite['create'], suite['name']) ) - if suite.has_key('destroy') and not suite.has_key('create'): - abort( '%s:%s: Suite %s has destroySuite() but no createSuite()' % - (suite['file'], suite['destroy'], suite['name']) ) - -def rememberSuite(suite): - '''Add current suite to list''' - global suites - suites.append( suite ) - -def writeOutput(): - '''Create output file''' - if templateFileName: - writeTemplateOutput() - else: - writeSimpleOutput() - -def writeSimpleOutput(): - '''Create output not based on template''' - output = startOutputFile() - writePreamble( output ) - writeMain( output ) - writeWorld( output ) - output.close() - -include_re = re.compile( r"\s*\#\s*include\s+<cxxtest/" ) -preamble_re = re.compile( r"^\s*<CxxTest\s+preamble>\s*$" ) -world_re = re.compile( r"^\s*<CxxTest\s+world>\s*$" ) -def writeTemplateOutput(): - '''Create output based on template file''' - template = open(templateFileName) - output = startOutputFile() - while 1: - line = template.readline() - if not line: - break; - if include_re.search( line ): - writePreamble( output ) - output.write( line ) - elif preamble_re.search( line ): - writePreamble( output ) - elif world_re.search( line ): - writeWorld( output ) - else: - output.write( line ) - template.close() - output.close() - -def startOutputFile(): - '''Create output file and write header''' - if outputFileName is not None: - output = open( outputFileName, 'w' ) - else: - output = sys.stdout - output.write( "/* Generated file, do not edit */\n\n" ) - return output - -wrotePreamble = 0 -def writePreamble( output ): - '''Write the CxxTest header (#includes and #defines)''' - global wrotePreamble, headers, longlong - if wrotePreamble: return - output.write( "#ifndef CXXTEST_RUNNING\n" ) - output.write( "#define CXXTEST_RUNNING\n" ) - output.write( "#endif\n" ) - output.write( "\n" ) - if haveStandardLibrary: - output.write( "#define _CXXTEST_HAVE_STD\n" ) - if haveExceptionHandling: - output.write( "#define _CXXTEST_HAVE_EH\n" ) - if abortOnFail: - output.write( "#define _CXXTEST_ABORT_TEST_ON_FAIL\n" ) - if longlong: - output.write( "#define _CXXTEST_LONGLONG %s\n" % longlong ) - if factor: - output.write( "#define _CXXTEST_FACTOR\n" ) - for header in headers: - output.write( "#include %s\n" % header ) - output.write( "#include <cxxtest/TestListener.h>\n" ) - output.write( "#include <cxxtest/TestTracker.h>\n" ) - output.write( "#include <cxxtest/TestRunner.h>\n" ) - output.write( "#include <cxxtest/RealDescriptions.h>\n" ) - if runner: - output.write( "#include <cxxtest/%s.h>\n" % runner ) - if gui: - output.write( "#include <cxxtest/%s.h>\n" % gui ) - output.write( "\n" ) - wrotePreamble = 1 - -def writeMain( output ): - '''Write the main() function for the test runner''' - if gui: - output.write( 'int main( int argc, char *argv[] ) {\n' ) - if noStaticInit: - output.write( ' CxxTest::initialize();\n' ) - output.write( ' return CxxTest::GuiTuiRunner<CxxTest::%s, CxxTest::%s>( argc, argv ).run();\n' % (gui, runner) ) - output.write( '}\n' ) - elif runner: - output.write( 'int main() {\n' ) - if noStaticInit: - output.write( ' CxxTest::initialize();\n' ) - output.write( ' return CxxTest::%s().run();\n' % runner ) - output.write( '}\n' ) - -wroteWorld = 0 -def writeWorld( output ): - '''Write the world definitions''' - global wroteWorld, part - if wroteWorld: return - writePreamble( output ) - writeSuites( output ) - if root or not part: - writeRoot( output ) - if noStaticInit: - writeInitialize( output ) - wroteWorld = 1 - -def writeSuites(output): - '''Write all TestDescriptions and SuiteDescriptions''' - for suite in suites: - writeInclude( output, suite['file'] ) - if isGenerated(suite): - generateSuite( output, suite ) - if isDynamic(suite): - writeSuitePointer( output, suite ) - else: - writeSuiteObject( output, suite ) - writeTestList( output, suite ) - writeSuiteDescription( output, suite ) - writeTestDescriptions( output, suite ) - -def isGenerated(suite): - '''Checks whether a suite class should be created''' - return suite['generated'] - -def isDynamic(suite): - '''Checks whether a suite is dynamic''' - return suite.has_key('create') - -lastIncluded = '' -def writeInclude(output, file): - '''Add #include "file" statement''' - global lastIncluded - if file == lastIncluded: return - output.writelines( [ '#include "', file, '"\n\n' ] ) - lastIncluded = file - -def generateSuite( output, suite ): - '''Write a suite declared with CXXTEST_SUITE()''' - output.write( 'class %s : public CxxTest::TestSuite {\n' % suite['name'] ) - output.write( 'public:\n' ) - for line in suite['lines']: - output.write(line) - output.write( '};\n\n' ) - -def writeSuitePointer( output, suite ): - '''Create static suite pointer object for dynamic suites''' - if noStaticInit: - output.write( 'static %s *%s;\n\n' % (suite['name'], suite['object']) ) - else: - output.write( 'static %s *%s = 0;\n\n' % (suite['name'], suite['object']) ) - -def writeSuiteObject( output, suite ): - '''Create static suite object for non-dynamic suites''' - output.writelines( [ "static ", suite['name'], " ", suite['object'], ";\n\n" ] ) - -def writeTestList( output, suite ): - '''Write the head of the test linked list for a suite''' - if noStaticInit: - output.write( 'static CxxTest::List %s;\n' % suite['tlist'] ) - else: - output.write( 'static CxxTest::List %s = { 0, 0 };\n' % suite['tlist'] ) - -def writeTestDescriptions( output, suite ): - '''Write all test descriptions for a suite''' - for test in suite['tests']: - writeTestDescription( output, suite, test ) - -def writeTestDescription( output, suite, test ): - '''Write test description object''' - output.write( 'static class %s : public CxxTest::RealTestDescription {\n' % test['class'] ) - output.write( 'public:\n' ) - if not noStaticInit: - output.write( ' %s() : CxxTest::RealTestDescription( %s, %s, %s, "%s" ) {}\n' % - (test['class'], suite['tlist'], suite['dobject'], test['line'], test['name']) ) - output.write( ' void runTest() { %s }\n' % runBody( suite, test ) ) - output.write( '} %s;\n\n' % test['object'] ) - -def runBody( suite, test ): - '''Body of TestDescription::run()''' - if isDynamic(suite): return dynamicRun( suite, test ) - else: return staticRun( suite, test ) - -def dynamicRun( suite, test ): - '''Body of TestDescription::run() for test in a dynamic suite''' - return 'if ( ' + suite['object'] + ' ) ' + suite['object'] + '->' + test['name'] + '();' - -def staticRun( suite, test ): - '''Body of TestDescription::run() for test in a non-dynamic suite''' - return suite['object'] + '.' + test['name'] + '();' - -def writeSuiteDescription( output, suite ): - '''Write SuiteDescription object''' - if isDynamic( suite ): - writeDynamicDescription( output, suite ) - else: - writeStaticDescription( output, suite ) - -def writeDynamicDescription( output, suite ): - '''Write SuiteDescription for a dynamic suite''' - output.write( 'CxxTest::DynamicSuiteDescription<%s> %s' % (suite['name'], suite['dobject']) ) - if not noStaticInit: - output.write( '( %s, %s, "%s", %s, %s, %s, %s )' % - (suite['cfile'], suite['line'], suite['name'], suite['tlist'], - suite['object'], suite['create'], suite['destroy']) ) - output.write( ';\n\n' ) - -def writeStaticDescription( output, suite ): - '''Write SuiteDescription for a static suite''' - output.write( 'CxxTest::StaticSuiteDescription %s' % suite['dobject'] ) - if not noStaticInit: - output.write( '( %s, %s, "%s", %s, %s )' % - (suite['cfile'], suite['line'], suite['name'], suite['object'], suite['tlist']) ) - output.write( ';\n\n' ) - -def writeRoot(output): - '''Write static members of CxxTest classes''' - output.write( '#include <cxxtest/Root.cpp>\n' ) - -def writeInitialize(output): - '''Write CxxTest::initialize(), which replaces static initialization''' - output.write( 'namespace CxxTest {\n' ) - output.write( ' void initialize()\n' ) - output.write( ' {\n' ) - for suite in suites: - output.write( ' %s.initialize();\n' % suite['tlist'] ) - if isDynamic(suite): - output.write( ' %s = 0;\n' % suite['object'] ) - output.write( ' %s.initialize( %s, %s, "%s", %s, %s, %s, %s );\n' % - (suite['dobject'], suite['cfile'], suite['line'], suite['name'], - suite['tlist'], suite['object'], suite['create'], suite['destroy']) ) - else: - output.write( ' %s.initialize( %s, %s, "%s", %s, %s );\n' % - (suite['dobject'], suite['cfile'], suite['line'], suite['name'], - suite['object'], suite['tlist']) ) - - for test in suite['tests']: - output.write( ' %s.initialize( %s, %s, %s, "%s" );\n' % - (test['object'], suite['tlist'], suite['dobject'], test['line'], test['name']) ) - - output.write( ' }\n' ) - output.write( '}\n' ) - -main() diff --git a/test/full/acrylic_attenuation/acrylic_attenuation.C b/test/full/acrylic_attenuation/acrylic_attenuation.C index 490a1ee2..ae2245ad 100644 --- a/test/full/acrylic_attenuation/acrylic_attenuation.C +++ b/test/full/acrylic_attenuation/acrylic_attenuation.C @@ -1,29 +1,31 @@ -void acrylic_attenuation(std::string event_filename, std::string out_filename) -{ - TFile *event_file = new TFile(event_filename.c_str(),"READ"); - TTree *T = (TTree*)event_file->Get("T"); - TFile *out_file = new TFile(out_filename.c_str(),"RECREATE"); +void acrylic_attenuation(std::string event_filename, std::string out_filename) { + TFile *event_file = new TFile(event_filename.c_str(), "READ"); + TTree *T = (TTree *)event_file->Get("T"); + TFile *out_file = new TFile(out_filename.c_str(), "RECREATE"); TH1F *acr_attn_100 = new TH1F("acr_attn_100", "Photon track length (100 nm)", 50, 0, 50); acr_attn_100->SetXTitle("Track length (mm)"); acr_attn_100->SetYTitle("Count"); - T->Draw("mc.track.GetLastMCTrackStep()->length>>acr_attn_100","TMath::Abs(1.23997279736421566e-03/(mc.track.GetLastMCTrackStep()->ke)-100)<10","goff"); - //acr_attn_100->Fit("expo"); - //acr_attn_100->Draw("goff"); + T->Draw("mc.track.GetLastMCTrackStep()->length>>acr_attn_100", + "TMath::Abs(1.23997279736421566e-03/(mc.track.GetLastMCTrackStep()->ke)-100)<10", "goff"); + // acr_attn_100->Fit("expo"); + // acr_attn_100->Draw("goff"); acr_attn_100->Write(); TH1F *acr_attn_200 = new TH1F("acr_attn_200", "Photon track length (200 nm)", 50, 0, 50); acr_attn_200->SetXTitle("Track length (mm)"); acr_attn_200->SetYTitle("Count"); - T->Draw("mc.track.GetLastMCTrackStep()->length>>acr_attn_200","TMath::Abs(1.23997279736421566e-03/(mc.track.GetLastMCTrackStep()->ke)-200)<10","goff"); - //acr_attn_200->Fit("expo"); - //acr_attn_200->Draw("goff"); + T->Draw("mc.track.GetLastMCTrackStep()->length>>acr_attn_200", + "TMath::Abs(1.23997279736421566e-03/(mc.track.GetLastMCTrackStep()->ke)-200)<10", "goff"); + // acr_attn_200->Fit("expo"); + // acr_attn_200->Draw("goff"); acr_attn_200->Write(); TH1F *acr_attn_300 = new TH1F("acr_attn_300", "Photon track length (300 nm)", 20, 0, 2500); acr_attn_300->SetXTitle("Track length (mm)"); acr_attn_300->SetYTitle("Count"); - T->Draw("mc.track.GetLastMCTrackStep()->length>>acr_attn_300","TMath::Abs(1.23997279736421566e-03/(mc.track.GetLastMCTrackStep()->ke)-300)<10","goff"); + T->Draw("mc.track.GetLastMCTrackStep()->length>>acr_attn_300", + "TMath::Abs(1.23997279736421566e-03/(mc.track.GetLastMCTrackStep()->ke)-300)<10", "goff"); acr_attn_300->Fit("expo"); acr_attn_300->Draw("goff"); acr_attn_300->Write(); @@ -31,7 +33,8 @@ void acrylic_attenuation(std::string event_filename, std::string out_filename) TH1F *acr_attn_400 = new TH1F("acr_attn_400", "Photon track length (400 nm)", 20, 0, 8000); acr_attn_400->SetXTitle("Track length (mm)"); acr_attn_400->SetYTitle("Count"); - T->Draw("mc.track.GetLastMCTrackStep()->length>>acr_attn_400","TMath::Abs(1.23997279736421566e-03/(mc.track.GetLastMCTrackStep()->ke)-400)<10","goff"); + T->Draw("mc.track.GetLastMCTrackStep()->length>>acr_attn_400", + "TMath::Abs(1.23997279736421566e-03/(mc.track.GetLastMCTrackStep()->ke)-400)<10", "goff"); acr_attn_400->Fit("expo"); acr_attn_400->Draw("goff"); acr_attn_400->Write(); @@ -39,7 +42,8 @@ void acrylic_attenuation(std::string event_filename, std::string out_filename) TH1F *acr_attn_500 = new TH1F("acr_attn_500", "Photon track length (500 nm)", 20, 0, 10000); acr_attn_500->SetXTitle("Track length (mm)"); acr_attn_500->SetYTitle("Count"); - T->Draw("mc.track.GetLastMCTrackStep()->length>>acr_attn_500","TMath::Abs(1.23997279736421566e-03/(mc.track.GetLastMCTrackStep()->ke)-500)<10","goff"); + T->Draw("mc.track.GetLastMCTrackStep()->length>>acr_attn_500", + "TMath::Abs(1.23997279736421566e-03/(mc.track.GetLastMCTrackStep()->ke)-500)<10", "goff"); acr_attn_500->Fit("expo"); acr_attn_500->Draw("goff"); acr_attn_500->Write(); diff --git a/test/full/fitcentroid/cylinder/PMTINFO.ratdb b/test/full/fitcentroid/cylinder/PMTINFO.ratdb new file mode 100644 index 00000000..91c55c4e --- /dev/null +++ b/test/full/fitcentroid/cylinder/PMTINFO.ratdb @@ -0,0 +1,13 @@ +{ +"name": "PMTINFO", +"valid_begin": [0, 0], +"valid_end": [0, 0], +"x": [-2600.000000, -2600.000000, -2600.000000, -2600.000000, -2200.000000, -2200.000000, -2200.000000, -2200.000000, -2200.000000, -2200.000000, -2200.000000, -2200.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 2200.000000, 2200.000000, 2200.000000, 2200.000000, 2200.000000, 2200.000000, 2200.000000, 2200.000000, 2600.000000, 2600.000000, 2600.000000, 2600.000000, -2600.000000, -2600.000000, -2600.000000, -2600.000000, -2200.000000, -2200.000000, -2200.000000, -2200.000000, -2200.000000, -2200.000000, -2200.000000, -2200.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1800.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1400.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -1000.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -600.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, -200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 200.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 600.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1000.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1400.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 1800.000000, 2200.000000, 2200.000000, 2200.000000, 2200.000000, 2200.000000, 2200.000000, 2200.000000, 2200.000000, 2600.000000, 2600.000000, 2600.000000, 2600.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000], +"y": [-600.000000, -200.000000, 200.000000, 600.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, -2600.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, 2600.000000, -2600.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, 2600.000000, -2600.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, 2600.000000, -2600.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, 2600.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, -600.000000, -200.000000, 200.000000, 600.000000, -600.000000, -200.000000, 200.000000, 600.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, -2600.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, 2600.000000, -2600.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, 2600.000000, -2600.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, 2600.000000, -2600.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, 2600.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, -2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, 2200.000000, -1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, 1800.000000, -1400.000000, -1000.000000, -600.000000, -200.000000, 200.000000, 600.000000, 1000.000000, 1400.000000, -600.000000, -200.000000, 200.000000, 600.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000, -0.000000, -335.893428, -667.562802, -990.837186, -1301.651217, -1596.096230, -1870.469406, -2121.320344, -2345.494447, -2540.172598, -2702.906604, -2831.649991, -2924.783737, -2981.136630, -3000.000000, -2981.136630, -2924.783737, -2831.649991, -2702.906604, -2540.172598, -2345.494447, -2121.320344, -1870.469406, -1596.096230, -1301.651217, -990.837186, -667.562802, -335.893428, 0.000000, 335.893428, 667.562802, 990.837186, 1301.651217, 1596.096230, 1870.469406, 2121.320344, 2345.494447, 2540.172598, 2702.906604, 2831.649991, 2924.783737, 2981.136630, 3000.000000, 2981.136630, 2924.783737, 2831.649991, 2702.906604, 2540.172598, 2345.494447, 2121.320344, 1870.469406, 1596.096230, 1301.651217, 990.837186, 667.562802, 335.893428, 0.000000], +"z": [3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, 3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -3000.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2750.000000, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -2326.923077, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1903.846154, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1480.769231, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -1057.692308, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -634.615385, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, -211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 211.538462, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 634.615385, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1057.692308, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1480.769231, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 1903.846154, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2326.923077, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000, 2750.000000], +"dir_x": [0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, -0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000], +"dir_y": [0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000, 0.000000, 0.111964, 0.222521, 0.330279, 0.433884, 0.532032, 0.623490, 0.707107, 0.781831, 0.846724, 0.900969, 0.943883, 0.974928, 0.993712, 1.000000, 0.993712, 0.974928, 0.943883, 0.900969, 0.846724, 0.781831, 0.707107, 0.623490, 0.532032, 0.433884, 0.330279, 0.222521, 0.111964, 0.000000, -0.111964, -0.222521, -0.330279, -0.433884, -0.532032, -0.623490, -0.707107, -0.781831, -0.846724, -0.900969, -0.943883, -0.974928, -0.993712, -1.000000, -0.993712, -0.974928, -0.943883, -0.900969, -0.846724, -0.781831, -0.707107, -0.623490, -0.532032, -0.433884, -0.330279, -0.222521, -0.111964, -0.000000], +"dir_z": [-1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, -1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 1.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000], +"type": [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1] +} + diff --git a/test/full/fitcentroid/cylinder/cylinder.geo b/test/full/fitcentroid/cylinder/cylinder.geo new file mode 100644 index 00000000..24e907ed --- /dev/null +++ b/test/full/fitcentroid/cylinder/cylinder.geo @@ -0,0 +1,58 @@ +{ +name: "GEO", +index: "world", +valid_begin: [0, 0], +valid_end: [0, 0], +mother: "", // world volume has no mother +type: "box", +size: [20000.0, 20000.0, 20000.0], // mm, half-length +material: "rock", +invisible: 1, +} + +{ +name: "GEO", +index: "detector", +valid_begin: [0, 0], +valid_end: [0, 0], +mother: "world", +type: "tube", +r_max: 3500.0, +size_z: 3500.0, +position: [0.0, 0.0, 0.0], +material: "scintillator", +color: [0.4, 0.4, 0.6, 0.1], +} + +// use an inner volume to speed up simulation. +{ +name: "GEO", +index: "detector_inner", +valid_begin: [0, 0], +valid_end: [0, 0], +mother: "detector", +type: "tube", +r_max: 2500.0, +size_z: 2500.0, +position: [0.0, 0.0, 0.0], +material: "scintillator", +color: [0.4, 0.4, 0.6, 0.1], + +} + +{ +name: "GEO", +index: "pmts", +valid_begin: [0, 0], +valid_end: [0, 0], +mother: "detector", +type: "pmtarray", +pmt_model: "r1408", +pmt_detector_type: "idpmt", +sensitive_detector: "/mydet/pmt/inner", +efficiency_correction: 1.027, +pos_table: "PMTINFO", +orientation: "manual", +//orient_point: [0.0, 0.0, 0.0], +} + diff --git a/test/full/fitcentroid/fitcentroid.C b/test/full/fitcentroid/fitcentroid.C index d26d462c..20de08ca 100644 --- a/test/full/fitcentroid/fitcentroid.C +++ b/test/full/fitcentroid/fitcentroid.C @@ -1,21 +1,32 @@ -void make_plots(TFile *event_file, TTree *T, TFile *out_file) -{ - TH1F *hCenterRes = new TH1F("hCenterRes", "20 keVee electrons at the center;Reconstructed X (mm);Events per bin", 40, -800, 800); - TProfile *hReconVsRadius = new TProfile("hReconVsRadius", "20 keVee electrons (error bars are RMS);(Radius/437 mm)**3;Reconstructed X - True X (mm)", 5, 0, 1, "s"); - TProfile *hReconVsEnergy = new TProfile("hReconVsEnergy", "Electrons at center (error bars are RMS);Kinetic energy (keVee);Reconstructed X (mm)", 5, 20, 100,"s"); +#include <TFile.h> +#include <TH1.h> +#include <TProfile.h> +#include <TTree.h> - T->Draw("ev.centroid.pos.fX>>hCenterRes","mc.particle.ke < 0.0205 && mc.particle.pos.fX < 0.05","goff"); - T->Draw("ev.centroid.pos.fX-mc.particle.pos.fX:(mc.particle.pos.Mag()/437)>>hReconVsRadius","mc.particle.ke < 0.0205 && mc.particle.pos.fX > 0.05","goff prof"); - T->Draw("ev.centroid.pos.fX:mc.particle.ke*1000>>hReconVsEnergy","mc.particle.ke > 0.0205 && mc.particle.pos.fX < 0.05","goff prof"); +void fitcentroid(std::string event_filename, std::string out_filename) { + TFile *event_file = new TFile(event_filename.c_str(), "READ"); + TTree *T = (TTree *)event_file->Get("T"); + TFile *out_file = new TFile(out_filename.c_str(), "RECREATE"); + + TH1F *hCenterRes = + new TH1F("hCenterRes", "3-15 MeV electrons at the center;Reconstructed X (mm);Events per bin", 50, -1000, 1000); + TProfile *hReconVsEnergy = new TProfile( + "hReconVsEnergy", "Electrons at center (error bars are RMS);Kinetic energy (MeV);Reconstructed X (mm)", 12, 3, 15, + "s"); + + T->Draw("ds.ev.fitResults.fit_position.fX>>hCenterRes", "ds.ev.fitResults.valid_position", "goff"); + T->Draw("ds.ev.fitResults.fit_position.fX:ds.mc.particle.ke>>hReconVsEnergy", "ds.ev.fitResults.valid_position", + "goff prof"); hCenterRes->Fit("gaus"); - hReconVsRadius->SetMinimum(-200); - hReconVsRadius->SetMaximum(200); hReconVsEnergy->SetMinimum(-200); - hReconVsEnergy->SetMaximum(200); - + hReconVsEnergy->SetMaximum(200); + out_file->cd(); hCenterRes->Write(); - hReconVsRadius->Write(); hReconVsEnergy->Write(); + event_file->Close(); + out_file->Close(); + delete event_file; + delete out_file; } diff --git a/test/full/fitcentroid/fitcentroid.mac b/test/full/fitcentroid/fitcentroid.mac index 2adec710..9ab7916c 100644 --- a/test/full/fitcentroid/fitcentroid.mac +++ b/test/full/fitcentroid/fitcentroid.mac @@ -1,6 +1,7 @@ /glg4debug/glg4param omit_muon_processes 1.0 /glg4debug/glg4param omit_hadronic_processes 1.0 +/rat/db/set DETECTOR experiment "cylinder" /rat/db/set DETECTOR geo_file "cylinder/cylinder.geo" /run/initialize @@ -15,18 +16,6 @@ /rat/procset file "fitcentroid.root" # END EVENT LOOP -# Generate 3 classes of events: -# monoenergetic center -# monoenergetic distributed -# energy range center -/generator/add combo gun:point -/generator/vtx/set e- 0 0 0 10.0 -/generator/pos/set 0 0 0 - -/generator/add combo gun:fillshell -/generator/vtx/set e- 0 0 0 0.020 -/generator/pos/set 0 0 0 0 0 0 437.0 10.0 - /generator/add combo gun2:point /generator/vtx/set e- 0 0 0 0 3.5 15.0 /generator/pos/set 0 0 0 diff --git a/test/full/fitcentroid/standard.root b/test/full/fitcentroid/standard.root new file mode 100644 index 0000000000000000000000000000000000000000..7522f1e7d135c302b1d0d5bb819a6473372d1fde GIT binary patch literal 8109 zcmch6Wl$Yav+cnpxNC5C4^D77!QJiPmUD1|LvXj?2_D=nxVyW1Ai%*TNVp{T$G!jF z`|;j4RXww7Pwm~)tGZ_O?ge&sb_D=#i~s<DB>+HC@oGe`<CIr}d9_>k*Bb}`Kure# za1{YCE%@~qO(WQ6xxL7MlCF-k*SG&S7YsMx??%NQ1j*ijsDC@ZdIJCuG-YiaK(-u? zAWK^_4hLH&H%}9Yt1}qH0R}-pW?%~&4i}J<69>o{!T~mObuqKx<}e4FIa%0%ARG?P z7G@4?AWs(%*wzu`<jUa+g1B;6xj8s+SlPN-yv~4~Z7n%0+`!=1F+2Egr2j!z0EEBM z{)-p@!}l8O?W_HZ8UP^Q{Xap82>go}%ErI-N`Dc9N&UMXUQ?b+7S%@TH6jpL9R#7| zVdLVX`~cFX1UY~#UL$sbP@1_?y4rv!{~`ba>jRPR5da$~08f~9Z4^~aIV|$jb#(SH zGCSmqaT2;}!^rS*pC@t4b`<k?B^Z#NSoH`Us}2@AvmI6sC?2n%npO=<rW;Om4nZw} zk_q4Nye}Xq2#+4s28-K2t^`jzwsxk|+xQNsa`*ImR+J(LMIewK9v3hb1aJvJ^v1HK z&c<e??J1BhV8QOMt!r$s7Q}taN*#iwMAO@wr%TPGL;|etLnY<ad83L~#}^Nj<DU8y zLi@Rv@P#Cvmk>4{o~VS+hX&_sf5Z;0T9P3O7nn6Bnm{Q6kV-fz!kZiew1#B{kkCY; z5LKy8V2#D|+)vuiDijw)%W?v`$n=D2W#P3-R0nJ+0Vt6&K!1Dei#_UVf`PAuk>)a3 z39SAKMBLBC+xU;Nvb~SPx9jjQ$XX!+-Yic#mYxBKn?4fPOs(@i+yo$`Bp;(%b35|q zhwECnW#w8RMgPeBy92(1*y+toA@|vVU%w=N{i#9LLUbuo4`^g|RoiC9f2hNQMN>cW z<1S>kVwzSe6lT!`2r_3CNV^#p-ri9dINo(q!SnJ+NHM%gDEbA=OD-UerUn~WMky1; zAi7clG>j?4nZF`N<mKa`lc*Kf(kBjU@=FTdXfwwp*_N0y1|d??Myzqb4Ye;cUra2J z+}Ntqzy~NSkbOn@pj@E5=oS%hjp*+Gutolq;&pwQAnI4e7C+w%|8mLYPE_>!?9)f1 z4m{WoKy12jpK77jvn~<rrYk#b6$NMUxaGO2awDqU7DA1<p?1Nxx#HxyRC+Sw)0Hlr zKbcBia0GuKW8AC19Z-Vlx%MvGm1256uz`Pne>^r<dK-6H=1ArNsY1V?@S%0XNNYkC z!@H9{BwZ&!o+Rok($Yij!Q?fg^3X;Br)w!AT&=_NaXmJT>R2MTiigj4a9?uqe_UUW zs=Z0${Nczij9QdonuF#uODKM0dQowa<R;b<zF(+Kv9BIoGi$_@WACt1li4J4pc7_q zA$9bjN36;CQ!U}04NE^o)4IJ7@C~I)ao&3*>MBf3MtR#DALchIdm`?h#8+%NzC&F8 zNc+Ub4#aJ=oe6Qd&l``jOC4JG^HSf1px)xU<birIX`ZC#)=v^~415jor3^9Ra~W^Y zg~6n|LPYWN_)cXlVkr9A_9dgMuH-^4NT@$QDt_CINzaGb)awOZTVYN<=1*y@Iu!0f zB@eycZy0^J3GDd!p<Fo?>HTz#-1p(%i>81=-|0(}I4N_DZ`e)cXgJSKYdt9k@wz}q zLDd%oyr07i1oasb382Typ0MI?Dz{uoNoX2}38a<dwo3q=wmG7PIuXn?<Q;Yfpi8ie zlvcy@4ac|k>@?1&T6{~)_4D!>UqE`B(%lG@SmJqvf|<dq=zWYs&eQL0f+t&jKUfYP z3TKXyW%5T_MCTc01%1v_%(h<+KNSY|bnfHeykvxSNJN5nRe#WPVZ=Emkzqe@yL6f# zy4DF}oAj02uexW(8o1v)wur5LKGu1r&ldO+`ds-#wBCaf)}CGW$C(QUzOdOQ)YyB8 zc-6Ob@BV>Am=%>orE^p-rh-U}Ys}L$SkEzeaza62;Ba5gF-u7u;m%snv3QXcTT{Cs zutD%9D7w-%T}Sc|cE{^LYxEf(c4IEGAeI`^-8ax@)Nc^=`;Nun&C@6S`+dR_!a3(Z zp`C@Z&4si4!Dpo}=g|&<1i1~B{0wQsTQ`;bCrU)%11;n<j40>RZO3%37(L@ZAx$S6 z7b>H&c3z)F$9S)F1)MUKIIU|&;h-B#25WS|o6$*&BYTp=+EuKS+X>&Msi<q;Y66Vr zI(|f!@ML*<J6RLlEVN7$<hCX-Jxm3sfS$~C;C|<xr`ICepbYz%;L#(5mrR5(qJ2Yj zETm=B4539msNg?upxmJztFT^OGWe1?sOOW^*m0t_fvRD0+nnt%Lrlv;toL!_J>J|) z6}!MZ1-dHDQCjjmS^{)PvJE$2au;h6j*?d*njMdd{6enejC#k^l12)_y$Z}Oab2XM z{!(?#5DL;O0RUi|{&ESt;Xf`h_{$|oJAb(ZSyL74Z1qaO7&hu43uh;7h>Q~mZ0*G; z^S`O&ziEV$5d;Q1gDK6;z^?=Y22rYi&|rGy77bW{A^a=1Kuk>|OievZP2DX_-Azq} zdb_r}y0&_{kV7Q8#=5$?)3B2>vT_NvPcqW<la0S`XC!49swd~_l*jAl#b;&cB<dG@ zP0-g&HYtct)`iDoQ`ADfL|=f<=<V);=a0Z1vVyB6{$c{FXNaZth=_=__3F>Yatk)` zmwY34wKlD`B|(&@^+92(B|S?)(5d#+`3H13;_{xZp02KY%<}FD?+Z6}gZ*PeeiO`_ zU^Il9KyG(5G&B(mG6@`HvTI6S_8FKTG|b(xfXB|}f)d^qT0R*n$@eq@X?Su0QaF}1 z&q#&~Qhnq^MBr{Js%RV>ElN2~0A0il-!uU%&0eUK_>?7O*H=ugss$6#-LT%f)Df*y zAP*UL_XrV&ge@|r@@2Pf><s3H$@KWsc1h}_=hJL0T&!I`VfF-ymryC|=@fhWW4D^| zcTGzBZf!YyIXGyhZxY%3Eab{Rl~d3z_u1(XKjXM$q^Q0#Y<f`b=A_9lNrNi(m*@ps z((H>M$+Q1N<N6qq6(*wuJh5&d6$1R23rBAuvBXgf4741s0x8Hy`C#BJ<Nhy#l=OKQ z%Hs3oUXvFu47^Q;R#%rl24S2FKlLhB{oes?%%J=myL+5eph3{Blsi(9uS!iOSpJtp z*i9AO8|Pd>PG6SC!Yfn-3~h~~alB&_kFQhLdm(u-+w!+Pr>^G?fH%S+WC2rVrjgxL zWFwg1fN(j9{@|}W391)ZMCd7)pJ!CPkTHSg_b*+g3j%+VMlb~F+jcXvijL4VWjs7! z04xK`0srdF*R&P&{Fk;8f7AAF6$-FK&;;5-T+uXK!5}k75Lm&<${9!6+0ER+i}JOC zv<F$fJ|M2Ixe0>{@DzQ`%~Jy(2l8dT7ZE?Y#w!=&Ou01jw)L3PwiAa&t+yNG46zC; zv>3;kcUA%rU+WWvgN=_?2LrcGjXtBW>*|_~t_aDMeY+}uf;t%`C9%Gy08pr?7-0k9 z{ktfp@bQ`RDA_vCgslg71Qu`G6;{+EEXHT8C(b@?dQ992{nY0r&|ql5j_hVgb|h%< zJ*7$RaU~OSUq+eKUJE$CU9@cveaUbAG!+Zc*@m@CKBVw_)L=MwB(+;lb1sf-8tk1i z-Z^v9@Ohh;{c%c@4+%08OXl||)Uf+0LdeBW41p#O3ajsCwc|H;Z8fG-RD^0p>3lw! z^bWk=F52l&`Ixu6cYkf$CPBe80TZlT#XUMzl^A#h3jE_q&^ikedc@B-O36|@Y01IG znSK|W{Z5;8eM}ypE8S!_=T5d*X1Vngx%EXai@j;9zhkyI(A@7U0jGrYYC6d@x*;3( z;%&WGILkJr?Ll>$`?m*<ofQ)fI=HT}<jMUnbZs20<54A_xK+FHg)j;wr0X}@H7}sr z*>$+Wd`wzi6Ln5-cJ5ocHP>1!2?7Qm6^nEt*z&+J(SnBL+%A4bE=YCF*-!<J*ha$k zr4Y}jMB;vT!<ey9N>=P?da`ji?hBJL6rLl2&~%kTUDJby9%A7P;h!>G&&$>me_%2Q zoVMYrlQt@?89L%o*_lPE!;SOZv))MdLTrCX&*^RPHv!@2^ExdbjQ24P?}&@uU;Mep z^cQ#(BHqtlORHMc{OPYE)X9hNUI!2PXi`}1H%rMF`OAzVxruZrQVAyqxsK$E<qAEv zBP&qYLj|EDPVg5(il}F)Pzv!N`$Mc?Qis5xN{-}d*vQNMU}uhRdOWq^<5dRrKB?r$ zpt^3nI+But@Iunp?@iUfsW{fn40o<bDIa?Ns44w}XlFUK#<St)6#s`=%tW6Kdfo;p z5l54X?-386Z?-zAMXanxvYdu12j?g%3kElmc0U)`^7J%41CH<BM|krUjyZ4xJf#pX zRTbgQq9bP3)B+E9;TEHR*5(6VC<dp?574g1a_M@hYY|RDMV9LCK3iy)?&slhXYC4u zN{*0AX?X4d!{z!~DD_gy)t^%B6vaGb#Dvv(d8;cq-wyt4i<CO^$Q6r1M4uCndSK1E zNC|-`;U;Lkz}eQ>6b|n5bBzU6BjK9d<5wqeT?Z=d&Jd3yP?ZhQa~18<ZK@GrZ|2Q2 z#D45&>4%_N1UhF9nnJ}jG}ip>5TGjF9V!&h<L8r*I)dpizQWEwEjf=sLK0dz$O}EO zXDhXojdRZ9T9J!?Qk3xQ=a*iKVi{~+6k6&bKm#Mv!8D;=q}&;DoO@B9X~^w4vZ!;I z$5sKF=yRw)-M0EF-=}Vi>%rrezPg|mR|Cj*dBhxJeD+fnQu;hGod)JlD|t}-B+gmI z3F=bL!QZ+y1^EpH)3vdSS20r|dcGtTGRk_=GBJ>BG!dr!Ovt%6pH{iFH!jf{?i^99 z){RW@F%rK$nvf2z*Hp-m#qtd-1eYVegl!{~06psPD1)SS^*HpsI%N^eoT-UZ6K^x! zK9ICk^Bs?n!pr@>$rp)z_ozeRl2ODbgPV#7#&b*x{I^^BiN6+Q>K|w5Q7XO;ujeDt zx77+F`O|zsKfNSDgj(d*|3Nk>qT_NoW=(eq^3XUhLf{y@h6eQ^CuQ#SC>p$5o=P-6 zd!FblW^7gnSn0a!$Sp(3d=O)B_@!bCoB4%)rd_)DL9qmt{ia=ivT)rd8FbIjEYjun z-rFeExHGv?-gb<~FhDf;=8k$6U2>Lxc_PJC!W`pr)=z`%p6Zh;s$At^IFoPMj79gi z%J1yuhtx#}*0`&0W@E8U@ycpu;~^`Oq9K-mqgdGtZ1XCVnqEC~goybaelez)W}z(Y zVf5{<h9ONdfj^jC1k<SU8y;?04aq;0HGa0ayD5kpt`27o`rHyCj<?{k4h<z9yvz3` zRImDWsFl|}9r5kC=xLBlM1;!{`oq=cR}QYZ3p;1n?^!K;SYa#zwd6NhMVbYXcLGCQ zdI-&elbxgOb{yVnFIq_)R>KiilFniTS3I)Pn|(FrN37AiG*LE1vYCG9i(00YC}Rz0 zd}D5bEq`=5o$aV(Ed%KJ$OmgBPd=)wY$qSfDnG4l9S#i*xlm$CakE9a+f0ltQ$0xl z)i=}8b%V;W|0WM2s@PZQERW%8P9sY+^2wemYtIW;vC66bc`xp*DLB|a83AQSiC4M{ zEyXNf9+c-gMS`}kE=hxuN-+&d(kgKVzr@m+1yi;wBjzN(9YR=;2TIRh_B2Xjt#$|+ zvDGyiyR<F0G|QC8<GRUxCEGqsV3qrUKeufS)}3BwUgMI#z&69KKn`8Dp({S(J=wV> zE2sW=&)m?btg8>hf)Z1O5`$FBTdBdz{?@OQO25oACNDohWW#H$AKcJpU^4F0XyRrW zIrjLT3<6tDhm#q2&5WvUL_rGvP<h)*7*s71Q7wYpbWw5Y<Ghp=#cAZVOcHU%Kef4w zuWT!cN&Idy($r*(=Rs37BG~Re`qFl%i`8qo&6%THF4bQGWgYS<hnHh}DZ-*Z?>QeO z>d-i*akW`{sLM+^Ks*5f3g%)W#K0`5#4BP^N&S3Pgm1}6HLPcqqB<dS=3ab|KKN{{ zp34<a2;6-a%Vz_u%ctPoy6Xot;!&Z6`$eH;5r$k3vmS{;EgPtriVwE})2<2W-%Tp; zTrem3X9ly+1Q!`GrOywcEOYq~Be9I&E2S0eerB^Izb@~PeZ^Zmvu?8;I$U}zM1_Ry z`>+wMi8n1XE{JY2%=Nyug7|G4(-iY_f>N`)ee=2iw{Np;Etf8L)C`NODg0n*pF2ww z=h#i{Ts5I16@IzkIX|(dK91U6^o8u63CrwIOAdxqbR>lqjg+4Gp4mInH|d@{)l|wv zh*X#feCyx+0w{#tN!aq|16C34ky=^Kk^+l46m{6G<oadP9upoM<=Dac@}D@RiEmls zFr#7WBERs7;L$?Kt)pg)`R9LBlzIqqqAgb5@I@%JuF%qdSL&!OlU<zDK0rxmmC5!G z8wpnwdZ`s-UJgJNx%aop!zpsW&0PprG)5OQXG>0{{c}_uPqJ9s4n)jhk92@|)w18g z3jZQaYk%ukKtGV^K5os|6ZuEE*r(w{t1<Tt0kD{t<+sw}n{Ubhc(NSnGUWo$A}W)? z1%gw88TR)QVZtlU<o4#>nI{oh8`#ewm-%K9DMRM-EgyB#HCC0)zwqD{^p&}a{Hh8n z&_0n=m`(YxK4<oUdl2iLUB^Z8>;RUoy|NEmY2LtakrVi~cvck2%5fi8>F2a6)DABW z?G05jT1%GC5*>?Dm<Ld}dY2B+?`E&$`*pah#(en;yA@r_iU%JfJHa$5?88wx#&Iv$ zbU9rWqwi32A4@VbB=meK-dMuUNJLN>B3ENU1G5drSwm?j&cQNpk#CE#@10RYgWaSq zwdLu2B@D?UC3anCN(Zo32mdU)+Ty3zdpRf^$8F}s4i{wa@Y{56SnOLqIZO(l?V%cM zeu0X20H+xDCxofG%7HpPKUb+anRhCrUZK%UH~ZL}_jWfZ%Sn|B==qgZ3ECg0CXwg@ zWK`%>_rLZjb?8RglW6?FI5hk@kf9qq!Cr$nYL5~hQ=r>NX_JkNzjSd|f*Cw@p>u=y zjWC3}AwI1nrM!*4wk?Rq@Dl2UEmG$YMB~da{cFf&9|4jZQSH?XCK5<dyN$@m&e+Pk zrW)-JUKYD<2Buj?dJLt52970ao6YL5Y14TTD_K%`i9Gm>-9PPVDp!$Ez&0=;01*Zl z$EgHKY*QLw(J%&cLsU8=RCabmU{z_3<7b6^BWY8%mde>%5;iTpS0p!da8u@&1V2RX zGtft_FUEZGmL{Xc2kDN*!^~yoDT1dt$`aFse`bw1h%|jLvNYW))Eh`dh>JWJ)`#HL z67-9q_Wy7kW!<|d=B{Vku3)Nt8#+j~mRNm(U9(^qW2PO%Pkd}Ji=8WF?>8qflCVdB z%nK6PYAVYAqt=B?eE-uf59cw*DY-tEtnhp}t^=j}T5s;rNHdiG<k`KQe=P#l<~VFn z^x)I;3&ZKWH|?mh;?5&!s_sFUgQBt*<K!m+5lHiBKj0!$KftUGXC*}s=|kl#5_`;O zt<Q$Mk4T6$2UHvSdv}*gnBy8$ch!=`?*3tHRo<jf3CFWXA19HroFJ2L-2Q+Wpm8~3 zkT{0Yrg)NSYW)o%K6kEujiFaEQW5Vtz5MwMz!sG|6yLL)6}}5iBm$-q6A=IWNlSwz zbTxEN4WeQaw#!*!X{FGZiL0B5+YcZ`cWbS+s7R;xd6Sgo@MRB^HBa{Ad-m-xz5*`= zX1=1tU2LoflJS7!_~O!|VJqUeg$p-x@EN!Ha5_493Yo`84b%~`=>`nLg|6jiH#dxR zrgAhTW<NP0R|&EO-D~^!<(`vA7|Vprzz_wW#Fopd1F-jOD8!-GFJtASadP(qnA)&$ zUKA=LoD9^d7Z^V%b<o=pi;Co|i~M#feqN|6Wk{MDb63sAfvi%3Mj`hQE*idg)Tx>8 z+ZlNLvrx`iF;3aaXKq|n=u8WvV7*(BvA*goMKHV6_klvb_@sYdS&J_Cvi)Svny)xD zM8l5n+$B{b8(Qx>Io;xa-rtV3z3l1+t3UY5^w}c(m`zln%u>Q8FuaUiU1dQmYi46l zn=QDcPh@7RF>cNJBZ~c4rO}N=>_dh!{!=uxOGO?Ds)Pi#jY6-*fDlCZFnajYwkRMe z_Qd1`pTM+kyRhfyE!tOSw$b4SiK-^@ddhiUrCuLsL;#lzD<OimYB#4e>4kwoeuLiN z&rL4uV}kg4c&4f6MX1USTQt0;A8B4sP{)Z2tPajY<8BRyaWeTpj2E5n=r?|PLi%Iw znnmeGu@lx0>CDUf!#S2UNaTGSBG1fA^wAqZ!51*=$F6-ctjn|SwCPOYqTd!ZyYo!_ zn6xkQOMNXlQ{tJKtn6}qm>DOL5(ZhsCqY6Ybx$i~ZJfSGB2_<fGg@8Jg@YQk&*a60 zxQ(R;C>=>RUE6e$<iG8%%MRnR$&-*i#N)3Z&UJ=9WQnxsQ?MiBmcQU`!&=oau9ueJ zG$ek>(C3HCT-O*%9Al3HLA)QO=a3I#-sLTOL8yeunp$={a?NFDmC1w)pOd^#Lv(n0 zy97iR>ub1d#K=Y4<c9jJ&@>V8Kd_|S@rnCs-(L`?lON&mU(uwK`#?7ZlCsvg%TGFj zf>|R|u3}kItw(R4P@a>bpIzkc7?O14vr%iv`UYy?2EWWp8}n*$^x9F)0@rnir)sZ? zc~R60PB!f*e8^6#?5dK`gAd`{H=;@ohP!4Rx5p#OOOkoSLt=bJ!UQnC;5P@ZjNYDt zYb>p|3{YtO6i4^j5~6DPkKEBy-{5Gfrnw{E_D@4ccPy)m2DkcGK{9jE)2rpac+XO~ z+kHx2#FkZp#y&;}vGqzv{VWiSwM{GoO`zp!**zUH$L;rn7Fhejsr1kwOs-7HIRE^v z*QP_8BvZq)?uTUc)zQ4<+k%|{oRKn(hhz8MC>s*}PRBQ5K~{Fh-xq;n3iTs-1Px#P zEY<MTipyjSzo+?fRg?%6*Fhs};6uoRj0n`qOco1%zaKE3TzZl!v6<!Oc6J5QZ<N9b zeU!N9MH!2huDAHw`uu}$8}!&j%5)!P7O=jA;rp=Jp(Vl4s`jFyO5xz(uR1v(-MuLn zibUXdNLNrooV425|HGQ$^RL@h*#lF+XqAX%Qrd2{Te<qjPmM;HDK8Hdqn(Mq>6Tn8 zY~{I!rzB0oT^b5~UxXqZ#A}*k_Z=Fv>~-j3Zf*|Px(D<Ln7MPcLH1Tj^7$27-!VXQ zZ*_K1SsmXA-^_?C>@8VZT-m%~xfCrfBqyiYoc_g>c{c7yeCAqZ#^si#xE$_3;k3vH z!5V-|4Qd$;GMJaqn^@vSc>STO6K4*7wok?z2OZuF)D(Uu9jt7S&8*T(H&Po0<zK%} z4ZKdFH-(1<$Pz@S4OLg0X$>5CmX1t$I5_ux#@Nu~%|i5NfwFohn?)UM-a35vJ|oKg zOtG>r_TIbnV(dX>u79o=^SD@yg^~BxcXJ=Qu&`8~4V)Thf=dZ9gIuY$_+0nWET=`N zZ#zOAH{+LrvMKx?viD7()O^t0)8t1*t#qzl>IdiVG04)t>Bchsha+#DEee_k&T$E! z6mduwtg<woSQ=|!nz!Jr9K!09vwVZexldZ7(btH`TLiy~C#-md`7VupMy#3~G@Dsj zlDHLzn-Zq8cGwy>d=AcniT?IkZ=Ygp;b-dSSeg~vdkP3z*+xg4(BOCzB9Q(z&Ca!_ z@1~t~`m9{KzL8tO1b1Y1k@ym`?aMdu-+(?k9y%$#%U@e8k^~Qv+4(OBkhM&bSLu-N zpZr?-uaovqeti`n|8>&-!}9B^Q&<4t|CzS=|FO0G`lTuVKtuf>(EcgoukFYGG-$7# MPl^f;zGT3E0RwQ(1^@s6 literal 0 HcmV?d00001 diff --git a/test/full/geoprint/geoprint.C b/test/full/geoprint/geoprint.C index 88ad7154..55a7006c 100644 --- a/test/full/geoprint/geoprint.C +++ b/test/full/geoprint/geoprint.C @@ -1,9 +1,9 @@ -void make_plots(TFile *event_file, TTree *T, TFile *out_file) -{ - TH1F *hStepSize = new TH1F("hStepSize", "Distance between volume boundaries for isotropic particle tracks", 1000, 0, 3500); +void make_plots(TFile *event_file, TTree *T, TFile *out_file) { + TH1F *hStepSize = + new TH1F("hStepSize", "Distance between volume boundaries for isotropic particle tracks", 1000, 0, 3500); hStepSize->SetYTitle("Events per bin"); hStepSize->SetXTitle("Distance between volume boundaries (mm)"); - T->Draw("mc.track.step.length>>hStepSize","","goff"); + T->Draw("mc.track.step.length>>hStepSize", "", "goff"); hStepSize->SetMinimum(0); hStepSize->Write(); } diff --git a/test/test.ratdb b/test/test.ratdb deleted file mode 100644 index 38f80462..00000000 --- a/test/test.ratdb +++ /dev/null @@ -1,41 +0,0 @@ -/* Sample RATDB file: used by unit tests in TestTextLoader.h */ - -{ -name: "MEDIA", -valid_begin: [0, 0], // special value meaning "use this by default" -valid_end: [0, 0], // Notice you can use C and C++ style comments -index: "vacuum", // media code - -media_name: "Vacuum", -optical_flag: 1, // Integer - -/* Refraction */ -refractive_index: 1.0, // Float -refractive_index_img: 0.0, // Mean imaginary refractive index -refractive_index_poly: [ 1.0, 0.0, 0.0], // Polynomial for refractive index as function of wavelength - -/* Absorption */ -absorb_coeff_scaling: 1.0, -absorb_coeff_data_wl: [ 220.0, 800.0], // Measured wavelengths -absorb_coeff_data_abs: [ 1.0e-6, 1.0e-6], // Measured absorption at those wavelengths -} - -{ -name: "MEDIA", -valid_begin: [0, 0], -valid_end: [0, 0], -index: "h2o", - -media_name: "Light water", -optical_flag: 1, - -/* Refraction */ -refractive_index: 1.342, -refractive_index_img: 0.0, // Mean imaginary refractive index -refractive_index_poly: [ 1.302, 0.01562, 0.32], // Polynomial for refractive index as function of wavelength - -/* Absorption */ -absorb_coeff_scaling: 1.0, -absorb_coeff_data_wl: [ 250.0, 350.0, 400.0, 450.0, 500.0, 548.0, 578.0], // Measured wavelengths -absorb_coeff_data_abs: [ 1.0e-5, 1.0e-5, 1.3e-5, 6.0e-5, 2.0e-4, 5.8e-4, 9.2e-4], // Measured absorption at those wavelengths -} diff --git a/test/test2.ratdb b/test/test2.ratdb deleted file mode 100644 index 4e9c49ed..00000000 --- a/test/test2.ratdb +++ /dev/null @@ -1,35 +0,0 @@ -{ -name : "TEST", -index : "foo", -valid_begin : [0, 0], -valid_end : [0, 0], - -myint : 4, -myfloat : 4.0, -mydouble : 5.0d, -mystring : "default", - -ia : [ 1, 1, 2, 3, 5, 8], -fa : [ 1.0, 4.0, 9.0, 16.0], -da : [ 2.0d, 3.0d, 5.0d], -sa : [ "larry", "curly", "moe" ], - -foo : "bar" -} - -{ -name : "TEST", -index : "foo", -valid_begin : [-1, -1], -valid_end : [-1, -1], - -myint : 17, -myfloat : 14.0, -// Do not override mydouble or mystring - -// Do not override ia fa -da : [ 1.0d, 6.0d, 24.0d], -sa : [ "alvin", "simon", "theodore" ], - -foo : "baz", -} diff --git a/test/testsimple.geo b/test/testsimple.geo deleted file mode 100644 index a7538997..00000000 --- a/test/testsimple.geo +++ /dev/null @@ -1,101 +0,0 @@ -// RATDB file describing simple detector geometry - -// -------- GEO[world] -{ -name: "GEO", -index: "world", -valid_begin: [0, 0], -valid_end: [0, 0], - -mother: "", // world volume has no mother - -type: "box", -size: [20000.0, 20000.0, 20000.0], // mm - -material: "Rock", -color: [0.67, 0.29, 0.0], -} - -// -------- GEO[cave] -{ -name: "GEO", -index: "cave", -valid_begin: [0, 0], -valid_end: [0, 0], - -mother: "world", - -type: "box", -size: [7000.0, 7000.0, 7000.0], // mm - -material: "Air", -color: [1.0, 1.0, 1.0], - -position: [0.0, 0.0, 1950.0], // mm -} - -// -------- GEO[tank] -{ -name: "GEO", -index: "tank", -valid_begin: [0, 0], -valid_end: [0, 0], - -mother: "cave", - -type: "sphere", -r_max: 3600.0, // Outer radius, mm - -material: "StainlessSteel", -color: [1.0, 1.0, 1.0], - -position: [0.0, 0.0, 1950.0], // mm -} - -// -------- GEO[buffer] -{ -name: "GEO", -index: "buffer", -valid_begin: [0, 0], -valid_end: [0, 0], - -mother: "tank", - -type: "sphere", -r_max: 3500.0, // Outer radius, mm - -material: "MineralOil", -color: [0.7, 0.4, 0.5, 0.1], -} - -// -------- GEO[av] (acrylic vessel) -{ -name: "GEO", -index: "av", -valid_begin: [0, 0], -valid_end: [0, 0], - -mother: "buffer", - -type: "sphere", -r_max: 2700.0, // Outer radius, mm - -material: "Acrylic", -color: [1.0, 1.0, 0.0], -} - -// -------- GEO[scint] -{ -name: "GEO", -index: "scint", -valid_begin: [0, 0], -valid_end: [0, 0], - -mother: "av", - -type: "sphere", -r_max: 2600.0, // Outer radius, mm - -material: "GdLoadedScint", -color: [0.6, 0.3, 1.0, 0.2], -}