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