/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2010-2012 University of Bonn. All rights reserved. * * * This file is part of MoleCuilder. * * MoleCuilder is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * MoleCuilder is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with MoleCuilder. If not, see . */ /* * BoxUnitTest.cpp * * Created on: Jul 30, 2010 * Author: crueger */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include "LinearAlgebra/Vector.hpp" #include "LinearAlgebra/RealSpaceMatrix.hpp" #include "Box.hpp" #include "CodePatterns/Assert.hpp" #include "BoxUnitTest.hpp" #include "stubs/ObserverStub.hpp" #ifdef HAVE_TESTRUNNER #include "UnitTestMain.hpp" #endif /*HAVE_TESTRUNNER*/ /********************************************** Test classes **************************************/ // Registers the fixture into the 'registry' CPPUNIT_TEST_SUITE_REGISTRATION( BoxUnittest ); void BoxUnittest::setUp(){ // failing asserts should be thrown ASSERT_DO(Assert::Throw); unit = new RealSpaceMatrix; unit->setIdentity(); zero = new RealSpaceMatrix; invertible = new RealSpaceMatrix; invertible->diagonal() = Vector(1,2,3); uninvertible = new RealSpaceMatrix; uninvertible->column(0) = Vector(1,0,1); uninvertible->column(2) = Vector(1,0,1); RealSpaceMatrix boxMat; unitBox = new Box; stretchedBox1 = new Box; boxMat.setIdentity(); boxMat.diagonal() = Vector(1,2,3); stretchedBox1->setM(boxMat); stretchedBox2 = new Box; boxMat.setIdentity(); boxMat.diagonal() = Vector(2,3,1); stretchedBox2->setM(boxMat); stretchedBox3 = new Box; boxMat.setIdentity(); boxMat.diagonal() = Vector(3,1,2); stretchedBox3->setM(boxMat); stretchedBox4 = new Box; boxMat.setIdentity(); boxMat.diagonal() = Vector(2,2,2); stretchedBox4->setM(boxMat); tiltedBox1 = new Box; boxMat.setIdentity(); boxMat.column(0) = Vector(1,0,1); tiltedBox1->setM(boxMat); tiltedBox2 = new Box; boxMat.setIdentity(); boxMat.column(0) = Vector(1,1,1); tiltedBox2->setM(boxMat); tiltedBox3 = new Box; boxMat.setIdentity(); boxMat.column(1) = Vector(0,1,1); tiltedBox3->setM(boxMat); tiltedBox4 = new Box; boxMat.setIdentity(); boxMat.column(0) = Vector(1,1,1); boxMat.column(1) = Vector(0,1,1); tiltedBox4->setM(boxMat); } void BoxUnittest::tearDown(){ delete unit; delete zero; delete invertible; delete uninvertible; delete unitBox; delete stretchedBox1; delete stretchedBox2; delete stretchedBox3; delete stretchedBox4; delete tiltedBox1; delete tiltedBox2; delete tiltedBox3; delete tiltedBox4; } void BoxUnittest::setBoxTest(){ Box testBox; CPPUNIT_ASSERT_NO_THROW(testBox.setM(*unit)); CPPUNIT_ASSERT_NO_THROW(testBox = *unit); CPPUNIT_ASSERT_NO_THROW(testBox.setM(*invertible)); CPPUNIT_ASSERT_NO_THROW(testBox = *invertible); #ifndef NDEBUG CPPUNIT_ASSERT_THROW(testBox.setM(*zero),Assert::AssertionFailure); CPPUNIT_ASSERT_THROW(testBox = *zero,Assert::AssertionFailure); CPPUNIT_ASSERT_THROW(testBox.setM(*uninvertible),Assert::AssertionFailure); CPPUNIT_ASSERT_THROW(testBox = *uninvertible,Assert::AssertionFailure); #endif } void BoxUnittest::translateInOutTest(){ Vector testVector; { testVector=Vector(0,0,0); CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); } { testVector=Vector(0.5,0.5,0.5); CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); } { testVector=Vector(1,1,1); CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); } { testVector=Vector(2,1,1); CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); } { testVector=Vector(1,2,1); CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); } { testVector=Vector(1,1,2); CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); } { testVector=Vector(3,1,1); CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); } { testVector=Vector(1,3,1); CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); } { testVector=Vector(1,1,3); CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); } { testVector=Vector(2,2,2); CPPUNIT_ASSERT_EQUAL(unitBox->translateOut(unitBox->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(unitBox->translateIn(unitBox->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateOut(stretchedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox1->translateIn(stretchedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateOut(stretchedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox2->translateIn(stretchedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateOut(stretchedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox3->translateIn(stretchedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateOut(stretchedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(stretchedBox4->translateIn(stretchedBox4->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateOut(tiltedBox1->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox1->translateIn(tiltedBox1->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateOut(tiltedBox2->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox2->translateIn(tiltedBox2->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateOut(tiltedBox3->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox3->translateIn(tiltedBox3->translateOut(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateOut(tiltedBox4->translateIn(testVector)),testVector); CPPUNIT_ASSERT_EQUAL(tiltedBox4->translateIn(tiltedBox4->translateOut(testVector)),testVector); } } void BoxUnittest::isInsideTest(){ Vector testVector(0,0,0); CPPUNIT_ASSERT( unitBox->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox4->isInside(testVector)); testVector = Vector(0.5,0.5,0.5); CPPUNIT_ASSERT( unitBox->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox4->isInside(testVector)); testVector = Vector(1,1,1); CPPUNIT_ASSERT( unitBox->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox4->isInside(testVector)); testVector = Vector(2,1,1); CPPUNIT_ASSERT(!unitBox->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); testVector = Vector(1,2,1); CPPUNIT_ASSERT(!unitBox->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); testVector = Vector(1,1,2); CPPUNIT_ASSERT(!unitBox->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT( tiltedBox4->isInside(testVector)); testVector = Vector(3,1,1); CPPUNIT_ASSERT(!unitBox->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); testVector = Vector(1,3,1); CPPUNIT_ASSERT(!unitBox->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); testVector = Vector(1,1,3); CPPUNIT_ASSERT(!unitBox->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); testVector = Vector(2,2,2); CPPUNIT_ASSERT(!unitBox->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT( stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); testVector = Vector(3,3,3); CPPUNIT_ASSERT(!unitBox->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox1->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox2->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox3->isInside(testVector)); CPPUNIT_ASSERT(!stretchedBox4->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox1->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox2->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox3->isInside(testVector)); CPPUNIT_ASSERT(!tiltedBox4->isInside(testVector)); } bool testWrapExplode(VECTORSET(std::vector) &set,Vector &point, Box* box){ bool res = true; Vector wrappedPoint = box->enforceBoundaryConditions(point); for(std::vector::iterator iter = set.begin(); iter!=set.end();++iter){ Vector wrapped = box->enforceBoundaryConditions(*iter); bool equals = (wrapped == wrappedPoint); res = res && equals; if(!equals){ std::cout << "Wrapped vector " << wrapped << " produced from vector " << (*iter) << " does not match target " << wrappedPoint << std::endl; } } return res; } void BoxUnittest::WrapExplodeTest(){ Vector testVector(0,0,0); VECTORSET(std::vector) res; // we only can explode those vectors that are actually inside the box { testVector = Vector(0,0,0); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(1,1,1); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(2,1,1); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); } { testVector = Vector(1,2,1); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); } { testVector = Vector(1,1,2); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(3,1,1); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); } { testVector = Vector(1,3,1); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); } { testVector = Vector(1,1,3); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); } { testVector = Vector(2,2,2); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); } // Higher level explosions { testVector = Vector(0,0,0); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(1,1,1); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(2,1,1); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); } { testVector = Vector(1,2,1); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); } { testVector = Vector(1,1,2); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(3,1,1); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); } { testVector = Vector(1,3,1); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); } { testVector = Vector(1,1,3); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); } { testVector = Vector(2,2,2); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); } // one more set of higher level explosions { testVector = Vector(0,0,0); res = unitBox->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(1,1,1); res = unitBox->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(2,1,1); res = stretchedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); } { testVector = Vector(1,2,1); res = stretchedBox1->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); } { testVector = Vector(1,1,2); res = stretchedBox1->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox3->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(3,1,1); res = stretchedBox3->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); } { testVector = Vector(1,3,1); res = stretchedBox2->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); } { testVector = Vector(1,1,3); res = stretchedBox1->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); } { testVector = Vector(2,2,2); res = stretchedBox4->explode(testVector,3); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); } } void BoxUnittest::BoundaryBounceTest(){ Vector testVector(0,0,0); VECTORSET(std::vector) res; unitBox->setCondition(0,BoundaryConditions::Bounce); stretchedBox1->setCondition(0,BoundaryConditions::Bounce); stretchedBox2->setCondition(0,BoundaryConditions::Bounce); stretchedBox3->setCondition(0,BoundaryConditions::Bounce); stretchedBox4->setCondition(0,BoundaryConditions::Bounce); tiltedBox1->setCondition(0,BoundaryConditions::Bounce); tiltedBox2->setCondition(0,BoundaryConditions::Bounce); tiltedBox3->setCondition(0,BoundaryConditions::Bounce); tiltedBox4->setCondition(0,BoundaryConditions::Bounce); { testVector = Vector(0,0,0); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0,0,0); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } unitBox->setCondition(1,BoundaryConditions::Bounce); stretchedBox1->setCondition(1,BoundaryConditions::Bounce); stretchedBox2->setCondition(1,BoundaryConditions::Bounce); stretchedBox3->setCondition(1,BoundaryConditions::Bounce); stretchedBox4->setCondition(1,BoundaryConditions::Bounce); tiltedBox1->setCondition(1,BoundaryConditions::Bounce); tiltedBox2->setCondition(1,BoundaryConditions::Bounce); tiltedBox3->setCondition(1,BoundaryConditions::Bounce); tiltedBox4->setCondition(1,BoundaryConditions::Bounce); { testVector = Vector(0,0,0); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0,0,0); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } unitBox->setCondition(2,BoundaryConditions::Bounce); stretchedBox1->setCondition(2,BoundaryConditions::Bounce); stretchedBox2->setCondition(2,BoundaryConditions::Bounce); stretchedBox3->setCondition(2,BoundaryConditions::Bounce); stretchedBox4->setCondition(2,BoundaryConditions::Bounce); tiltedBox1->setCondition(2,BoundaryConditions::Bounce); tiltedBox2->setCondition(2,BoundaryConditions::Bounce); tiltedBox3->setCondition(2,BoundaryConditions::Bounce); tiltedBox4->setCondition(2,BoundaryConditions::Bounce); { testVector = Vector(0,0,0); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0,0,0); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } } void BoxUnittest::BoundaryIgnoreTest(){ Vector testVector(0,0,0); VECTORSET(std::vector) res; unitBox->setCondition(0,BoundaryConditions::Ignore); stretchedBox1->setCondition(0,BoundaryConditions::Ignore); stretchedBox2->setCondition(0,BoundaryConditions::Ignore); stretchedBox3->setCondition(0,BoundaryConditions::Ignore); stretchedBox4->setCondition(0,BoundaryConditions::Ignore); tiltedBox1->setCondition(0,BoundaryConditions::Ignore); tiltedBox2->setCondition(0,BoundaryConditions::Ignore); tiltedBox3->setCondition(0,BoundaryConditions::Ignore); tiltedBox4->setCondition(0,BoundaryConditions::Ignore); { testVector = Vector(0,0,0); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0,0,0); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } unitBox->setCondition(1,BoundaryConditions::Ignore); stretchedBox1->setCondition(1,BoundaryConditions::Ignore); stretchedBox2->setCondition(1,BoundaryConditions::Ignore); stretchedBox3->setCondition(1,BoundaryConditions::Ignore); stretchedBox4->setCondition(1,BoundaryConditions::Ignore); tiltedBox1->setCondition(1,BoundaryConditions::Ignore); tiltedBox2->setCondition(1,BoundaryConditions::Ignore); tiltedBox3->setCondition(1,BoundaryConditions::Ignore); tiltedBox4->setCondition(1,BoundaryConditions::Ignore); { testVector = Vector(0,0,0); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0,0,0); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } unitBox->setCondition(2,BoundaryConditions::Ignore); stretchedBox1->setCondition(2,BoundaryConditions::Ignore); stretchedBox2->setCondition(2,BoundaryConditions::Ignore); stretchedBox3->setCondition(2,BoundaryConditions::Ignore); stretchedBox4->setCondition(2,BoundaryConditions::Ignore); tiltedBox1->setCondition(2,BoundaryConditions::Ignore); tiltedBox2->setCondition(2,BoundaryConditions::Ignore); tiltedBox3->setCondition(2,BoundaryConditions::Ignore); tiltedBox4->setCondition(2,BoundaryConditions::Ignore); { testVector = Vector(0,0,0); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0,0,0); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } } void BoxUnittest::BoundaryMixedTest(){ Vector testVector(0,0,0); VECTORSET(std::vector) res; unitBox->setCondition(0,BoundaryConditions::Bounce); unitBox->setCondition(1,BoundaryConditions::Ignore); unitBox->setCondition(2,BoundaryConditions::Wrap); stretchedBox1->setCondition(0,BoundaryConditions::Bounce); stretchedBox1->setCondition(1,BoundaryConditions::Ignore); stretchedBox1->setCondition(2,BoundaryConditions::Wrap); stretchedBox2->setCondition(0,BoundaryConditions::Bounce); stretchedBox2->setCondition(1,BoundaryConditions::Ignore); stretchedBox2->setCondition(2,BoundaryConditions::Wrap); stretchedBox3->setCondition(0,BoundaryConditions::Bounce); stretchedBox3->setCondition(1,BoundaryConditions::Ignore); stretchedBox3->setCondition(2,BoundaryConditions::Wrap); stretchedBox4->setCondition(0,BoundaryConditions::Bounce); stretchedBox4->setCondition(1,BoundaryConditions::Ignore); stretchedBox4->setCondition(2,BoundaryConditions::Wrap); tiltedBox1->setCondition(0,BoundaryConditions::Bounce); tiltedBox1->setCondition(1,BoundaryConditions::Ignore); tiltedBox1->setCondition(2,BoundaryConditions::Wrap); tiltedBox2->setCondition(0,BoundaryConditions::Bounce); tiltedBox2->setCondition(1,BoundaryConditions::Ignore); tiltedBox2->setCondition(2,BoundaryConditions::Wrap); tiltedBox3->setCondition(0,BoundaryConditions::Bounce); tiltedBox3->setCondition(1,BoundaryConditions::Ignore); tiltedBox3->setCondition(2,BoundaryConditions::Wrap); tiltedBox4->setCondition(0,BoundaryConditions::Bounce); tiltedBox4->setCondition(1,BoundaryConditions::Ignore); tiltedBox4->setCondition(2,BoundaryConditions::Wrap); { testVector = Vector(0,0,0); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,1); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0,0,0); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } { testVector = Vector(0.5,0.5,0.5); res = unitBox->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,unitBox)); res = stretchedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox1)); res = stretchedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox2)); res = stretchedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox3)); res = stretchedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,stretchedBox4)); res = tiltedBox1->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox1)); res = tiltedBox2->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox2)); res = tiltedBox3->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox3)); res = tiltedBox4->explode(testVector,2); CPPUNIT_ASSERT(testWrapExplode(res,testVector,tiltedBox4)); } } /** Unit test on whether observer is working. * */ void BoxUnittest::ObserverTest() { // create some observers UpdateCountObserver *observer_general = new UpdateCountObserver(); NotificationObserver *observer_matrix = new NotificationObserver( stretchedBox1->getChannel(Box::MatrixChanged)); NotificationObserver *observer_bc = new NotificationObserver( stretchedBox1->getChannel(Box::BoundaryConditionsChanged)); CPPUNIT_ASSERT_EQUAL((int)0, observer_general->updates); CPPUNIT_ASSERT_EQUAL(false, observer_matrix->wasNotified); CPPUNIT_ASSERT_EQUAL(false, observer_bc->wasNotified); stretchedBox1->signOn(observer_general); stretchedBox1->signOn(observer_matrix, Box::MatrixChanged); stretchedBox1->signOn(observer_bc, Box::BoundaryConditionsChanged); // create update MatrixChanged stretchedBox1->setM(*unit); CPPUNIT_ASSERT_EQUAL((int)1, observer_general->updates); CPPUNIT_ASSERT_EQUAL(true, observer_matrix->wasNotified); CPPUNIT_ASSERT_EQUAL(false, observer_bc->wasNotified); observer_matrix->wasNotified = false; // same matrix does not notify but update stretchedBox1->setM(*unit); CPPUNIT_ASSERT_EQUAL((int)2, observer_general->updates); CPPUNIT_ASSERT_EQUAL(false, observer_matrix->wasNotified); CPPUNIT_ASSERT_EQUAL(false, observer_bc->wasNotified); // create update BoundaryConditionsChanged stretchedBox1->setCondition(0, BoundaryConditions::Bounce); CPPUNIT_ASSERT_EQUAL((int)3, observer_general->updates); CPPUNIT_ASSERT_EQUAL(false, observer_matrix->wasNotified); CPPUNIT_ASSERT_EQUAL(true, observer_bc->wasNotified); observer_bc->wasNotified = false; // set same conditions does not notify but update stretchedBox1->setCondition(0, BoundaryConditions::Bounce); CPPUNIT_ASSERT_EQUAL((int)4, observer_general->updates); CPPUNIT_ASSERT_EQUAL(false, observer_matrix->wasNotified); CPPUNIT_ASSERT_EQUAL(false, observer_bc->wasNotified); // remove observers again stretchedBox1->signOff(observer_general); stretchedBox1->signOff(observer_matrix, Box::MatrixChanged); stretchedBox1->signOff(observer_bc, Box::BoundaryConditionsChanged); delete observer_general; delete observer_matrix; delete observer_bc; }