Changes in src/unittests/vectorunittest.cpp [952f38:bcf653]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/unittests/vectorunittest.cpp ¶
r952f38 rbcf653 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 1 8 /* 2 9 * unittest.cpp … … 6 13 */ 7 14 15 // include config.h 16 #ifdef HAVE_CONFIG_H 17 #include <config.h> 18 #endif 8 19 9 20 using namespace std; … … 16 27 #include "Helpers/Log.hpp" 17 28 #include "LinearAlgebra/Vector.hpp" 18 #include " vector_ops.hpp"29 #include "LinearAlgebra/vector_ops.hpp" 19 30 #include "vectorunittest.hpp" 20 31 #include "LinearAlgebra/Plane.hpp" … … 52 63 errorLogger::purgeInstance(); 53 64 }; 65 66 /** UnitTest for Constructors and Vector::IsZero() and Vector::IsOne(). 67 */ 68 void VectorTest::AssignmentTest() 69 { 70 // test with zero 71 zero.at(0) = 0; 72 zero.at(1) = 0; 73 zero.at(2) = 0; 74 double zero_array[3] = {0., 0., 0.}; 75 76 CPPUNIT_ASSERT_EQUAL( zero, Vector(0,0,0)); 77 CPPUNIT_ASSERT_EQUAL( zero, Vector(0.,0.,0.)); 78 CPPUNIT_ASSERT_EQUAL( zero, Vector(zero_array[0], zero_array[1], zero_array[2])); 79 CPPUNIT_ASSERT_EQUAL( zero, Vector(zero_array)); 80 81 // test with unit 82 unit.at(0) = 1; 83 unit.at(1) = 0; 84 unit.at(2) = 0; 85 double unit_array[3] = {1., 0., 0.}; 86 87 CPPUNIT_ASSERT_EQUAL( unit, Vector(1,0,0)); 88 CPPUNIT_ASSERT_EQUAL( unit, Vector(1.,0.,0.)); 89 CPPUNIT_ASSERT_EQUAL( unit, Vector(unit_array[0], unit_array[1], unit_array[2])); 90 CPPUNIT_ASSERT_EQUAL( unit, Vector(unit_array)); 91 92 // test with two 93 two.at(0) = 2; 94 two.at(1) = 1; 95 two.at(2) = 0; 96 double two_array[3] = {2., 1., 0.}; 97 98 CPPUNIT_ASSERT_EQUAL( two, Vector(2,1,0)); 99 CPPUNIT_ASSERT_EQUAL( two, Vector(2.,1.,0.)); 100 CPPUNIT_ASSERT_EQUAL( two, Vector(two_array[0], two_array[1], two_array[2])); 101 CPPUNIT_ASSERT_EQUAL( two, Vector(two_array)); 102 103 // test with three 104 three.at(0) = 1; 105 three.at(1) = 2; 106 three.at(2) = 3; 107 double three_array[3] = {1., 2., 3.}; 108 109 CPPUNIT_ASSERT_EQUAL( three, Vector(1,2,3)); 110 CPPUNIT_ASSERT_EQUAL( three, Vector(1.,2.,3.)); 111 CPPUNIT_ASSERT_EQUAL( three, Vector(three_array[0], three_array[1], three_array[2])); 112 CPPUNIT_ASSERT_EQUAL( three, Vector(three_array)); 113 } 54 114 55 115 /** UnitTest for Constructors and Vector::IsZero() and Vector::IsOne().
Note:
See TracChangeset
for help on using the changeset viewer.