| [bcf653] | 1 | /* | 
|---|
|  | 2 | * Project: MoleCuilder | 
|---|
|  | 3 | * Description: creates and alters molecular systems | 
|---|
| [0aa122] | 4 | * Copyright (C)  2010-2012 University of Bonn. All rights reserved. | 
|---|
| [bcf653] | 5 | * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. | 
|---|
|  | 6 | */ | 
|---|
|  | 7 |  | 
|---|
| [77bc4f] | 8 | /* | 
|---|
| [f844ef] | 9 | * BoxUnitTest.cpp | 
|---|
| [77bc4f] | 10 | * | 
|---|
|  | 11 | *  Created on: Jul 30, 2010 | 
|---|
|  | 12 | *      Author: crueger | 
|---|
|  | 13 | */ | 
|---|
|  | 14 |  | 
|---|
| [bf3817] | 15 | // include config.h | 
|---|
|  | 16 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 17 | #include <config.h> | 
|---|
|  | 18 | #endif | 
|---|
|  | 19 |  | 
|---|
| [77bc4f] | 20 | #include <cppunit/CompilerOutputter.h> | 
|---|
|  | 21 | #include <cppunit/extensions/TestFactoryRegistry.h> | 
|---|
|  | 22 | #include <cppunit/ui/text/TestRunner.h> | 
|---|
|  | 23 |  | 
|---|
| [57f243] | 24 | #include "LinearAlgebra/Vector.hpp" | 
|---|
| [cca9ef] | 25 | #include "LinearAlgebra/RealSpaceMatrix.hpp" | 
|---|
| [77bc4f] | 26 | #include "Box.hpp" | 
|---|
| [ad011c] | 27 | #include "CodePatterns/Assert.hpp" | 
|---|
| [77bc4f] | 28 |  | 
|---|
| [f844ef] | 29 | #include "BoxUnitTest.hpp" | 
|---|
|  | 30 |  | 
|---|
| [99f4ee] | 31 | #include "stubs/ObserverStub.hpp" | 
|---|
|  | 32 |  | 
|---|
| [f844ef] | 33 | #ifdef HAVE_TESTRUNNER | 
|---|
|  | 34 | #include "UnitTestMain.hpp" | 
|---|
|  | 35 | #endif /*HAVE_TESTRUNNER*/ | 
|---|
|  | 36 |  | 
|---|
| [77bc4f] | 37 | /********************************************** Test classes **************************************/ | 
|---|
|  | 38 |  | 
|---|
|  | 39 | // Registers the fixture into the 'registry' | 
|---|
|  | 40 | CPPUNIT_TEST_SUITE_REGISTRATION( BoxUnittest ); | 
|---|
|  | 41 |  | 
|---|
|  | 42 | void BoxUnittest::setUp(){ | 
|---|
| [3308b6] | 43 | // failing asserts should be thrown | 
|---|
| [77bc4f] | 44 | ASSERT_DO(Assert::Throw); | 
|---|
| [3308b6] | 45 |  | 
|---|
| [cca9ef] | 46 | unit = new RealSpaceMatrix; | 
|---|
| [9eb7580] | 47 | unit->setIdentity(); | 
|---|
| [cca9ef] | 48 | zero = new RealSpaceMatrix; | 
|---|
|  | 49 | invertible = new RealSpaceMatrix; | 
|---|
| [77bc4f] | 50 | invertible->diagonal() = Vector(1,2,3); | 
|---|
| [cca9ef] | 51 | uninvertible = new RealSpaceMatrix; | 
|---|
| [77bc4f] | 52 | uninvertible->column(0) = Vector(1,0,1); | 
|---|
|  | 53 | uninvertible->column(2) = Vector(1,0,1); | 
|---|
|  | 54 |  | 
|---|
| [cca9ef] | 55 | RealSpaceMatrix boxMat; | 
|---|
| [77bc4f] | 56 | unitBox = new Box; | 
|---|
|  | 57 | stretchedBox1 = new Box; | 
|---|
| [9eb7580] | 58 | boxMat.setIdentity(); | 
|---|
| [77bc4f] | 59 | boxMat.diagonal() = Vector(1,2,3); | 
|---|
|  | 60 | stretchedBox1->setM(boxMat); | 
|---|
|  | 61 |  | 
|---|
|  | 62 | stretchedBox2 = new Box; | 
|---|
| [9eb7580] | 63 | boxMat.setIdentity(); | 
|---|
| [77bc4f] | 64 | boxMat.diagonal() = Vector(2,3,1); | 
|---|
|  | 65 | stretchedBox2->setM(boxMat); | 
|---|
|  | 66 |  | 
|---|
|  | 67 | stretchedBox3 = new Box; | 
|---|
| [9eb7580] | 68 | boxMat.setIdentity(); | 
|---|
| [77bc4f] | 69 | boxMat.diagonal() = Vector(3,1,2); | 
|---|
|  | 70 | stretchedBox3->setM(boxMat); | 
|---|
|  | 71 |  | 
|---|
|  | 72 | stretchedBox4 = new Box; | 
|---|
| [9eb7580] | 73 | boxMat.setIdentity(); | 
|---|
| [77bc4f] | 74 | boxMat.diagonal() = Vector(2,2,2); | 
|---|
|  | 75 | stretchedBox4->setM(boxMat); | 
|---|
|  | 76 |  | 
|---|
|  | 77 | tiltedBox1 = new Box; | 
|---|
| [9eb7580] | 78 | boxMat.setIdentity(); | 
|---|
| [77bc4f] | 79 | boxMat.column(0) = Vector(1,0,1); | 
|---|
|  | 80 | tiltedBox1->setM(boxMat); | 
|---|
|  | 81 |  | 
|---|
|  | 82 | tiltedBox2 = new Box; | 
|---|
| [9eb7580] | 83 | boxMat.setIdentity(); | 
|---|
| [77bc4f] | 84 | boxMat.column(0) = Vector(1,1,1); | 
|---|
|  | 85 | tiltedBox2->setM(boxMat); | 
|---|
|  | 86 |  | 
|---|
|  | 87 | tiltedBox3 = new Box; | 
|---|
| [9eb7580] | 88 | boxMat.setIdentity(); | 
|---|
| [77bc4f] | 89 | boxMat.column(1) = Vector(0,1,1); | 
|---|
|  | 90 | tiltedBox3->setM(boxMat); | 
|---|
|  | 91 |  | 
|---|
|  | 92 | tiltedBox4 = new Box; | 
|---|
| [9eb7580] | 93 | boxMat.setIdentity(); | 
|---|
| [77bc4f] | 94 | boxMat.column(0) = Vector(1,1,1); | 
|---|
|  | 95 | boxMat.column(1) = Vector(0,1,1); | 
|---|
|  | 96 | tiltedBox4->setM(boxMat); | 
|---|
|  | 97 |  | 
|---|
|  | 98 | } | 
|---|
|  | 99 |  | 
|---|
|  | 100 | void BoxUnittest::tearDown(){ | 
|---|
|  | 101 | delete unit; | 
|---|
|  | 102 | delete zero; | 
|---|
|  | 103 | delete invertible; | 
|---|
|  | 104 | delete uninvertible; | 
|---|
|  | 105 |  | 
|---|
|  | 106 | delete unitBox; | 
|---|
|  | 107 | delete stretchedBox1; | 
|---|
|  | 108 | delete stretchedBox2; | 
|---|
|  | 109 | delete stretchedBox3; | 
|---|
|  | 110 | delete stretchedBox4; | 
|---|
|  | 111 | delete tiltedBox1; | 
|---|
|  | 112 | delete tiltedBox2; | 
|---|
|  | 113 | delete tiltedBox3; | 
|---|
|  | 114 | delete tiltedBox4; | 
|---|
|  | 115 |  | 
|---|
|  | 116 | } | 
|---|
|  | 117 |  | 
|---|
|  | 118 | void BoxUnittest::setBoxTest(){ | 
|---|
|  | 119 | Box testBox; | 
|---|
|  | 120 | CPPUNIT_ASSERT_NO_THROW(testBox.setM(*unit)); | 
|---|
|  | 121 | CPPUNIT_ASSERT_NO_THROW(testBox = *unit); | 
|---|
|  | 122 | CPPUNIT_ASSERT_NO_THROW(testBox.setM(*invertible)); | 
|---|
|  | 123 | CPPUNIT_ASSERT_NO_THROW(testBox = *invertible); | 
|---|
|  | 124 | #ifndef NDEBUG | 
|---|
|  | 125 | CPPUNIT_ASSERT_THROW(testBox.setM(*zero),Assert::AssertionFailure); | 
|---|
|  | 126 | CPPUNIT_ASSERT_THROW(testBox = *zero,Assert::AssertionFailure); | 
|---|
|  | 127 | CPPUNIT_ASSERT_THROW(testBox.setM(*uninvertible),Assert::AssertionFailure); | 
|---|
|  | 128 | CPPUNIT_ASSERT_THROW(testBox = *uninvertible,Assert::AssertionFailure); | 
|---|
|  | 129 | #endif | 
|---|
|  | 130 | } | 
|---|
|  | 131 |  | 
|---|
| [316d3a] | 132 | void BoxUnittest::translateInOutTest(){ | 
|---|
|  | 133 | Vector testVector; | 
|---|
|  | 134 | { | 
|---|
|  | 135 | testVector=Vector(0,0,0); | 
|---|
|  | 136 | CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); | 
|---|
|  | 137 | CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); | 
|---|
|  | 138 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 139 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 140 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 141 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 142 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 143 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 144 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 145 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 146 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 147 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 148 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 149 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 150 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 151 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 152 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 153 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 154 | } | 
|---|
|  | 155 |  | 
|---|
|  | 156 | { | 
|---|
|  | 157 | testVector=Vector(0.5,0.5,0.5); | 
|---|
|  | 158 | CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); | 
|---|
|  | 159 | CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); | 
|---|
|  | 160 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 161 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 162 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 163 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 164 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 165 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 166 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 167 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 168 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 169 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 170 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 171 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 172 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 173 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 174 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 175 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 176 | } | 
|---|
|  | 177 |  | 
|---|
|  | 178 | { | 
|---|
|  | 179 | testVector=Vector(1,1,1); | 
|---|
|  | 180 | CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); | 
|---|
|  | 181 | CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); | 
|---|
|  | 182 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 183 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 184 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 185 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 186 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 187 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 188 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 189 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 190 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 191 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 192 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 193 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 194 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 195 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 196 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 197 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 198 | } | 
|---|
|  | 199 |  | 
|---|
|  | 200 | { | 
|---|
|  | 201 | testVector=Vector(2,1,1); | 
|---|
|  | 202 | CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); | 
|---|
|  | 203 | CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); | 
|---|
|  | 204 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 205 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 206 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 207 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 208 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 209 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 210 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 211 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 212 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 213 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 214 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 215 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 216 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 217 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 218 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 219 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 220 | } | 
|---|
|  | 221 |  | 
|---|
|  | 222 | { | 
|---|
|  | 223 | testVector=Vector(1,2,1); | 
|---|
|  | 224 | CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); | 
|---|
|  | 225 | CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); | 
|---|
|  | 226 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 227 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 228 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 229 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 230 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 231 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 232 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 233 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 234 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 235 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 236 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 237 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 238 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 239 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 240 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 241 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 242 | } | 
|---|
|  | 243 |  | 
|---|
|  | 244 | { | 
|---|
|  | 245 | testVector=Vector(1,1,2); | 
|---|
|  | 246 | CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); | 
|---|
|  | 247 | CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); | 
|---|
|  | 248 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 249 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 250 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 251 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 252 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 253 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 254 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 255 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 256 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 257 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 258 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 259 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 260 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 261 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 262 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 263 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 264 | } | 
|---|
|  | 265 |  | 
|---|
|  | 266 | { | 
|---|
|  | 267 | testVector=Vector(3,1,1); | 
|---|
|  | 268 | CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); | 
|---|
|  | 269 | CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); | 
|---|
|  | 270 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 271 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 272 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 273 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 274 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 275 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 276 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 277 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 278 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 279 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 280 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 281 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 282 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 283 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 284 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 285 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 286 | } | 
|---|
|  | 287 |  | 
|---|
|  | 288 | { | 
|---|
|  | 289 | testVector=Vector(1,3,1); | 
|---|
|  | 290 | CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); | 
|---|
|  | 291 | CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); | 
|---|
|  | 292 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 293 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 294 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 295 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 296 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 297 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 298 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 299 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 300 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 301 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 302 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 303 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 304 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 305 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 306 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 307 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 308 | } | 
|---|
|  | 309 |  | 
|---|
|  | 310 | { | 
|---|
|  | 311 | testVector=Vector(1,1,3); | 
|---|
|  | 312 | CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); | 
|---|
|  | 313 | CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); | 
|---|
|  | 314 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 315 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 316 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 317 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 318 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 319 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 320 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 321 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 322 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 323 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 324 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 325 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 326 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 327 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 328 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 329 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 330 | } | 
|---|
|  | 331 |  | 
|---|
|  | 332 | { | 
|---|
|  | 333 | testVector=Vector(2,2,2); | 
|---|
|  | 334 | CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); | 
|---|
|  | 335 | CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); | 
|---|
|  | 336 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 337 | CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 338 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 339 | CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 340 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 341 | CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 342 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 343 | CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 344 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); | 
|---|
|  | 345 | CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); | 
|---|
|  | 346 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); | 
|---|
|  | 347 | CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); | 
|---|
|  | 348 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); | 
|---|
|  | 349 | CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); | 
|---|
|  | 350 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); | 
|---|
|  | 351 | CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); | 
|---|
|  | 352 | } | 
|---|
|  | 353 |  | 
|---|
|  | 354 | } | 
|---|
|  | 355 |  | 
|---|
| [77bc4f] | 356 | void BoxUnittest::isInsideTest(){ | 
|---|
|  | 357 | Vector testVector(0,0,0); | 
|---|
|  | 358 | CPPUNIT_ASSERT( unitBox->isInside(testVector)); | 
|---|
|  | 359 | CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); | 
|---|
|  | 360 | CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); | 
|---|
|  | 361 | CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); | 
|---|
|  | 362 | CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); | 
|---|
|  | 363 | CPPUNIT_ASSERT( tiltedBox1->isInside(testVector)); | 
|---|
|  | 364 | CPPUNIT_ASSERT( tiltedBox2->isInside(testVector)); | 
|---|
|  | 365 | CPPUNIT_ASSERT( tiltedBox3->isInside(testVector)); | 
|---|
|  | 366 | CPPUNIT_ASSERT( tiltedBox4->isInside(testVector)); | 
|---|
|  | 367 |  | 
|---|
|  | 368 |  | 
|---|
|  | 369 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 370 | CPPUNIT_ASSERT( unitBox->isInside(testVector)); | 
|---|
|  | 371 | CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); | 
|---|
|  | 372 | CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); | 
|---|
|  | 373 | CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); | 
|---|
|  | 374 | CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); | 
|---|
|  | 375 | CPPUNIT_ASSERT( tiltedBox1->isInside(testVector)); | 
|---|
|  | 376 | CPPUNIT_ASSERT( tiltedBox2->isInside(testVector)); | 
|---|
|  | 377 | CPPUNIT_ASSERT( tiltedBox3->isInside(testVector)); | 
|---|
|  | 378 | CPPUNIT_ASSERT( tiltedBox4->isInside(testVector)); | 
|---|
|  | 379 |  | 
|---|
|  | 380 | testVector = Vector(1,1,1); | 
|---|
|  | 381 | CPPUNIT_ASSERT( unitBox->isInside(testVector)); | 
|---|
|  | 382 | CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); | 
|---|
|  | 383 | CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); | 
|---|
|  | 384 | CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); | 
|---|
|  | 385 | CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); | 
|---|
|  | 386 | CPPUNIT_ASSERT( tiltedBox1->isInside(testVector)); | 
|---|
|  | 387 | CPPUNIT_ASSERT( tiltedBox2->isInside(testVector)); | 
|---|
|  | 388 | CPPUNIT_ASSERT( tiltedBox3->isInside(testVector)); | 
|---|
|  | 389 | CPPUNIT_ASSERT( tiltedBox4->isInside(testVector)); | 
|---|
|  | 390 |  | 
|---|
|  | 391 | testVector = Vector(2,1,1); | 
|---|
|  | 392 | CPPUNIT_ASSERT(!unitBox->isInside(testVector)); | 
|---|
|  | 393 | CPPUNIT_ASSERT(!stretchedBox1->isInside(testVector)); | 
|---|
|  | 394 | CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); | 
|---|
|  | 395 | CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); | 
|---|
|  | 396 | CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); | 
|---|
|  | 397 | CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); | 
|---|
|  | 398 | CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); | 
|---|
|  | 399 | CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); | 
|---|
|  | 400 | CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); | 
|---|
|  | 401 |  | 
|---|
|  | 402 | testVector = Vector(1,2,1); | 
|---|
|  | 403 | CPPUNIT_ASSERT(!unitBox->isInside(testVector)); | 
|---|
|  | 404 | CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); | 
|---|
|  | 405 | CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); | 
|---|
|  | 406 | CPPUNIT_ASSERT(!stretchedBox3->isInside(testVector)); | 
|---|
|  | 407 | CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); | 
|---|
|  | 408 | CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); | 
|---|
|  | 409 | CPPUNIT_ASSERT( tiltedBox2->isInside(testVector)); | 
|---|
|  | 410 | CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); | 
|---|
|  | 411 | CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); | 
|---|
|  | 412 |  | 
|---|
|  | 413 | testVector = Vector(1,1,2); | 
|---|
|  | 414 | CPPUNIT_ASSERT(!unitBox->isInside(testVector)); | 
|---|
|  | 415 | CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); | 
|---|
|  | 416 | CPPUNIT_ASSERT(!stretchedBox2->isInside(testVector)); | 
|---|
|  | 417 | CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); | 
|---|
|  | 418 | CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); | 
|---|
|  | 419 | CPPUNIT_ASSERT( tiltedBox1->isInside(testVector)); | 
|---|
|  | 420 | CPPUNIT_ASSERT( tiltedBox2->isInside(testVector)); | 
|---|
|  | 421 | CPPUNIT_ASSERT( tiltedBox3->isInside(testVector)); | 
|---|
|  | 422 | CPPUNIT_ASSERT( tiltedBox4->isInside(testVector)); | 
|---|
|  | 423 |  | 
|---|
|  | 424 | testVector = Vector(3,1,1); | 
|---|
|  | 425 | CPPUNIT_ASSERT(!unitBox->isInside(testVector)); | 
|---|
|  | 426 | CPPUNIT_ASSERT(!stretchedBox1->isInside(testVector)); | 
|---|
|  | 427 | CPPUNIT_ASSERT(!stretchedBox2->isInside(testVector)); | 
|---|
|  | 428 | CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); | 
|---|
|  | 429 | CPPUNIT_ASSERT(!stretchedBox4->isInside(testVector)); | 
|---|
|  | 430 | CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); | 
|---|
|  | 431 | CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); | 
|---|
|  | 432 | CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); | 
|---|
|  | 433 | CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); | 
|---|
|  | 434 |  | 
|---|
|  | 435 | testVector = Vector(1,3,1); | 
|---|
|  | 436 | CPPUNIT_ASSERT(!unitBox->isInside(testVector)); | 
|---|
|  | 437 | CPPUNIT_ASSERT(!stretchedBox1->isInside(testVector)); | 
|---|
|  | 438 | CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); | 
|---|
|  | 439 | CPPUNIT_ASSERT(!stretchedBox3->isInside(testVector)); | 
|---|
|  | 440 | CPPUNIT_ASSERT(!stretchedBox4->isInside(testVector)); | 
|---|
|  | 441 | CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); | 
|---|
|  | 442 | CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); | 
|---|
|  | 443 | CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); | 
|---|
|  | 444 | CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); | 
|---|
|  | 445 |  | 
|---|
|  | 446 | testVector = Vector(1,1,3); | 
|---|
|  | 447 | CPPUNIT_ASSERT(!unitBox->isInside(testVector)); | 
|---|
|  | 448 | CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); | 
|---|
|  | 449 | CPPUNIT_ASSERT(!stretchedBox2->isInside(testVector)); | 
|---|
|  | 450 | CPPUNIT_ASSERT(!stretchedBox3->isInside(testVector)); | 
|---|
|  | 451 | CPPUNIT_ASSERT(!stretchedBox4->isInside(testVector)); | 
|---|
|  | 452 | CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); | 
|---|
|  | 453 | CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); | 
|---|
|  | 454 | CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); | 
|---|
|  | 455 | CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); | 
|---|
|  | 456 |  | 
|---|
|  | 457 | testVector = Vector(2,2,2); | 
|---|
|  | 458 | CPPUNIT_ASSERT(!unitBox->isInside(testVector)); | 
|---|
|  | 459 | CPPUNIT_ASSERT(!stretchedBox1->isInside(testVector)); | 
|---|
|  | 460 | CPPUNIT_ASSERT(!stretchedBox2->isInside(testVector)); | 
|---|
|  | 461 | CPPUNIT_ASSERT(!stretchedBox3->isInside(testVector)); | 
|---|
|  | 462 | CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); | 
|---|
|  | 463 | CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); | 
|---|
|  | 464 | CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); | 
|---|
|  | 465 | CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); | 
|---|
|  | 466 | CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); | 
|---|
|  | 467 |  | 
|---|
|  | 468 | testVector = Vector(3,3,3); | 
|---|
|  | 469 | CPPUNIT_ASSERT(!unitBox->isInside(testVector)); | 
|---|
|  | 470 | CPPUNIT_ASSERT(!stretchedBox1->isInside(testVector)); | 
|---|
|  | 471 | CPPUNIT_ASSERT(!stretchedBox2->isInside(testVector)); | 
|---|
|  | 472 | CPPUNIT_ASSERT(!stretchedBox3->isInside(testVector)); | 
|---|
|  | 473 | CPPUNIT_ASSERT(!stretchedBox4->isInside(testVector)); | 
|---|
|  | 474 | CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); | 
|---|
|  | 475 | CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); | 
|---|
|  | 476 | CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); | 
|---|
|  | 477 | CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); | 
|---|
|  | 478 | } | 
|---|
|  | 479 |  | 
|---|
| [de29ad6] | 480 | bool testWrapExplode(VECTORSET(std::vector) &set,Vector &point, Box* box){ | 
|---|
| [77bc4f] | 481 | bool res = true; | 
|---|
| [712886] | 482 | Vector wrappedPoint = box->enforceBoundaryConditions(point); | 
|---|
| [de29ad6] | 483 | for(std::vector<Vector>::iterator iter = set.begin(); iter!=set.end();++iter){ | 
|---|
| [712886] | 484 | Vector wrapped = box->enforceBoundaryConditions(*iter); | 
|---|
| [77bc4f] | 485 | bool equals = (wrapped == wrappedPoint); | 
|---|
|  | 486 | res = res && equals; | 
|---|
|  | 487 | if(!equals){ | 
|---|
| [955b91] | 488 | std::cout << "Wrapped vector " << wrapped << " produced from vector " << (*iter) | 
|---|
|  | 489 | << " does not match target " << wrappedPoint << std::endl; | 
|---|
| [77bc4f] | 490 | } | 
|---|
|  | 491 | } | 
|---|
|  | 492 | return res; | 
|---|
|  | 493 | } | 
|---|
|  | 494 |  | 
|---|
|  | 495 | void BoxUnittest::WrapExplodeTest(){ | 
|---|
|  | 496 | Vector testVector(0,0,0); | 
|---|
| [de29ad6] | 497 | VECTORSET(std::vector) res; | 
|---|
| [77bc4f] | 498 |  | 
|---|
|  | 499 | // we only can explode those vectors that are actually inside the box | 
|---|
|  | 500 | { | 
|---|
|  | 501 | testVector = Vector(0,0,0); | 
|---|
|  | 502 | res = unitBox->explode(testVector,1); | 
|---|
|  | 503 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 504 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 505 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 506 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 507 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 508 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 509 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 510 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 511 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 512 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 513 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 514 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 515 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 516 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 517 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 518 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 519 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 520 | } | 
|---|
|  | 521 |  | 
|---|
|  | 522 | { | 
|---|
|  | 523 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 524 | res = unitBox->explode(testVector,1); | 
|---|
|  | 525 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 526 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 527 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 528 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 529 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 530 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 531 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 532 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 533 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 534 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 535 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 536 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 537 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 538 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 539 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 540 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 541 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 542 | } | 
|---|
|  | 543 |  | 
|---|
|  | 544 | { | 
|---|
|  | 545 | testVector = Vector(1,1,1); | 
|---|
|  | 546 | res = unitBox->explode(testVector,1); | 
|---|
|  | 547 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 548 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 549 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 550 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 551 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 552 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 553 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 554 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 555 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 556 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 557 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 558 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 559 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 560 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 561 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 562 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 563 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 564 | } | 
|---|
|  | 565 |  | 
|---|
|  | 566 | { | 
|---|
|  | 567 | testVector = Vector(2,1,1); | 
|---|
|  | 568 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 569 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 570 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 571 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 572 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 573 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 574 | } | 
|---|
|  | 575 |  | 
|---|
|  | 576 | { | 
|---|
|  | 577 | testVector = Vector(1,2,1); | 
|---|
|  | 578 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 579 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 580 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 581 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 582 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 583 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 584 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 585 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 586 | } | 
|---|
|  | 587 |  | 
|---|
|  | 588 | { | 
|---|
|  | 589 | testVector = Vector(1,1,2); | 
|---|
|  | 590 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 591 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 592 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 593 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 594 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 595 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 596 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 597 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 598 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 599 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 600 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 601 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 602 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 603 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 604 | } | 
|---|
|  | 605 |  | 
|---|
|  | 606 | { | 
|---|
|  | 607 | testVector = Vector(3,1,1); | 
|---|
|  | 608 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 609 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 610 | } | 
|---|
|  | 611 |  | 
|---|
|  | 612 | { | 
|---|
|  | 613 | testVector = Vector(1,3,1); | 
|---|
|  | 614 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 615 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 616 | } | 
|---|
|  | 617 |  | 
|---|
|  | 618 | { | 
|---|
|  | 619 | testVector = Vector(1,1,3); | 
|---|
|  | 620 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 621 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 622 | } | 
|---|
|  | 623 |  | 
|---|
|  | 624 | { | 
|---|
|  | 625 | testVector = Vector(2,2,2); | 
|---|
|  | 626 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 627 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 628 | } | 
|---|
|  | 629 |  | 
|---|
|  | 630 | // Higher level explosions | 
|---|
|  | 631 |  | 
|---|
|  | 632 | { | 
|---|
|  | 633 | testVector = Vector(0,0,0); | 
|---|
|  | 634 | res = unitBox->explode(testVector,2); | 
|---|
|  | 635 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 636 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 637 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 638 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 639 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 640 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 641 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 642 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 643 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 644 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 645 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 646 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 647 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 648 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 649 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 650 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 651 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 652 | } | 
|---|
|  | 653 |  | 
|---|
|  | 654 | { | 
|---|
|  | 655 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 656 | res = unitBox->explode(testVector,2); | 
|---|
|  | 657 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 658 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 659 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 660 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 661 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 662 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 663 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 664 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 665 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 666 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 667 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 668 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 669 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 670 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 671 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 672 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 673 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 674 | } | 
|---|
|  | 675 |  | 
|---|
|  | 676 | { | 
|---|
|  | 677 | testVector = Vector(1,1,1); | 
|---|
|  | 678 | res = unitBox->explode(testVector,2); | 
|---|
|  | 679 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 680 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 681 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 682 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 683 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 684 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 685 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 686 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 687 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 688 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 689 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 690 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 691 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 692 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 693 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 694 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 695 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 696 | } | 
|---|
|  | 697 |  | 
|---|
|  | 698 | { | 
|---|
|  | 699 | testVector = Vector(2,1,1); | 
|---|
|  | 700 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 701 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 702 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 703 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 704 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 705 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 706 | } | 
|---|
|  | 707 |  | 
|---|
|  | 708 | { | 
|---|
|  | 709 | testVector = Vector(1,2,1); | 
|---|
|  | 710 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 711 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 712 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 713 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 714 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 715 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 716 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 717 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 718 | } | 
|---|
|  | 719 |  | 
|---|
|  | 720 | { | 
|---|
|  | 721 | testVector = Vector(1,1,2); | 
|---|
|  | 722 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 723 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 724 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 725 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 726 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 727 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 728 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 729 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 730 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 731 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 732 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 733 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 734 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 735 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 736 | } | 
|---|
|  | 737 |  | 
|---|
|  | 738 | { | 
|---|
|  | 739 | testVector = Vector(3,1,1); | 
|---|
|  | 740 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 741 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 742 | } | 
|---|
|  | 743 |  | 
|---|
|  | 744 | { | 
|---|
|  | 745 | testVector = Vector(1,3,1); | 
|---|
|  | 746 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 747 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 748 | } | 
|---|
|  | 749 |  | 
|---|
|  | 750 | { | 
|---|
|  | 751 | testVector = Vector(1,1,3); | 
|---|
|  | 752 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 753 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 754 | } | 
|---|
|  | 755 |  | 
|---|
|  | 756 | { | 
|---|
|  | 757 | testVector = Vector(2,2,2); | 
|---|
|  | 758 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 759 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 760 | } | 
|---|
|  | 761 |  | 
|---|
|  | 762 | // one more set of higher level explosions | 
|---|
|  | 763 |  | 
|---|
|  | 764 | { | 
|---|
|  | 765 | testVector = Vector(0,0,0); | 
|---|
|  | 766 | res = unitBox->explode(testVector,3); | 
|---|
|  | 767 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 768 | res = stretchedBox1->explode(testVector,3); | 
|---|
|  | 769 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 770 | res = stretchedBox2->explode(testVector,3); | 
|---|
|  | 771 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 772 | res = stretchedBox3->explode(testVector,3); | 
|---|
|  | 773 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 774 | res = stretchedBox4->explode(testVector,3); | 
|---|
|  | 775 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 776 | res = tiltedBox1->explode(testVector,3); | 
|---|
|  | 777 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 778 | res = tiltedBox2->explode(testVector,3); | 
|---|
|  | 779 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 780 | res = tiltedBox3->explode(testVector,3); | 
|---|
|  | 781 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 782 | res = tiltedBox4->explode(testVector,3); | 
|---|
|  | 783 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 784 | } | 
|---|
|  | 785 |  | 
|---|
|  | 786 | { | 
|---|
|  | 787 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 788 | res = unitBox->explode(testVector,3); | 
|---|
|  | 789 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 790 | res = stretchedBox1->explode(testVector,3); | 
|---|
|  | 791 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 792 | res = stretchedBox2->explode(testVector,3); | 
|---|
|  | 793 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 794 | res = stretchedBox3->explode(testVector,3); | 
|---|
|  | 795 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 796 | res = stretchedBox4->explode(testVector,3); | 
|---|
|  | 797 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 798 | res = tiltedBox1->explode(testVector,3); | 
|---|
|  | 799 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 800 | res = tiltedBox2->explode(testVector,3); | 
|---|
|  | 801 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 802 | res = tiltedBox3->explode(testVector,3); | 
|---|
|  | 803 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 804 | res = tiltedBox4->explode(testVector,3); | 
|---|
|  | 805 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 806 | } | 
|---|
|  | 807 |  | 
|---|
|  | 808 | { | 
|---|
|  | 809 | testVector = Vector(1,1,1); | 
|---|
|  | 810 | res = unitBox->explode(testVector,3); | 
|---|
|  | 811 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 812 | res = stretchedBox1->explode(testVector,3); | 
|---|
|  | 813 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 814 | res = stretchedBox2->explode(testVector,3); | 
|---|
|  | 815 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 816 | res = stretchedBox3->explode(testVector,3); | 
|---|
|  | 817 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 818 | res = stretchedBox4->explode(testVector,3); | 
|---|
|  | 819 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 820 | res = tiltedBox1->explode(testVector,3); | 
|---|
|  | 821 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 822 | res = tiltedBox2->explode(testVector,3); | 
|---|
|  | 823 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 824 | res = tiltedBox3->explode(testVector,3); | 
|---|
|  | 825 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 826 | res = tiltedBox4->explode(testVector,3); | 
|---|
|  | 827 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 828 | } | 
|---|
|  | 829 |  | 
|---|
|  | 830 | { | 
|---|
|  | 831 | testVector = Vector(2,1,1); | 
|---|
|  | 832 | res = stretchedBox2->explode(testVector,3); | 
|---|
|  | 833 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 834 | res = stretchedBox3->explode(testVector,3); | 
|---|
|  | 835 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 836 | res = stretchedBox4->explode(testVector,3); | 
|---|
|  | 837 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 838 | } | 
|---|
|  | 839 |  | 
|---|
|  | 840 | { | 
|---|
|  | 841 | testVector = Vector(1,2,1); | 
|---|
|  | 842 | res = stretchedBox1->explode(testVector,3); | 
|---|
|  | 843 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 844 | res = stretchedBox2->explode(testVector,3); | 
|---|
|  | 845 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 846 | res = stretchedBox4->explode(testVector,3); | 
|---|
|  | 847 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 848 | res = tiltedBox2->explode(testVector,3); | 
|---|
|  | 849 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 850 | } | 
|---|
|  | 851 |  | 
|---|
|  | 852 | { | 
|---|
|  | 853 | testVector = Vector(1,1,2); | 
|---|
|  | 854 | res = stretchedBox1->explode(testVector,3); | 
|---|
|  | 855 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 856 | res = stretchedBox3->explode(testVector,3); | 
|---|
|  | 857 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 858 | res = stretchedBox4->explode(testVector,3); | 
|---|
|  | 859 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 860 | res = tiltedBox1->explode(testVector,3); | 
|---|
|  | 861 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 862 | res = tiltedBox2->explode(testVector,3); | 
|---|
|  | 863 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 864 | res = tiltedBox3->explode(testVector,3); | 
|---|
|  | 865 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 866 | res = tiltedBox4->explode(testVector,3); | 
|---|
|  | 867 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 868 | } | 
|---|
|  | 869 |  | 
|---|
|  | 870 | { | 
|---|
|  | 871 | testVector = Vector(3,1,1); | 
|---|
|  | 872 | res = stretchedBox3->explode(testVector,3); | 
|---|
|  | 873 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 874 | } | 
|---|
|  | 875 |  | 
|---|
|  | 876 | { | 
|---|
|  | 877 | testVector = Vector(1,3,1); | 
|---|
|  | 878 | res = stretchedBox2->explode(testVector,3); | 
|---|
|  | 879 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 880 | } | 
|---|
|  | 881 |  | 
|---|
|  | 882 | { | 
|---|
|  | 883 | testVector = Vector(1,1,3); | 
|---|
|  | 884 | res = stretchedBox1->explode(testVector,3); | 
|---|
|  | 885 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 886 | } | 
|---|
|  | 887 |  | 
|---|
|  | 888 | { | 
|---|
|  | 889 | testVector = Vector(2,2,2); | 
|---|
|  | 890 | res = stretchedBox4->explode(testVector,3); | 
|---|
|  | 891 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 892 | } | 
|---|
|  | 893 | } | 
|---|
|  | 894 |  | 
|---|
|  | 895 | void BoxUnittest::BoundaryBounceTest(){ | 
|---|
|  | 896 | Vector testVector(0,0,0); | 
|---|
| [de29ad6] | 897 | VECTORSET(std::vector) res; | 
|---|
| [77bc4f] | 898 |  | 
|---|
| [d66cb7] | 899 | unitBox->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 900 | stretchedBox1->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 901 | stretchedBox2->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 902 | stretchedBox3->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 903 | stretchedBox4->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 904 | tiltedBox1->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 905 | tiltedBox2->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 906 | tiltedBox3->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 907 | tiltedBox4->setCondition(0,BoundaryConditions::Bounce); | 
|---|
| [77bc4f] | 908 |  | 
|---|
|  | 909 | { | 
|---|
|  | 910 | testVector = Vector(0,0,0); | 
|---|
|  | 911 | res = unitBox->explode(testVector,1); | 
|---|
|  | 912 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 913 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 914 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 915 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 916 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 917 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 918 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 919 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 920 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 921 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 922 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 923 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 924 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 925 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 926 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 927 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 928 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 929 | } | 
|---|
|  | 930 |  | 
|---|
|  | 931 | { | 
|---|
|  | 932 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 933 | res = unitBox->explode(testVector,1); | 
|---|
|  | 934 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 935 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 936 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 937 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 938 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 939 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 940 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 941 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 942 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 943 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 944 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 945 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 946 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 947 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 948 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 949 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 950 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 951 | } | 
|---|
|  | 952 |  | 
|---|
|  | 953 | { | 
|---|
|  | 954 | testVector = Vector(0,0,0); | 
|---|
|  | 955 | res = unitBox->explode(testVector,2); | 
|---|
|  | 956 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 957 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 958 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 959 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 960 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 961 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 962 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 963 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 964 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 965 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 966 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 967 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 968 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 969 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 970 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 971 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 972 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 973 | } | 
|---|
|  | 974 |  | 
|---|
|  | 975 | { | 
|---|
|  | 976 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 977 | res = unitBox->explode(testVector,2); | 
|---|
|  | 978 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 979 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 980 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 981 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 982 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 983 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 984 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 985 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 986 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 987 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 988 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 989 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 990 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 991 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 992 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 993 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 994 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 995 | } | 
|---|
|  | 996 |  | 
|---|
| [d66cb7] | 997 | unitBox->setCondition(1,BoundaryConditions::Bounce); | 
|---|
|  | 998 | stretchedBox1->setCondition(1,BoundaryConditions::Bounce); | 
|---|
|  | 999 | stretchedBox2->setCondition(1,BoundaryConditions::Bounce); | 
|---|
|  | 1000 | stretchedBox3->setCondition(1,BoundaryConditions::Bounce); | 
|---|
|  | 1001 | stretchedBox4->setCondition(1,BoundaryConditions::Bounce); | 
|---|
|  | 1002 | tiltedBox1->setCondition(1,BoundaryConditions::Bounce); | 
|---|
|  | 1003 | tiltedBox2->setCondition(1,BoundaryConditions::Bounce); | 
|---|
|  | 1004 | tiltedBox3->setCondition(1,BoundaryConditions::Bounce); | 
|---|
|  | 1005 | tiltedBox4->setCondition(1,BoundaryConditions::Bounce); | 
|---|
| [77bc4f] | 1006 |  | 
|---|
|  | 1007 | { | 
|---|
|  | 1008 | testVector = Vector(0,0,0); | 
|---|
|  | 1009 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1010 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1011 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1012 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1013 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1014 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1015 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1016 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1017 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1018 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1019 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1020 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1021 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1022 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1023 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1024 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1025 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1026 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1027 | } | 
|---|
|  | 1028 |  | 
|---|
|  | 1029 | { | 
|---|
|  | 1030 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1031 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1032 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1033 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1034 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1035 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1036 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1037 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1038 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1039 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1040 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1041 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1042 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1043 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1044 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1045 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1046 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1047 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1048 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1049 | } | 
|---|
|  | 1050 |  | 
|---|
|  | 1051 | { | 
|---|
|  | 1052 | testVector = Vector(0,0,0); | 
|---|
|  | 1053 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1054 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1055 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1056 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1057 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1058 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1059 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1060 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1061 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1062 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1063 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1064 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1065 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1066 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1067 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1068 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1069 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1070 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1071 | } | 
|---|
|  | 1072 |  | 
|---|
|  | 1073 | { | 
|---|
|  | 1074 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1075 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1076 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1077 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1078 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1079 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1080 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1081 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1082 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1083 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1084 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1085 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1086 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1087 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1088 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1089 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1090 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1091 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1092 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1093 | } | 
|---|
|  | 1094 |  | 
|---|
| [d66cb7] | 1095 | unitBox->setCondition(2,BoundaryConditions::Bounce); | 
|---|
|  | 1096 | stretchedBox1->setCondition(2,BoundaryConditions::Bounce); | 
|---|
|  | 1097 | stretchedBox2->setCondition(2,BoundaryConditions::Bounce); | 
|---|
|  | 1098 | stretchedBox3->setCondition(2,BoundaryConditions::Bounce); | 
|---|
|  | 1099 | stretchedBox4->setCondition(2,BoundaryConditions::Bounce); | 
|---|
|  | 1100 | tiltedBox1->setCondition(2,BoundaryConditions::Bounce); | 
|---|
|  | 1101 | tiltedBox2->setCondition(2,BoundaryConditions::Bounce); | 
|---|
|  | 1102 | tiltedBox3->setCondition(2,BoundaryConditions::Bounce); | 
|---|
|  | 1103 | tiltedBox4->setCondition(2,BoundaryConditions::Bounce); | 
|---|
| [77bc4f] | 1104 |  | 
|---|
|  | 1105 | { | 
|---|
|  | 1106 | testVector = Vector(0,0,0); | 
|---|
|  | 1107 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1108 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1109 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1110 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1111 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1112 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1113 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1114 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1115 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1116 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1117 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1118 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1119 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1120 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1121 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1122 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1123 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1124 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1125 | } | 
|---|
|  | 1126 |  | 
|---|
|  | 1127 | { | 
|---|
|  | 1128 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1129 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1130 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1131 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1132 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1133 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1134 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1135 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1136 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1137 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1138 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1139 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1140 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1141 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1142 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1143 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1144 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1145 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1146 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1147 | } | 
|---|
|  | 1148 |  | 
|---|
|  | 1149 | { | 
|---|
|  | 1150 | testVector = Vector(0,0,0); | 
|---|
|  | 1151 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1152 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1153 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1154 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1155 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1156 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1157 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1158 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1159 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1160 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1161 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1162 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1163 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1164 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1165 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1166 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1167 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1168 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1169 | } | 
|---|
|  | 1170 |  | 
|---|
|  | 1171 | { | 
|---|
|  | 1172 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1173 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1174 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1175 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1176 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1177 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1178 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1179 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1180 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1181 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1182 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1183 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1184 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1185 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1186 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1187 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1188 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1189 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1190 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1191 | } | 
|---|
|  | 1192 | } | 
|---|
|  | 1193 |  | 
|---|
|  | 1194 | void BoxUnittest::BoundaryIgnoreTest(){ | 
|---|
|  | 1195 | Vector testVector(0,0,0); | 
|---|
| [de29ad6] | 1196 | VECTORSET(std::vector) res; | 
|---|
| [77bc4f] | 1197 |  | 
|---|
| [d66cb7] | 1198 | unitBox->setCondition(0,BoundaryConditions::Ignore); | 
|---|
|  | 1199 | stretchedBox1->setCondition(0,BoundaryConditions::Ignore); | 
|---|
|  | 1200 | stretchedBox2->setCondition(0,BoundaryConditions::Ignore); | 
|---|
|  | 1201 | stretchedBox3->setCondition(0,BoundaryConditions::Ignore); | 
|---|
|  | 1202 | stretchedBox4->setCondition(0,BoundaryConditions::Ignore); | 
|---|
|  | 1203 | tiltedBox1->setCondition(0,BoundaryConditions::Ignore); | 
|---|
|  | 1204 | tiltedBox2->setCondition(0,BoundaryConditions::Ignore); | 
|---|
|  | 1205 | tiltedBox3->setCondition(0,BoundaryConditions::Ignore); | 
|---|
|  | 1206 | tiltedBox4->setCondition(0,BoundaryConditions::Ignore); | 
|---|
| [77bc4f] | 1207 |  | 
|---|
|  | 1208 | { | 
|---|
|  | 1209 | testVector = Vector(0,0,0); | 
|---|
|  | 1210 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1211 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1212 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1213 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1214 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1215 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1216 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1217 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1218 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1219 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1220 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1221 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1222 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1223 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1224 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1225 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1226 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1227 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1228 | } | 
|---|
|  | 1229 |  | 
|---|
|  | 1230 | { | 
|---|
|  | 1231 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1232 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1233 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1234 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1235 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1236 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1237 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1238 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1239 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1240 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1241 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1242 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1243 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1244 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1245 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1246 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1247 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1248 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1249 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1250 | } | 
|---|
|  | 1251 |  | 
|---|
|  | 1252 | { | 
|---|
|  | 1253 | testVector = Vector(0,0,0); | 
|---|
|  | 1254 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1255 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1256 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1257 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1258 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1259 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1260 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1261 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1262 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1263 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1264 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1265 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1266 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1267 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1268 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1269 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1270 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1271 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1272 | } | 
|---|
|  | 1273 |  | 
|---|
|  | 1274 | { | 
|---|
|  | 1275 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1276 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1277 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1278 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1279 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1280 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1281 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1282 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1283 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1284 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1285 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1286 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1287 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1288 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1289 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1290 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1291 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1292 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1293 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1294 | } | 
|---|
|  | 1295 |  | 
|---|
| [d66cb7] | 1296 | unitBox->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1297 | stretchedBox1->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1298 | stretchedBox2->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1299 | stretchedBox3->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1300 | stretchedBox4->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1301 | tiltedBox1->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1302 | tiltedBox2->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1303 | tiltedBox3->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1304 | tiltedBox4->setCondition(1,BoundaryConditions::Ignore); | 
|---|
| [77bc4f] | 1305 |  | 
|---|
|  | 1306 | { | 
|---|
|  | 1307 | testVector = Vector(0,0,0); | 
|---|
|  | 1308 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1309 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1310 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1311 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1312 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1313 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1314 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1315 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1316 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1317 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1318 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1319 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1320 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1321 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1322 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1323 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1324 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1325 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1326 | } | 
|---|
|  | 1327 |  | 
|---|
|  | 1328 | { | 
|---|
|  | 1329 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1330 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1331 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1332 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1333 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1334 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1335 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1336 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1337 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1338 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1339 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1340 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1341 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1342 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1343 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1344 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1345 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1346 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1347 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1348 | } | 
|---|
|  | 1349 |  | 
|---|
|  | 1350 | { | 
|---|
|  | 1351 | testVector = Vector(0,0,0); | 
|---|
|  | 1352 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1353 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1354 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1355 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1356 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1357 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1358 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1359 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1360 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1361 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1362 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1363 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1364 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1365 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1366 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1367 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1368 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1369 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1370 | } | 
|---|
|  | 1371 |  | 
|---|
|  | 1372 | { | 
|---|
|  | 1373 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1374 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1375 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1376 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1377 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1378 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1379 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1380 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1381 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1382 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1383 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1384 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1385 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1386 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1387 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1388 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1389 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1390 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1391 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1392 | } | 
|---|
|  | 1393 |  | 
|---|
| [d66cb7] | 1394 | unitBox->setCondition(2,BoundaryConditions::Ignore); | 
|---|
|  | 1395 | stretchedBox1->setCondition(2,BoundaryConditions::Ignore); | 
|---|
|  | 1396 | stretchedBox2->setCondition(2,BoundaryConditions::Ignore); | 
|---|
|  | 1397 | stretchedBox3->setCondition(2,BoundaryConditions::Ignore); | 
|---|
|  | 1398 | stretchedBox4->setCondition(2,BoundaryConditions::Ignore); | 
|---|
|  | 1399 | tiltedBox1->setCondition(2,BoundaryConditions::Ignore); | 
|---|
|  | 1400 | tiltedBox2->setCondition(2,BoundaryConditions::Ignore); | 
|---|
|  | 1401 | tiltedBox3->setCondition(2,BoundaryConditions::Ignore); | 
|---|
|  | 1402 | tiltedBox4->setCondition(2,BoundaryConditions::Ignore); | 
|---|
| [77bc4f] | 1403 |  | 
|---|
|  | 1404 | { | 
|---|
|  | 1405 | testVector = Vector(0,0,0); | 
|---|
|  | 1406 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1407 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1408 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1409 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1410 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1411 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1412 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1413 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1414 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1415 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1416 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1417 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1418 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1419 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1420 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1421 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1422 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1423 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1424 | } | 
|---|
|  | 1425 |  | 
|---|
|  | 1426 | { | 
|---|
|  | 1427 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1428 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1429 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1430 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1431 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1432 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1433 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1434 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1435 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1436 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1437 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1438 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1439 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1440 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1441 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1442 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1443 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1444 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1445 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1446 | } | 
|---|
|  | 1447 |  | 
|---|
|  | 1448 | { | 
|---|
|  | 1449 | testVector = Vector(0,0,0); | 
|---|
|  | 1450 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1451 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1452 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1453 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1454 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1455 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1456 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1457 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1458 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1459 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1460 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1461 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1462 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1463 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1464 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1465 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1466 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1467 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1468 | } | 
|---|
|  | 1469 |  | 
|---|
|  | 1470 | { | 
|---|
|  | 1471 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1472 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1473 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1474 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1475 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1476 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1477 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1478 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1479 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1480 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1481 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1482 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1483 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1484 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1485 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1486 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1487 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1488 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1489 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1490 | } | 
|---|
|  | 1491 | } | 
|---|
|  | 1492 |  | 
|---|
|  | 1493 | void BoxUnittest::BoundaryMixedTest(){ | 
|---|
|  | 1494 | Vector testVector(0,0,0); | 
|---|
| [de29ad6] | 1495 | VECTORSET(std::vector) res; | 
|---|
| [77bc4f] | 1496 |  | 
|---|
| [d66cb7] | 1497 | unitBox->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 1498 | unitBox->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1499 | unitBox->setCondition(2,BoundaryConditions::Wrap); | 
|---|
| [77bc4f] | 1500 |  | 
|---|
| [d66cb7] | 1501 | stretchedBox1->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 1502 | stretchedBox1->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1503 | stretchedBox1->setCondition(2,BoundaryConditions::Wrap); | 
|---|
| [77bc4f] | 1504 |  | 
|---|
| [d66cb7] | 1505 | stretchedBox2->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 1506 | stretchedBox2->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1507 | stretchedBox2->setCondition(2,BoundaryConditions::Wrap); | 
|---|
| [77bc4f] | 1508 |  | 
|---|
| [d66cb7] | 1509 | stretchedBox3->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 1510 | stretchedBox3->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1511 | stretchedBox3->setCondition(2,BoundaryConditions::Wrap); | 
|---|
| [77bc4f] | 1512 |  | 
|---|
| [d66cb7] | 1513 | stretchedBox4->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 1514 | stretchedBox4->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1515 | stretchedBox4->setCondition(2,BoundaryConditions::Wrap); | 
|---|
| [77bc4f] | 1516 |  | 
|---|
| [d66cb7] | 1517 | tiltedBox1->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 1518 | tiltedBox1->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1519 | tiltedBox1->setCondition(2,BoundaryConditions::Wrap); | 
|---|
| [77bc4f] | 1520 |  | 
|---|
| [d66cb7] | 1521 | tiltedBox2->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 1522 | tiltedBox2->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1523 | tiltedBox2->setCondition(2,BoundaryConditions::Wrap); | 
|---|
| [77bc4f] | 1524 |  | 
|---|
| [d66cb7] | 1525 | tiltedBox3->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 1526 | tiltedBox3->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1527 | tiltedBox3->setCondition(2,BoundaryConditions::Wrap); | 
|---|
| [77bc4f] | 1528 |  | 
|---|
| [d66cb7] | 1529 | tiltedBox4->setCondition(0,BoundaryConditions::Bounce); | 
|---|
|  | 1530 | tiltedBox4->setCondition(1,BoundaryConditions::Ignore); | 
|---|
|  | 1531 | tiltedBox4->setCondition(2,BoundaryConditions::Wrap); | 
|---|
| [77bc4f] | 1532 |  | 
|---|
|  | 1533 | { | 
|---|
|  | 1534 | testVector = Vector(0,0,0); | 
|---|
|  | 1535 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1536 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1537 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1538 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1539 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1540 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1541 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1542 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1543 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1544 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1545 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1546 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1547 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1548 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1549 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1550 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1551 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1552 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1553 | } | 
|---|
|  | 1554 |  | 
|---|
|  | 1555 | { | 
|---|
|  | 1556 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1557 | res = unitBox->explode(testVector,1); | 
|---|
|  | 1558 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1559 | res = stretchedBox1->explode(testVector,1); | 
|---|
|  | 1560 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1561 | res = stretchedBox2->explode(testVector,1); | 
|---|
|  | 1562 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1563 | res = stretchedBox3->explode(testVector,1); | 
|---|
|  | 1564 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1565 | res = stretchedBox4->explode(testVector,1); | 
|---|
|  | 1566 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1567 | res = tiltedBox1->explode(testVector,1); | 
|---|
|  | 1568 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1569 | res = tiltedBox2->explode(testVector,1); | 
|---|
|  | 1570 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1571 | res = tiltedBox3->explode(testVector,1); | 
|---|
|  | 1572 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1573 | res = tiltedBox4->explode(testVector,1); | 
|---|
|  | 1574 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1575 | } | 
|---|
|  | 1576 |  | 
|---|
|  | 1577 | { | 
|---|
|  | 1578 | testVector = Vector(0,0,0); | 
|---|
|  | 1579 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1580 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1581 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1582 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1583 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1584 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1585 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1586 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1587 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1588 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1589 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1590 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1591 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1592 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1593 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1594 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1595 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1596 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1597 | } | 
|---|
|  | 1598 |  | 
|---|
|  | 1599 | { | 
|---|
|  | 1600 | testVector = Vector(0.5,0.5,0.5); | 
|---|
|  | 1601 | res = unitBox->explode(testVector,2); | 
|---|
|  | 1602 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); | 
|---|
|  | 1603 | res = stretchedBox1->explode(testVector,2); | 
|---|
|  | 1604 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); | 
|---|
|  | 1605 | res = stretchedBox2->explode(testVector,2); | 
|---|
|  | 1606 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); | 
|---|
|  | 1607 | res = stretchedBox3->explode(testVector,2); | 
|---|
|  | 1608 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); | 
|---|
|  | 1609 | res = stretchedBox4->explode(testVector,2); | 
|---|
|  | 1610 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); | 
|---|
|  | 1611 | res = tiltedBox1->explode(testVector,2); | 
|---|
|  | 1612 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); | 
|---|
|  | 1613 | res = tiltedBox2->explode(testVector,2); | 
|---|
|  | 1614 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); | 
|---|
|  | 1615 | res = tiltedBox3->explode(testVector,2); | 
|---|
|  | 1616 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); | 
|---|
|  | 1617 | res = tiltedBox4->explode(testVector,2); | 
|---|
|  | 1618 | CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); | 
|---|
|  | 1619 | } | 
|---|
|  | 1620 |  | 
|---|
|  | 1621 | } | 
|---|
| [99f4ee] | 1622 |  | 
|---|
|  | 1623 | /** Unit test on whether observer is working. | 
|---|
|  | 1624 | * | 
|---|
|  | 1625 | */ | 
|---|
|  | 1626 | void BoxUnittest::ObserverTest() | 
|---|
|  | 1627 | { | 
|---|
|  | 1628 | // create some observers | 
|---|
|  | 1629 | UpdateCountObserver *observer_general = new UpdateCountObserver(); | 
|---|
|  | 1630 | NotificationObserver *observer_matrix = new NotificationObserver( | 
|---|
|  | 1631 | unitBox->getChannel(Box::MatrixChanged)); | 
|---|
|  | 1632 | NotificationObserver *observer_bc = new NotificationObserver( | 
|---|
|  | 1633 | unitBox->getChannel(Box::BoundaryConditionsChanged)); | 
|---|
|  | 1634 | CPPUNIT_ASSERT_EQUAL((int)0, observer_general->updates); | 
|---|
|  | 1635 | CPPUNIT_ASSERT_EQUAL(false, observer_matrix->wasNotified); | 
|---|
|  | 1636 | CPPUNIT_ASSERT_EQUAL(false, observer_bc->wasNotified); | 
|---|
|  | 1637 | unitBox->signOn(observer_general); | 
|---|
|  | 1638 | unitBox->signOn(observer_matrix, Box::MatrixChanged); | 
|---|
|  | 1639 | unitBox->signOn(observer_bc, Box::BoundaryConditionsChanged); | 
|---|
|  | 1640 |  | 
|---|
|  | 1641 | // create update MatrixChanged | 
|---|
|  | 1642 | unitBox->setM(*unit); | 
|---|
|  | 1643 | CPPUNIT_ASSERT_EQUAL((int)1, observer_general->updates); | 
|---|
|  | 1644 | CPPUNIT_ASSERT_EQUAL(true, observer_matrix->wasNotified); | 
|---|
|  | 1645 | CPPUNIT_ASSERT_EQUAL(false, observer_bc->wasNotified); | 
|---|
|  | 1646 | observer_matrix->wasNotified = false; | 
|---|
|  | 1647 |  | 
|---|
|  | 1648 | // create update BoundaryConditionsChanged | 
|---|
| [d66cb7] | 1649 | unitBox->setCondition(0, BoundaryConditions::Wrap); | 
|---|
| [99f4ee] | 1650 | CPPUNIT_ASSERT_EQUAL((int)2, observer_general->updates); | 
|---|
|  | 1651 | CPPUNIT_ASSERT_EQUAL(false, observer_matrix->wasNotified); | 
|---|
|  | 1652 | CPPUNIT_ASSERT_EQUAL(true, observer_bc->wasNotified); | 
|---|
|  | 1653 |  | 
|---|
|  | 1654 | // remove observers again | 
|---|
|  | 1655 | unitBox->signOff(observer_general); | 
|---|
|  | 1656 | unitBox->signOff(observer_matrix, Box::MatrixChanged); | 
|---|
|  | 1657 | unitBox->signOff(observer_bc, Box::BoundaryConditionsChanged); | 
|---|
|  | 1658 | delete observer_general; | 
|---|
|  | 1659 | delete observer_matrix; | 
|---|
|  | 1660 | delete observer_bc; | 
|---|
|  | 1661 | } | 
|---|