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