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