/* * 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 . */ /* * Shape_HomogeneousPointsUnitTest.cpp * * Created on: Jun 19, 2010 * Author: heber */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include #ifdef HAVE_TESTRUNNER #include "UnitTestMain.hpp" #endif /*HAVE_TESTRUNNER*/ #include "CodePatterns/Assert.hpp" #include "LinearAlgebra/Vector.hpp" #include "Shapes/BaseShapes.hpp" #include "Shapes/Shape.hpp" #include "Shape_HomogeneousPointsUnitTest.hpp" // Registers the fixture into the 'registry' CPPUNIT_TEST_SUITE_REGISTRATION( Shape_HomogeneousPointsTest ); void Shape_HomogeneousPointsTest::setUp() { // failing asserts should be thrown ASSERT_DO(Assert::Throw); } void Shape_HomogeneousPointsTest::tearDown() {} /** Unit test for points on Shape's surface. * */ void Shape_HomogeneousPointsTest::surfaceTest() { { Shape s = Sphere(); std::vector nodes = s.getHomogeneousPointsOnSurface(12); CPPUNIT_ASSERT_EQUAL( (size_t)12, nodes.size()); for (size_t i=0;i<12;++i) CPPUNIT_ASSERT( s.isOnSurface(nodes[i]) ); } { Shape s = Sphere(zeroVec, 2.); std::vector nodes = s.getHomogeneousPointsOnSurface(12); CPPUNIT_ASSERT_EQUAL( (size_t)12, nodes.size()); for (size_t i=0;i<12;++i) CPPUNIT_ASSERT( s.isOnSurface(nodes[i]) ); } } /** Unit test for points in Shape's volume. * */ void Shape_HomogeneousPointsTest::volumeTest() { // is not implemented // Shape s = Sphere(); // std::vector nodes = s.getHomogeneousPointsInVolume(12); // CPPUNIT_ASSERT_EQUAL( (size_t)12, nodes.size()); // for (size_t i=0;i<12;++i) // CPPUNIT_ASSERT( s.isInside(nodes[i]) ); }