changeset 19:4634ca3fc308

Renamed src to test Began refactoring test program to use Google Test framework
author Eris Caffee <discordia@eldalin.com>
date Mon, 15 Sep 2014 01:02:04 -0500
parents f9fb659509e1
children b2c15ffdab9d
files CMakeLists.txt test/main.cpp
diffstat 2 files changed, 1205 insertions(+), 3 deletions(-) [+]
line diff
     1.1 --- a/CMakeLists.txt	Mon May 27 16:59:04 2013 -0500
     1.2 +++ b/CMakeLists.txt	Mon Sep 15 01:02:04 2014 -0500
     1.3 @@ -25,6 +25,7 @@
     1.4  #   project_dir\		Top level directory of the project.
     1.5  #     |---include\		Header files are here.
     1.6  #     |---src\			Source files are here.
     1.7 +#     |---test\			Test files are here.
     1.8  #     |---build\		Binaries/objects go here.  Run cmake from here.
     1.9  #     !---cmake\
    1.10  #     |     |---modules\        Custom cmake include files, if any, go here.
    1.11 @@ -122,7 +123,8 @@
    1.12  #   C    -std=gnu99 -std=c99
    1.13  
    1.14  if (CMAKE_COMPILER_IS_GNUCXX)
    1.15 -  add_definitions(-pedantic -Wall)
    1.16 +  add_definitions( -std=gnu++11 )
    1.17 +#  add_definitions(-pedantic -Wall)
    1.18  endif ()
    1.19  
    1.20  ################################################################################
    1.21 @@ -188,20 +190,25 @@
    1.22  #set_target_properties (${App_Name}-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
    1.23  
    1.24  # Build a test application.
    1.25 +    set (GTEST_INCLUDE_DIR "/home/eris/gamedev/deps/gtest/current/include")
    1.26 +    set (GTEST_LIB_DIR "/home/eris/gamedev/deps/gtest/current/build")
    1.27  
    1.28  link_directories (
    1.29 +  ${GTEST_LIB_DIR}
    1.30    )
    1.31  
    1.32  include_directories (
    1.33    ${CMAKE_SOURCE_DIR}/include
    1.34 +  ${GTEST_INCLUDE_DIR}
    1.35    )
    1.36  
    1.37  add_executable (${App_Name}-test
    1.38 -  src/main.cpp
    1.39 +  test/main.cpp
    1.40  )
    1.41  
    1.42  target_link_libraries (${App_Name}-test
    1.43 -#  ${App_Name}
    1.44 +  libgtest.a
    1.45 +  pthread
    1.46  )
    1.47  
    1.48  ################################################################################
    1.49 @@ -240,3 +247,13 @@
    1.50  
    1.51  endif ()
    1.52  
    1.53 +################################################################################
    1.54 +# Google Test C++ Unit testing framework
    1.55 +
    1.56 +option (Option_GTEST "Google Test" ON)
    1.57 +
    1.58 +if (Option_GTEST)
    1.59 +    set (GTEST_INCLUDE_DIR "/home/eris/gamedev/deps/gtest/current/include")
    1.60 +    set (GTEST_LIB_DIR "/home/eris/gamedev/deps/gtest/current/build")
    1.61 +endif ()
    1.62 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/test/main.cpp	Mon Sep 15 01:02:04 2014 -0500
     2.3 @@ -0,0 +1,1185 @@
     2.4 +#include <iostream>
     2.5 +#include <iomanip>
     2.6 +#include <limits>
     2.7 +#include <string>
     2.8 +
     2.9 +using namespace std;
    2.10 +
    2.11 +#include "Math.h"
    2.12 +using namespace arda::Math;
    2.13 +
    2.14 +#include "gtest/gtest.h"
    2.15 +
    2.16 +////////////////////////////////////////////////////////////////////////////////
    2.17 +// Vector2iTest
    2.18 +
    2.19 +TEST( Vector2iTest, ConstructFromSingleValue ) {
    2.20 +    Vector2i v2i_0(0);
    2.21 +    EXPECT_EQ( 0, v2i_0.x ) << "x component is not 0";
    2.22 +    EXPECT_EQ( 0, v2i_0.y ) << "y component is not 0";
    2.23 +
    2.24 +    Vector2i v2i_1(1);
    2.25 +    EXPECT_EQ( 1, v2i_1.x ) << "x component is not 1";
    2.26 +    EXPECT_EQ( 1, v2i_1.y ) << "y component is not 1";
    2.27 +    }
    2.28 +
    2.29 +TEST( Vector2iTest, ConstructFromMultipleValue ) {
    2.30 +    Vector2i v2i(1, 2);
    2.31 +    EXPECT_EQ( 1, v2i.x ) << "x component is not 1";
    2.32 +    EXPECT_EQ( 2, v2i.y ) << "y component is not 2";
    2.33 +    }
    2.34 +
    2.35 +TEST( Vector2iTest, ConstructFromVector ) {
    2.36 +    Vector2i v2i_1(1, 2);
    2.37 +
    2.38 +    Vector2i v2i_2(v2i_1);
    2.39 +    EXPECT_EQ( 1, v2i_2.x ) << "x component is not 1";
    2.40 +    EXPECT_EQ( 2, v2i_2.y ) << "y component is not 2";
    2.41 +    }
    2.42 +
    2.43 +////////////////////////////////////////////////////////////////////////////////
    2.44 +// Vector3fTest
    2.45 +
    2.46 +TEST( Vector3fTest, ConstructFromSingleValue ) {
    2.47 +    Vector3f v3f_0(0.0);
    2.48 +    EXPECT_EQ( 0.0, v3f_0.x ) << "x component is not 0.0";
    2.49 +    EXPECT_EQ( 0.0, v3f_0.y ) << "y component is not 0.0";
    2.50 +    EXPECT_EQ( 0.0, v3f_0.z ) << "z component is not 0.0";
    2.51 +
    2.52 +    Vector3f v3f_1(1.0);
    2.53 +    EXPECT_EQ( 1.0, v3f_1.x ) << "x component is not 1.0";
    2.54 +    EXPECT_EQ( 1.0, v3f_1.y ) << "y component is not 1.0";
    2.55 +    EXPECT_EQ( 1.0, v3f_1.y ) << "z component is not 1.0";
    2.56 +    }
    2.57 +
    2.58 +TEST( Vector3fTest, ConstructFromMultipleValue ) {
    2.59 +    Vector3f v3f(1.0, 2.0, 3.0);
    2.60 +    EXPECT_EQ( 1.0, v3f.x ) << "x component is not 1.0";
    2.61 +    EXPECT_EQ( 2.0, v3f.y ) << "y component is not 2.0";
    2.62 +    EXPECT_EQ( 3.0, v3f.z ) << "z component is not 3.0";
    2.63 +    }
    2.64 +
    2.65 +TEST( Vector3fTest, ConstructFromVector ) {
    2.66 +    Vector3f v3f_1 (1.0, 2.0, 3.0);
    2.67 +
    2.68 +    Vector3f v3f (v3f_1);
    2.69 +    EXPECT_EQ( 1.0, v3f.x ) << "x component is not 1.0";
    2.70 +    EXPECT_EQ( 2.0, v3f.y ) << "y component is not 2.0";
    2.71 +    EXPECT_EQ( 3.0, v3f.z ) << "z component is not 3.0";
    2.72 +    }
    2.73 +
    2.74 +
    2.75 +////////////////////////////////////////////////////////////////////////////////
    2.76 +// Vector4dTest
    2.77 +
    2.78 +TEST( Vector4dTest, ConstructFromSingleValue ) {
    2.79 +    Vector4d v4d_0(0.0);
    2.80 +    EXPECT_EQ( 0.0, v4d_0.x ) << "x component is not 0.0";
    2.81 +    EXPECT_EQ( 0.0, v4d_0.y ) << "y component is not 0.0";
    2.82 +    EXPECT_EQ( 0.0, v4d_0.z ) << "z component is not 0.0";
    2.83 +    EXPECT_EQ( 0.0, v4d_0.w ) << "w component is not 0.0";
    2.84 +
    2.85 +    Vector4d v4d_1(1.0);
    2.86 +    EXPECT_EQ( 1.0, v4d_1.x ) << "x component is not 1.0";
    2.87 +    EXPECT_EQ( 1.0, v4d_1.y ) << "y component is not 1.0";
    2.88 +    EXPECT_EQ( 1.0, v4d_1.z ) << "z component is not 1.0";
    2.89 +    EXPECT_EQ( 1.0, v4d_1.w ) << "w component is not 1.0";
    2.90 +    }
    2.91 +
    2.92 +TEST( Vector4dTest, ConstructFromMultipleValue ) {
    2.93 +    Vector4d v4d_1(1.0, 2.0, 3.0, 4.0);
    2.94 +
    2.95 +    Vector4d v4d (v4d_1);
    2.96 +    EXPECT_EQ( 1.0, v4d.x ) << "x component is not 1.0";
    2.97 +    EXPECT_EQ( 2.0, v4d.y ) << "y component is not 2.0";
    2.98 +    EXPECT_EQ( 3.0, v4d.z ) << "z component is not 3.0";
    2.99 +    EXPECT_EQ( 4.0, v4d.w ) << "w component is not 4.0";
   2.100 +    }
   2.101 +
   2.102 +TEST( Vector4dTest, ConstructFromVector ) {
   2.103 +    Vector4d v4d_1 (1.0, 2.0, 3.0, 4.0);
   2.104 +
   2.105 +    Vector4d v4d (v4d_1);
   2.106 +    EXPECT_EQ( 1.0, v4d.x ) << "x component is not 1.0";
   2.107 +    EXPECT_EQ( 2.0, v4d.y ) << "y component is not 2.0";
   2.108 +    EXPECT_EQ( 3.0, v4d.z ) << "z component is not 3.0";
   2.109 +    EXPECT_EQ( 4.0, v4d.w ) << "w component is not 4.0";
   2.110 +    }
   2.111 +
   2.112 +
   2.113 +
   2.114 +
   2.115 +int main(int argc, char **argv) {
   2.116 +  ::testing::InitGoogleTest(&argc, argv);
   2.117 +  return RUN_ALL_TESTS();
   2.118 +}
   2.119 +
   2.120 +
   2.121 +#ifdef NOTHING
   2.122 +
   2.123 +////////////////////////////////////////////////////////////////////////////////
   2.124 +void test_vector(void)
   2.125 +   {
   2.126 +   string s1, s2;
   2.127 +
   2.128 +
   2.129 +   {
   2.130 +   cout << "===============================================================" << endl <<
   2.131 +	 "Testing Vector array indexing" << endl;
   2.132 +   Vector2i v2i(1,2);
   2.133 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.134 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.135 +
   2.136 +   cout << setw(40) << "v2i: " << v2i[0] << ", " << v2i[1] << endl;
   2.137 +   cout << setw(40) << "v3f: " << v3f[0] << ", " << v3f[1] << ", " << v3f[2] << endl;
   2.138 +   cout << setw(40) << "v4d: " << v4d[0] << ", " << v4d[1] << ", " << v4d[2] << ", " << v4d[3] << endl;
   2.139 +   }
   2.140 +
   2.141 +   {
   2.142 +   cout << "===============================================================" << endl <<
   2.143 +	 "Testing Vector assignment" << endl;
   2.144 +   Vector2i v2i(1,2);
   2.145 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.146 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.147 +   Vector2i v2i_2(0);
   2.148 +   Vector3f v3f_2(0);
   2.149 +   Vector4d v4d_2(0);
   2.150 +
   2.151 +   cout << "Before assignment" << endl;
   2.152 +   cout << setw(40) << "v2i: " << v2i.to_string() << endl;
   2.153 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.154 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.155 +   cout << setw(40) << "v2i_2: " << v2i_2.to_string() << endl;
   2.156 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.157 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.158 +
   2.159 +   v2i_2 = v2i;
   2.160 +   v3f_2 = v3f;
   2.161 +   v4d_2 = v4d;
   2.162 +   cout << "After assignment by =" << endl;
   2.163 +   cout << setw(40) << "v2i_2: " << v2i_2.to_string() << endl;
   2.164 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.165 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.166 +
   2.167 +   v2i_2.assign(1, 1);
   2.168 +   v3f_2.assign(2.2, 2.2, 2.2);
   2.169 +   v4d_2.assign(3.3, 3.3, 3.3, 3.3);
   2.170 +   cout << "After assignment by assign()" << endl;
   2.171 +   cout << setw(40) << "v2i_2: " << v2i_2.to_string() << endl;
   2.172 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.173 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.174 +   }
   2.175 +
   2.176 +   {
   2.177 +   cout << "===============================================================" << endl <<
   2.178 +	 "Testing Vector comparison" << endl;
   2.179 +   Vector2i v2i(1,2);
   2.180 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.181 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.182 +   Vector2i v2i_2(1,2);
   2.183 +   Vector3f v3f_2(1.1f, 2.2f, 3.3f);
   2.184 +   Vector4d v4d_2(1.1, 2.2, 3.3, 4.4);
   2.185 +   Vector2i v2i_3(0);
   2.186 +   Vector3f v3f_3(0);
   2.187 +   Vector4d v4d_3(0);
   2.188 +
   2.189 +   cout << setw(40) << "v2i: " << v2i.to_string() << endl;
   2.190 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.191 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.192 +   cout << setw(40) << "v2i_2: " << v2i_2.to_string() << endl;
   2.193 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.194 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.195 +   cout << setw(40) << "v2i_3: " << v2i_3.to_string() << endl;
   2.196 +   cout << setw(40) << "v3f_3: " << v3f_3.to_string() << endl;
   2.197 +   cout << setw(40) << "v4d_3: " << v4d_3.to_string() << endl;
   2.198 +   cout << boolalpha;
   2.199 +   cout << setw(40) << "v2i == v2i_2: " << (v2i == v2i_2) << endl;
   2.200 +   cout << setw(40) << "v2i == v2i_3: " << (v2i == v2i_3) << endl;
   2.201 +   cout << setw(40) << "v2i != v2i_2: " << (v2i != v2i_2) << endl;
   2.202 +   cout << setw(40) << "v2i != v2i_3: " << (v2i != v2i_3) << endl;
   2.203 +   cout << setw(40) << "v3f == v3f_2: " << (v3f == v3f_2) << endl;
   2.204 +   cout << setw(40) << "v3f == v3f_3: " << (v3f == v3f_3) << endl;
   2.205 +   cout << setw(40) << "v3f != v3f_2: " << (v3f != v3f_2) << endl;
   2.206 +   cout << setw(40) << "v3f != v3f_3: " << (v3f != v3f_3) << endl;
   2.207 +   cout << setw(40) << "v4d == v4d_2: " << (v4d == v4d_2) << endl;
   2.208 +   cout << setw(40) << "v4d == v4d_3: " << (v4d == v4d_3) << endl;
   2.209 +   cout << setw(40) << "v4d != v4d_2: " << (v4d != v4d_2) << endl;
   2.210 +   cout << setw(40) << "v4d != v4d_3: " << (v4d != v4d_3) << endl;
   2.211 +   }
   2.212 +
   2.213 +   {
   2.214 +   cout << "===============================================================" << endl <<
   2.215 +	 "Testing Vector addition" << endl;
   2.216 +   Vector2i v2i(1,2);
   2.217 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.218 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.219 +   Vector2i v2i_2(3,4);
   2.220 +   Vector3f v3f_2(4.4, 5.5, 6.6);
   2.221 +   Vector4d v4d_2(5.5, 6.6, 7.7, 8.8);
   2.222 +   Vector2i v2i_3(0);
   2.223 +   Vector3f v3f_3(0);
   2.224 +   Vector4d v4d_3(0);
   2.225 +
   2.226 +   cout << setw(40) << "v2i: " << v2i.to_string() << endl;
   2.227 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.228 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.229 +   cout << setw(40) << "v2i_2: " << v2i_2.to_string() << endl;
   2.230 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.231 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.232 +   v2i_3 = v2i + v2i_2;
   2.233 +   v3f_3 = v3f + v3f_2;
   2.234 +   v4d_3 = v4d + v4d_2;
   2.235 +   cout << setw(40) << "v2i_3 = v2i + v2i_2: " << v2i_3.to_string() << endl;
   2.236 +   cout << setw(40) << "v3f_3 = v3f + v3f_2: " << v3f_3.to_string() << endl;
   2.237 +   cout << setw(40) << "v4d_3 = v4d + v4d_2: " << v4d_3.to_string() << endl;
   2.238 +   v2i_3 += v2i_2;
   2.239 +   v3f_3 += v3f_2;
   2.240 +   v4d_3 += v4d_3;
   2.241 +   cout << setw(40) << "v2i_3 += v2i_2: " << v2i_3.to_string() << endl;
   2.242 +   cout << setw(40) << "v3f_3 += v3f_2: " << v3f_3.to_string() << endl;
   2.243 +   cout << setw(40) << "v4d_3 += v4d_3: " << v4d_3.to_string() << endl;
   2.244 +   }
   2.245 +
   2.246 +   {
   2.247 +   cout << "===============================================================" << endl <<
   2.248 +	 "Testing Vector subtraction" << endl;
   2.249 +   Vector2i v2i(1,2);
   2.250 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.251 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.252 +   Vector2i v2i_2(3,4);
   2.253 +   Vector3f v3f_2(4.4, 5.5, 6.6);
   2.254 +   Vector4d v4d_2(5.5, 6.6, 7.7, 8.8);
   2.255 +   Vector2i v2i_3(0);
   2.256 +   Vector3f v3f_3(0);
   2.257 +   Vector4d v4d_3(0);
   2.258 +
   2.259 +   cout << setw(40) << "v2i: " << v2i.to_string() << endl;
   2.260 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.261 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.262 +   cout << setw(40) << "v2i_2: " << v2i_2.to_string() << endl;
   2.263 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.264 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.265 +   v2i_3 = v2i - v2i_2;
   2.266 +   v3f_3 = v3f - v3f_2;
   2.267 +   v4d_3 = v4d - v4d_2;
   2.268 +   cout << setw(40) << "v2i_3 = v2i - v2i_2: " << v2i_3.to_string() << endl;
   2.269 +   cout << setw(40) << "v3f_3 = v3f - v3f_2: " << v3f_3.to_string() << endl;
   2.270 +   cout << setw(40) << "v4d_3 = v4d - v4d_2: " << v4d_3.to_string() << endl;
   2.271 +   v2i_3 -= v2i_2;
   2.272 +   v3f_3 -= v3f_2;
   2.273 +   v4d_3 -= v4d_3;
   2.274 +   cout << setw(40) << "v2i_3 -= v2i_2: " << v2i_3.to_string() << endl;
   2.275 +   cout << setw(40) << "v3f_3 -= v3f_2: " << v3f_3.to_string() << endl;
   2.276 +   cout << setw(40) << "v4d_3 -= v4d_3: " << v4d_3.to_string() << endl;
   2.277 +   }
   2.278 +
   2.279 +   {
   2.280 +   cout << "===============================================================" << endl <<
   2.281 +	 "Testing Vector scalar multiplication" << endl;
   2.282 +   Vector2i v2i(1,2);
   2.283 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.284 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.285 +   Vector2i v2i_2(0);
   2.286 +   Vector3f v3f_2(0);
   2.287 +   Vector4d v4d_2(0);
   2.288 +   int i = 2;
   2.289 +   float f = 2.f;
   2.290 +   double d = 2.0;
   2.291 +
   2.292 +   cout << setw(40) << "i: " << i << endl;
   2.293 +   cout << setw(40) << "f: " << f << endl;
   2.294 +   cout << setw(40) << "d: " << d << endl;
   2.295 +   cout << setw(40) << "v2i: " << v2i.to_string() << endl;
   2.296 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.297 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.298 +   cout << setw(40) << "v2i_2: " << v2i_2.to_string() << endl;
   2.299 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.300 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.301 +   v2i_2 = v2i * i;
   2.302 +   v3f_2 = v3f * f;
   2.303 +   v4d_2 = v4d * d;
   2.304 +   cout << setw(40) << "v2i_2 = v2i * i: " << v2i_2.to_string() << endl;
   2.305 +   cout << setw(40) << "v3f_2 = v3f * f: " << v3f_2.to_string() << endl;
   2.306 +   cout << setw(40) << "v4d_2 = v4d * d: " << v4d_2.to_string() << endl;
   2.307 +   v2i_2 *= i;
   2.308 +   v3f_2 *= f;
   2.309 +   v4d_2 *= d;
   2.310 +   cout << setw(40) << "v2i_2 *= i: " << v2i_2.to_string() << endl;
   2.311 +   cout << setw(40) << "v3f_2 *= f: " << v3f_2.to_string() << endl;
   2.312 +   cout << setw(40) << "v4d_2 *= d: " << v4d_2.to_string() << endl;
   2.313 +   }
   2.314 +
   2.315 +   {
   2.316 +   cout << "===============================================================" << endl <<
   2.317 +	 "Testing Vector scalar division" << endl;
   2.318 +   Vector2i v2i(1,2);
   2.319 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.320 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.321 +   Vector2i v2i_2(0);
   2.322 +   Vector3f v3f_2(0);
   2.323 +   Vector4d v4d_2(0);
   2.324 +   int i = 2;
   2.325 +   float f = 2.f;
   2.326 +   double d = 2.0;
   2.327 +
   2.328 +   cout << setw(40) << "v2i: " << v2i.to_string() << endl;
   2.329 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.330 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.331 +   cout << setw(40) << "v2i_2: " << v2i_2.to_string() << endl;
   2.332 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.333 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.334 +   v2i_2 = v2i / i;
   2.335 +   v3f_2 = v3f / f;
   2.336 +   v4d_2 = v4d / d;
   2.337 +   cout << setw(40) << "v2i_2 = v2i / i: " << v2i_2.to_string() << endl;
   2.338 +   cout << setw(40) << "v3f_2 = v3f / f: " << v3f_2.to_string() << endl;
   2.339 +   cout << setw(40) << "v4d_2 = v4d / d: " << v4d_2.to_string() << endl;
   2.340 +   v2i_2 /= i;
   2.341 +   v3f_2 /= f;
   2.342 +   v4d_2 /= d;
   2.343 +   cout << setw(40) << "v2i_2 /= i: " << v2i_2.to_string() << endl;
   2.344 +   cout << setw(40) << "v3f_2 /= f: " << v3f_2.to_string() << endl;
   2.345 +   cout << setw(40) << "v4d_2 /= d: " << v4d_2.to_string() << endl;
   2.346 +   }
   2.347 +
   2.348 +   {
   2.349 +   cout << "===============================================================" << endl <<
   2.350 +	 "Testing Vector cross product" << endl;
   2.351 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.352 +   Vector3f v3f_2(4.4, 5.5, 6.6);
   2.353 +   Vector3f v3f_3(0);
   2.354 +   Vector3f v3f_4(0);
   2.355 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.356 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.357 +   cout << setw(40) << "v3f_3: " << v3f_3.to_string() << endl;
   2.358 +   v3f.cross(v3f_2, v3f_3);
   2.359 +   cout << setw(40) << "v3f.cross(v3f_2, v3f_3): " << v3f_3.to_string() << endl;
   2.360 +   v3f_4 = 2.0 * v3f.cross(v3f_2);
   2.361 +   cout << setw(40) << "2.0 * v3f.cross(v3f_2,): " << v3f_4.to_string() << endl;
   2.362 +   v3f_4.assign(0,0,0);
   2.363 +   v3f.cross(v3f_2, v3f_4);
   2.364 +   cout << setw(40) << "v3f.cross(v3f_2, v3f_4): " << v3f_4.to_string() << endl;
   2.365 +   }
   2.366 +
   2.367 +   {
   2.368 +   cout << "===============================================================" << endl <<
   2.369 +	 "Testing Vector dot product" << endl;
   2.370 +   Vector2i v2i(1, 2);
   2.371 +   Vector2i v2i_2(3, 4);
   2.372 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.373 +   Vector3f v3f_2(4.4, 5.5, 6.6);
   2.374 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.375 +   Vector4d v4d_2(5.5, 6.6, 7.7, 8.8);
   2.376 +   int i;
   2.377 +   float f;
   2.378 +   double d;
   2.379 +   cout << setw(40) << "v2i: " << v2i.to_string() << endl;
   2.380 +   cout << setw(40) << "v2i_2: " << v2i_2.to_string() << endl;
   2.381 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.382 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.383 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.384 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.385 +   i = v2i.dot(v2i_2);
   2.386 +   cout << setw(40) << "i = v2i.dot(v2i_2): " << i << endl;
   2.387 +   f = v3f.dot(v3f_2);
   2.388 +   cout << setw(40) << "f = v3f.dot(v3f_2): " << f << endl;
   2.389 +   d = v4d.dot(v4d_2);
   2.390 +   cout << setw(40) << "d = v4d.dot(v4d_2): " << d << endl;
   2.391 +   }
   2.392 +
   2.393 +   {
   2.394 +   cout << "===============================================================" << endl <<
   2.395 +	 "Testing Vector length" << endl;
   2.396 +   Vector2i v2i(1, 2);
   2.397 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.398 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.399 +   cout << setw(40) << "v2i: " << v2i.to_string() << endl;
   2.400 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.401 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.402 +   cout << setw(40) << "v2i.length(): " << v2i.length() << endl;
   2.403 +   cout << setw(40) << "v3f.length(): " << v3f.length() << endl;
   2.404 +   cout << setw(40) << "v4d.length(): " << v4d.length() << endl;
   2.405 +   }
   2.406 +
   2.407 +   {
   2.408 +   cout << "===============================================================" << endl <<
   2.409 +	 "Testing Vector normalize" << endl;
   2.410 +   Vector2f v2f(1.1, 2.2);
   2.411 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.412 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.413 +   cout << setw(40) << "v2f: " << v2f.to_string() << endl;
   2.414 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.415 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.416 +   v2f.normalize();
   2.417 +   cout << setw(40) << "v2f.normalize() " << v2f.to_string() << endl;
   2.418 +   v3f.normalize();
   2.419 +   cout << setw(40) << "v3f.normalize() " << v3f.to_string() << endl;
   2.420 +   v4d.normalize();
   2.421 +   cout << setw(40) << "v4d.normalize() " << v4d.to_string() << endl;
   2.422 +   cout << setw(40) << "v2f.length(): " << v2f.length() << endl;
   2.423 +   cout << setw(40) << "v3f.length(): " << v3f.length() << endl;
   2.424 +   cout << setw(40) << "v4d.length(): " << v4d.length() << endl;
   2.425 +   }
   2.426 +
   2.427 +   {
   2.428 +   cout << "===============================================================" << endl <<
   2.429 +	 "Testing Vector get_angle" << endl;
   2.430 +   Vector2i v2i(1, 2);
   2.431 +   Vector2i v2i_2(3, 4);
   2.432 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.433 +   Vector3f v3f_2(4.4, 5.5, 6.6);
   2.434 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.435 +   Vector4d v4d_2(5.5, 6.6, 7.7, 8.8);
   2.436 +   double d;
   2.437 +   cout << setw(40) << "v2i: " << v2i.to_string() << endl;
   2.438 +   cout << setw(40) << "v2i_2: " << v2i_2.to_string() << endl;
   2.439 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.440 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.441 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.442 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.443 +   d = v2i.get_angle(v2i_2);
   2.444 +   cout << setw(40) << "d = v2i.get_angle(v2i_2): " << d << endl;
   2.445 +   d = v3f.get_angle(v3f_2);
   2.446 +   cout << setw(40) << "d = v3f.get_angle(v3f_2): " << d << endl;
   2.447 +   d = v4d.get_angle(v4d_2);
   2.448 +   cout << setw(40) << "d = v4d.get_angle(v4d_2): " << d << endl;
   2.449 +   }
   2.450 +
   2.451 +   {
   2.452 +   cout << "===============================================================" << endl <<
   2.453 +	 "Testing Vector get_anglen" << endl;
   2.454 +   Vector2f v2f(1.1, 2.2);
   2.455 +   Vector2f v2f_2(3.3, 4.4);
   2.456 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.457 +   Vector3f v3f_2(4.4, 5.5, 6.6);
   2.458 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.459 +   Vector4d v4d_2(5.5, 6.6, 7.7, 8.8);
   2.460 +   double d;
   2.461 +   v2f.normalize();
   2.462 +   v2f_2.normalize();
   2.463 +   v3f.normalize();
   2.464 +   v3f_2.normalize();
   2.465 +   v4d.normalize();
   2.466 +   v4d_2.normalize();
   2.467 +   cout << setw(40) << "v2f: " << v2f.to_string() << endl;
   2.468 +   cout << setw(40) << "v2f_2: " << v2f_2.to_string() << endl;
   2.469 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.470 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.471 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.472 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.473 +   d = v2f.get_anglen(v2f_2);
   2.474 +   cout << setw(40) << "d = v2f.get_anglen(v2f_2): " << d << endl;
   2.475 +   d = v3f.get_anglen(v3f_2);
   2.476 +   cout << setw(40) << "d = v3f.get_anglen(v3f_2): " << d << endl;
   2.477 +   d = v4d.get_anglen(v4d_2);
   2.478 +   cout << setw(40) << "d = v4d.get_anglen(v4d_2): " << d << endl;
   2.479 +   }
   2.480 +
   2.481 +   {
   2.482 +   cout << "===============================================================" << endl <<
   2.483 +	 "Testing Vector get_proj" << endl;
   2.484 +   Vector2f v2f(1.1, 2.2);
   2.485 +   Vector2f v2f_2(3.3, 4.4);
   2.486 +   Vector2f v2f_3(0);
   2.487 +   Vector3f v3f(1.1f, 2.2f, 3.3f);
   2.488 +   Vector3f v3f_2(4.4, 5.5, 6.6);
   2.489 +   Vector3f v3f_3(0);
   2.490 +   Vector4d v4d(1.1, 2.2, 3.3, 4.4);
   2.491 +   Vector4d v4d_2(5.5, 6.6, 7.7, 8.8);
   2.492 +   Vector4d v4d_3(0);
   2.493 +   cout << setw(40) << "v2f: " << v2f.to_string() << endl;
   2.494 +   cout << setw(40) << "v2f_2: " << v2f_2.to_string() << endl;
   2.495 +   cout << setw(40) << "v3f: " << v3f.to_string() << endl;
   2.496 +   cout << setw(40) << "v3f_2: " << v3f_2.to_string() << endl;
   2.497 +   cout << setw(40) << "v4d: " << v4d.to_string() << endl;
   2.498 +   cout << setw(40) << "v4d_2: " << v4d_2.to_string() << endl;
   2.499 +   v2f_3 = v2f.proj(v2f_2);
   2.500 +   cout << setw(40) << "v2f_3 = v2f.proj(v3f_2): " << v2f_3.to_string() << endl;
   2.501 +   v3f_3 = v3f.proj(v3f_2);
   2.502 +   cout << setw(40) << "v3f_3 = v3f.proj(v3f_2): " << v3f_3.to_string() << endl;
   2.503 +   v4d_3 = v4d.proj(v4d_2);
   2.504 +   cout << setw(40) << "v4d_3 = v4d.proj(v4d_2): " << v4d_3.to_string() << endl;
   2.505 +   v2f_3.assign(0,0);
   2.506 +   v3f_3.assign(0,0,0);
   2.507 +   v4d_3.assign(0,0,0,0);
   2.508 +   v2f.proj(v2f_2, v2f_3);
   2.509 +   cout << setw(40) << "v2f.proj(v2f_2, v2f_3): " << v2f_3.to_string() << endl;
   2.510 +   v3f.proj(v3f_2, v3f_3);
   2.511 +   cout << setw(40) << "v3f.proj(v3f_2, v3f_3): " << v3f_3.to_string() << endl;
   2.512 +   v4d.proj(v4d_2, v4d_3);
   2.513 +   cout << setw(40) << "v4d.proj(v4d_2, v4d_3): " << v4d_3.to_string() << endl;
   2.514 +   }
   2.515 +
   2.516 +   }
   2.517 +
   2.518 +////////////////////////////////////////////////////////////////////////////////
   2.519 +void test_matrix(void)
   2.520 +   {
   2.521 +   string s1, s2;
   2.522 +
   2.523 +   {
   2.524 +   cout << "===============================================================" << endl <<
   2.525 +	 "Testing Maxtrix constructors" << endl;
   2.526 +   Matrix22i m22i_1(0);
   2.527 +   Matrix22i m22i_2(1);
   2.528 +   Matrix22i m22i_3(1, 2, 3, 4);
   2.529 +   Matrix22i m22i_4(m22i_3);
   2.530 +
   2.531 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.532 +   cout << setw(40) << "m22i_2: " << m22i_2.to_string() << endl;
   2.533 +   cout << setw(40) << "m22i_3: " << m22i_3.to_string() << endl;
   2.534 +   cout << setw(40) << "m22i_4: " << m22i_4.to_string() << endl;
   2.535 +
   2.536 +   Matrix33f m33f_1(0.0f);
   2.537 +   Matrix33f m33f_2(1.1f);
   2.538 +   Matrix33f m33f_3(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.539 +   Matrix33f m33f_4(m33f_3);
   2.540 +
   2.541 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.542 +   cout << setw(40) << "m33f_2: " << m33f_2.to_string() << endl;
   2.543 +   cout << setw(40) << "m33f_3: " << m33f_3.to_string() << endl;
   2.544 +   cout << setw(40) << "m33f_4: " << m33f_4.to_string() << endl;
   2.545 +
   2.546 +   Matrix44d m44d_1(0.0);
   2.547 +   Matrix44d m44d_2(1.1);
   2.548 +   Matrix44d m44d_3(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.549 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.550 +   Matrix44d m44d_4(m44d_3);
   2.551 +
   2.552 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.553 +   cout << setw(40) << "m44d_2: " << m44d_2.to_string() << endl;
   2.554 +   cout << setw(40) << "m44d_3: " << m44d_3.to_string() << endl;
   2.555 +   cout << setw(40) << "m44d_4: " << m44d_4.to_string() << endl;
   2.556 +   }
   2.557 +
   2.558 +   {
   2.559 +   cout << "===============================================================" << endl <<
   2.560 +	 "Testing Maxtrix array indexing" << endl;
   2.561 +   Matrix22i m22i(1, 2, 3, 4);
   2.562 +
   2.563 +   cout << setw(40) << "m22i: " << m22i[0] << " "  << m22i[1] << " " << m22i[2] << " " << m22i[3] << " "<< endl;
   2.564 +
   2.565 +   Matrix33f m33f(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.566 +
   2.567 +   cout << setw(40) << "m33f: " << m33f[0] << " " << m33f[1] << " " << m33f[2] << " " << m33f[3] << " " << m33f[4] << " " << m33f[5] << " " << m33f[6] << " " << m33f[7] << " " << m33f[8] << endl;
   2.568 +
   2.569 +   Matrix44d m44d(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.570 +		  12.12, 13.13, 14.14, 15.15, 16.16);
   2.571 +
   2.572 +   cout << setw(40) << "m44d: " << m44d[0] << " " << m44d[1] << " " << m44d[2] << " " << m44d[3] << " " << m44d[4] << " " << m44d[5] << " " << m44d[6] << " " << m44d[7] << " " << m44d[8] << " " << m44d[9] << " " << m44d[10] << " " << m44d[11] << " " << m44d[12] << " " << m44d[13] << " " << m44d[14] << " " << m44d[15] << endl;
   2.573 +   }
   2.574 +
   2.575 +   {
   2.576 +   cout << "===============================================================" << endl <<
   2.577 +	 "Testing Maxtrix assignment" << endl;
   2.578 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.579 +   Matrix22i m22i_2(5, 6, 7, 8);
   2.580 +
   2.581 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.582 +   cout << setw(40) << "m22i_2: " << m22i_2.to_string() << endl;
   2.583 +
   2.584 +   m22i_2 = m22i_1;
   2.585 +   cout << setw(40) << "m22i_2 = m22i_1: " << m22i_2.to_string() << endl;
   2.586 +
   2.587 +   m22i_2.assign(9, 10, 11, 12);
   2.588 +   cout << setw(40) << "m22i_2.assign(9, 10, 11, 12): " 
   2.589 +	<< m22i_2.to_string() << endl;
   2.590 +
   2.591 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.592 +   Matrix33f m33f_2(10.10f, 11.11f, 12.12f, 13.13f, 14.14f, 15.15f, 16.16f, 17.17f, 18.18f);
   2.593 +
   2.594 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.595 +   cout << setw(40) << "m33f_2: " << m33f_2.to_string() << endl;
   2.596 +
   2.597 +   m33f_2 = m33f_1;
   2.598 +   cout << setw(40) << "m33f_2 = m33f_1: " << m33f_2.to_string() << endl;
   2.599 +
   2.600 +   m33f_2.assign(19.19f, 20.20f, 21.21f, 22.22f, 23.23f, 24.24f, 25.25f, 26.26f, 27.27f);
   2.601 +   cout << setw(40) << "m33f_2.assign(19.19f, 20.20f, ... , 27.27f): " 
   2.602 +	<< m33f_2.to_string() << endl;
   2.603 +
   2.604 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.605 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.606 +   Matrix44d m44d_2(16.16, 17.17, 18.18, 19.19,
   2.607 +		    20.20, 21.21, 22.22, 23.23,
   2.608 +		    24.24, 25.25, 26.26, 27.27,
   2.609 +		    28.28, 29.29, 30.30, 31.31);
   2.610 +
   2.611 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.612 +   cout << setw(40) << "m44d_2: " << m44d_2.to_string() << endl;
   2.613 +
   2.614 +   m44d_2 = m44d_1;
   2.615 +   cout << setw(40) << "m44d_2 = m44d_1: " << m44d_2.to_string() << endl;
   2.616 +
   2.617 +   m44d_2.assign(32.32, 33.33, 34.34, 35.35,
   2.618 +		 36.36, 37.37, 38.38, 39.39,
   2.619 +		 40.40, 41.41, 42.42, 43.43,
   2.620 +		 44.44, 45.45, 46.46, 47.47);
   2.621 +   cout << setw(40) << "m44d_2.assign(32.32, 33.33, ... , 47.47): " 
   2.622 +	<< m44d_2.to_string() << endl;
   2.623 +   }
   2.624 +
   2.625 +   {
   2.626 +   cout << "===============================================================" << endl <<
   2.627 +	 "Testing Maxtrix comparison" << endl;
   2.628 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.629 +   Matrix22i m22i_2(1, 2, 3, 4);
   2.630 +   Matrix22i m22i_3(0);
   2.631 +
   2.632 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.633 +   cout << setw(40) << "m22i_2: " << m22i_2.to_string() << endl;
   2.634 +   cout << setw(40) << "m22i_3: " << m22i_3.to_string() << endl;
   2.635 +   cout << boolalpha;
   2.636 +   cout << setw(40) << "m22i_1 == m22i_2: " << (m22i_1 == m22i_2) << endl;
   2.637 +   cout << setw(40) << "m22i_1 == m22i_3: " << (m22i_2 == m22i_3) << endl;
   2.638 +   cout << setw(40) << "m22i_1 != m22i_2: " << (m22i_1 != m22i_2) << endl;
   2.639 +   cout << setw(40) << "m22i_1 != m22i_3: " << (m22i_2 != m22i_3) << endl;
   2.640 +
   2.641 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.642 +   Matrix33f m33f_2(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.643 +   Matrix33f m33f_3(0.0f);
   2.644 +
   2.645 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.646 +   cout << setw(40) << "m33f_2: " << m33f_2.to_string() << endl;
   2.647 +   cout << setw(40) << "m33f_3: " << m33f_3.to_string() << endl;
   2.648 +   cout << boolalpha;
   2.649 +   cout << setw(40) << "m33f_1 == m33f_2: " << (m33f_1 == m33f_2) << endl;
   2.650 +   cout << setw(40) << "m33f_1 == m33f_3: " << (m33f_2 == m33f_3) << endl;
   2.651 +   cout << setw(40) << "m33f_1 != m33f_2: " << (m33f_1 != m33f_2) << endl;
   2.652 +   cout << setw(40) << "m33f_1 != m33f_3: " << (m33f_2 != m33f_3) << endl;
   2.653 +
   2.654 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.655 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.656 +   Matrix44d m44d_2(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.657 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.658 +   Matrix44d m44d_3(0.0);
   2.659 +
   2.660 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.661 +   cout << setw(40) << "m44d_2: " << m44d_2.to_string() << endl;
   2.662 +   cout << setw(40) << "m44d_3: " << m44d_3.to_string() << endl;
   2.663 +   cout << boolalpha;
   2.664 +   cout << setw(40) << "m44d_1 == m44d_2: " << (m44d_1 == m44d_2) << endl;
   2.665 +   cout << setw(40) << "m44d_1 == m44d_3: " << (m44d_2 == m44d_3) << endl;
   2.666 +   cout << setw(40) << "m44d_1 != m44d_2: " << (m44d_1 != m44d_2) << endl;
   2.667 +   cout << setw(40) << "m44d_1 != m44d_3: " << (m44d_2 != m44d_3) << endl;
   2.668 +   }
   2.669 +
   2.670 +   {
   2.671 +   cout << "===============================================================" << endl <<
   2.672 +	 "Testing Maxtrix addition" << endl;
   2.673 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.674 +   Matrix22i m22i_2(5, 6, 7, 8);
   2.675 +   Matrix22i m22i_3(0);
   2.676 +
   2.677 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.678 +   cout << setw(40) << "m22i_2: " << m22i_2.to_string() << endl;
   2.679 +   cout << setw(40) << "m22i_3: " << m22i_3.to_string() << endl;
   2.680 +   m22i_3 = m22i_1 + m22i_2;
   2.681 +   cout << setw(40) << "m22i_3 = m22i_1 + m22i_2: " << m22i_3.to_string() << endl;
   2.682 +
   2.683 +   m22i_3 += m22i_1;
   2.684 +   cout << setw(40) << "m22i_3 += m22i_1: " << m22i_3.to_string() << endl;
   2.685 +
   2.686 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.687 +   Matrix33f m33f_2(10.10f, 11.11f, 12.12f, 13.13f, 14.14f, 15.15f, 16.16f, 17.17f, 18.18f);
   2.688 +   Matrix33f m33f_3(0.0f);
   2.689 +
   2.690 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.691 +   cout << setw(40) << "m33f_2: " << m33f_2.to_string() << endl;
   2.692 +   cout << setw(40) << "m33f_3: " << m33f_3.to_string() << endl;
   2.693 +   m33f_3 = m33f_1 + m33f_2;
   2.694 +   cout << setw(40) << "m33f_3 = m33f_1 + m33f_2: " << m33f_3.to_string() << endl;
   2.695 +
   2.696 +   m33f_3 += m33f_1;
   2.697 +   cout << setw(40) << "m33f_3 += m33f_1: " << m33f_3.to_string() << endl;
   2.698 +
   2.699 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.700 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.701 +   Matrix44d m44d_2(16.16, 17.17, 18.18, 19.19,
   2.702 +		    20.20, 21.21, 22.22, 23.23,
   2.703 +		    24.24, 25.25, 26.26, 27.27,
   2.704 +		    28.28, 29.29, 30.30, 31.31);
   2.705 +   Matrix44d m44d_3(0.0);
   2.706 +
   2.707 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.708 +   cout << setw(40) << "m44d_2: " << m44d_2.to_string() << endl;
   2.709 +   cout << setw(40) << "m44d_3: " << m44d_3.to_string() << endl;
   2.710 +   m44d_3 = m44d_1 + m44d_2;
   2.711 +   cout << setw(40) << "m44d_3 = m44d_1 + m44d_2: " << m44d_3.to_string() << endl;
   2.712 +
   2.713 +   m44d_3 += m44d_1;
   2.714 +   cout << setw(40) << "m44d_3 += m44d_1: " << m44d_3.to_string() << endl;
   2.715 +   }
   2.716 +
   2.717 +   {
   2.718 +   cout << "===============================================================" << endl <<
   2.719 +	 "Testing Maxtrix subtraction" << endl;
   2.720 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.721 +   Matrix22i m22i_2(5, 6, 7, 8);
   2.722 +   Matrix22i m22i_3(0);
   2.723 +
   2.724 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.725 +   cout << setw(40) << "m22i_2: " << m22i_2.to_string() << endl;
   2.726 +   cout << setw(40) << "m22i_3: " << m22i_3.to_string() << endl;
   2.727 +   m22i_3 = m22i_1 - m22i_2;
   2.728 +   cout << setw(40) << "m22i_3 = m22i_1 - m22i_2: " << m22i_3.to_string() << endl;
   2.729 +
   2.730 +   m22i_3 -= m22i_1;
   2.731 +   cout << setw(40) << "m22i_3 -= m22i_1: " << m22i_3.to_string() << endl;
   2.732 +
   2.733 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.734 +   Matrix33f m33f_2(10.10f, 11.11f, 12.12f, 13.13f, 14.14f, 15.15f, 16.16f, 17.17f, 18.18f);
   2.735 +   Matrix33f m33f_3(0.0f);
   2.736 +
   2.737 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.738 +   cout << setw(40) << "m33f_2: " << m33f_2.to_string() << endl;
   2.739 +   cout << setw(40) << "m33f_3: " << m33f_3.to_string() << endl;
   2.740 +   m33f_3 = m33f_1 - m33f_2;
   2.741 +   cout << setw(40) << "m33f_3 = m33f_1 - m33f_2: " << m33f_3.to_string() << endl;
   2.742 +
   2.743 +   m33f_3 -= m33f_1;
   2.744 +   cout << setw(40) << "m33f_3 -= m33f_1: " << m33f_3.to_string() << endl;
   2.745 +
   2.746 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.747 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.748 +   Matrix44d m44d_2(16.16, 17.17, 18.18, 19.19,
   2.749 +		    20.20, 21.21, 22.22, 23.23,
   2.750 +		    24.24, 25.25, 26.26, 27.27,
   2.751 +		    28.28, 29.29, 30.30, 31.31);
   2.752 +   Matrix44d m44d_3(0.0);
   2.753 +
   2.754 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.755 +   cout << setw(40) << "m44d_2: " << m44d_2.to_string() << endl;
   2.756 +   cout << setw(40) << "m44d_3: " << m44d_3.to_string() << endl;
   2.757 +   m44d_3 = m44d_1 - m44d_2;
   2.758 +   cout << setw(40) << "m44d_3 = m44d_1 - m44d_2: " << m44d_3.to_string() << endl;
   2.759 +
   2.760 +   m44d_3 -= m44d_1;
   2.761 +   cout << setw(40) << "m44d_3 -= m44d_1: " << m44d_3.to_string() << endl;
   2.762 +   }
   2.763 +
   2.764 +   {
   2.765 +   cout << "===============================================================" << endl <<
   2.766 +	 "Testing Matrix scalar multiplication" << endl;
   2.767 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.768 +   Matrix22i m22i_2(0);
   2.769 +   int i = 2;
   2.770 +
   2.771 +   cout << setw(40) << "i: " << i << endl;
   2.772 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.773 +   cout << setw(40) << "m22i_2: " << m22i_2.to_string() << endl;
   2.774 +   m22i_2 = m22i_1 *i;
   2.775 +   cout << setw(40) << "m22i_2 = m22i_1 * i: " << m22i_2.to_string() << endl;
   2.776 +   m22i_2 = i * m22i_1;
   2.777 +   cout << setw(40) << "m22i_2 = i * m22i_1: " << m22i_2.to_string() << endl;
   2.778 +   m22i_2 *= i;
   2.779 +   cout << setw(40) << "m22i_2 *= i: " << m22i_2.to_string() << endl;
   2.780 +
   2.781 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.782 +   Matrix33f m33f_2(0.0f);
   2.783 +   float f = 2.0f;
   2.784 +
   2.785 +   cout << setw(40) << "f: " << f << endl;
   2.786 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.787 +   cout << setw(40) << "m33f_2: " << m33f_2.to_string() << endl;
   2.788 +   m33f_2 = m33f_1 * f;
   2.789 +   cout << setw(40) << "m33f_2 = m33f_1 * f: " << m33f_2.to_string() << endl;
   2.790 +   m33f_2 = f * m33f_1;
   2.791 +   cout << setw(40) << "m33f_2 = f * m33f_1: " << m33f_2.to_string() << endl;
   2.792 +   m33f_2 *= f;
   2.793 +   cout << setw(40) << "m33f_2 *= f: " << m33f_2.to_string() << endl;
   2.794 +
   2.795 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.796 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.797 +   Matrix44d m44d_2(0.0);
   2.798 +   double d = 2.0f;
   2.799 +
   2.800 +   cout << setw(40) << "d: " << d << endl;
   2.801 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.802 +   cout << setw(40) << "m44d_2: " << m44d_2.to_string() << endl;
   2.803 +   m44d_2 = m44d_1 * d;
   2.804 +   cout << setw(40) << "m44d_2 = m44d_1 * d: " << m44d_2.to_string() << endl;
   2.805 +   m44d_2 = d * m44d_1;
   2.806 +   cout << setw(40) << "m44d_2 = d * m44d_1: " << m44d_2.to_string() << endl;
   2.807 +   m44d_2 *= d;
   2.808 +   cout << setw(40) << "m44d_2 *= d: " << m44d_2.to_string() << endl;
   2.809 +   }
   2.810 +
   2.811 +   {
   2.812 +   cout << "===============================================================" << endl <<
   2.813 +	 "Testing Matrix scalar division" << endl;
   2.814 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.815 +   Matrix22i m22i_2(0);
   2.816 +   int i = 2;
   2.817 +
   2.818 +   cout << setw(40) << "i: " << i << endl;
   2.819 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.820 +   cout << setw(40) << "m22i_2: " << m22i_2.to_string() << endl;
   2.821 +   m22i_2 = m22i_1 / i;
   2.822 +   cout << setw(40) << "m22i_2 = m22i_1 / i: " << m22i_2.to_string() << endl;
   2.823 +   m22i_1 /= i;
   2.824 +   cout << setw(40) << "m22i_1 /= i: " << m22i_2.to_string() << endl;
   2.825 +
   2.826 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.827 +   Matrix33f m33f_2(0.0f);
   2.828 +   float f = 2.0f;
   2.829 +
   2.830 +   cout << setw(40) << "f: " << f << endl;
   2.831 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.832 +   cout << setw(40) << "m33f_2: " << m33f_2.to_string() << endl;
   2.833 +   m33f_2 = m33f_1 / f;
   2.834 +   cout << setw(40) << "m33f_2 = m33f_1 / f: " << m33f_2.to_string() << endl;
   2.835 +   m33f_1 /= f;
   2.836 +   cout << setw(40) << "m33f_1 /= f: " << m33f_2.to_string() << endl;
   2.837 +
   2.838 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.839 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.840 +   Matrix44d m44d_2(0.0);
   2.841 +   double d = 2.0f;
   2.842 +
   2.843 +   cout << setw(40) << "d: " << d << endl;
   2.844 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.845 +   cout << setw(40) << "m44d_2: " << m44d_2.to_string() << endl;
   2.846 +   m44d_2 = m44d_1 / d;
   2.847 +   cout << setw(40) << "m44d_2 = m44d_1 / d: " << m44d_2.to_string() << endl;
   2.848 +   m44d_1 /= d;
   2.849 +   cout << setw(40) << "m44d_1 /= d: " << m44d_2.to_string() << endl;
   2.850 +   }
   2.851 +
   2.852 +   {
   2.853 +   cout << "===============================================================" << endl <<
   2.854 +	 "Testing Maxtrix multiplication" << endl;
   2.855 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.856 +   Matrix22i m22i_2(5, 6, 7, 8);
   2.857 +   Matrix22i m22i_3(0);
   2.858 +
   2.859 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.860 +   cout << setw(40) << "m22i_2: " << m22i_2.to_string() << endl;
   2.861 +   cout << setw(40) << "m22i_3: " << m22i_3.to_string() << endl;
   2.862 +   m22i_3 = m22i_1 * m22i_2;
   2.863 +   cout << setw(40) << "m22i_3 = m22i_1 * m22i_2: " << m22i_3.to_string() << endl;
   2.864 +
   2.865 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.866 +   Matrix33f m33f_2(10.10f, 11.11f, 12.12f, 13.13f, 14.14f, 15.15f, 16.16f, 17.17f, 18.18f);
   2.867 +   Matrix33f m33f_3(0.0f);
   2.868 +
   2.869 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.870 +   cout << setw(40) << "m33f_2: " << m33f_2.to_string() << endl;
   2.871 +   cout << setw(40) << "m33f_3: " << m33f_3.to_string() << endl;
   2.872 +   m33f_3 = m33f_1 * m33f_2;
   2.873 +   cout << setw(40) << "m33f_3 = m33f_1 * m33f_2: " << m33f_3.to_string() << endl;
   2.874 +
   2.875 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.876 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.877 +   Matrix44d m44d_2(16.16, 17.17, 18.18, 19.19,
   2.878 +		    20.20, 21.21, 22.22, 23.23,
   2.879 +		    24.24, 25.25, 26.26, 27.27,
   2.880 +		    28.28, 29.29, 30.30, 31.31);
   2.881 +   Matrix44d m44d_3(0.0);
   2.882 +
   2.883 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.884 +   cout << setw(40) << "m44d_2: " << m44d_2.to_string() << endl;
   2.885 +   cout << setw(40) << "m44d_3: " << m44d_3.to_string() << endl;
   2.886 +   m44d_3 = m44d_1 * m44d_2;
   2.887 +   cout << setw(40) << "m44d_3 = m44d_1 * m44d_2: " << m44d_3.to_string() << endl;
   2.888 +   }
   2.889 +
   2.890 +   {
   2.891 +   cout << "===============================================================" << endl <<
   2.892 +	 "Testing Maxtrix det" << endl;
   2.893 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.894 +   double d;
   2.895 +
   2.896 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.897 +   d = det(m22i_1);
   2.898 +   cout << setw(40) << "d = det(m22i_1): " << d << endl;
   2.899 +
   2.900 +   // Note: singular matrix.  The real determinant is exactly zero.
   2.901 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.902 +
   2.903 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.904 +   d = det(m33f_1);
   2.905 +   cout << setw(40) << "d = det(m33f_1): " << d << endl;
   2.906 +
   2.907 +   // Note: singular matrix.  The real determinant is exactly zero.
   2.908 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.909 +		  12.12, 13.13, 14.14, 15.15, 16.16);
   2.910 +
   2.911 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.912 +   d = det(m44d_1);
   2.913 +   cout << setw(40) << "d = det(m44d_1): " << d << endl;
   2.914 +
   2.915 +   }
   2.916 +
   2.917 +   {
   2.918 +   cout << "===============================================================" << endl <<
   2.919 +	 "Testing Maxtrix transpose" << endl;
   2.920 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.921 +   Matrix22i m22i_2;
   2.922 +
   2.923 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.924 +   m22i_2 = transpose(m22i_1);
   2.925 +   cout << setw(40) << "m22i_2 = transpose(m22i_1): " << m22i_2.to_string() << endl;
   2.926 +
   2.927 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.928 +   Matrix33f m33f_2(0.0f);
   2.929 +
   2.930 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.931 +   m33f_2 = transpose(m33f_1);
   2.932 +   cout << setw(40) << "m33f_2 = transpose(m33f_1): " << m33f_2.to_string() << endl;
   2.933 +
   2.934 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.935 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.936 +   Matrix44d m44d_2(0.0);
   2.937 +
   2.938 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.939 +   m44d_2 = transpose(m44d_1);
   2.940 +   cout << setw(40) << "m44d_2 = transpose(m44d_1): " << m44d_2.to_string() << endl;
   2.941 +   }
   2.942 +
   2.943 +   {
   2.944 +   cout << "===============================================================" << endl <<
   2.945 +	 "Testing Maxtrix setidentity" << endl;
   2.946 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.947 +
   2.948 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.949 +   m22i_1.setidentity();
   2.950 +   cout << setw(40) << "m22i_1.setidentity(): " << m22i_1.to_string() << endl;
   2.951 +
   2.952 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.953 +
   2.954 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.955 +   m33f_1.setidentity();
   2.956 +   cout << setw(40) << "m33f_1.setidentity(): " << m33f_1.to_string() << endl;
   2.957 +   
   2.958 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
   2.959 +		    12.12, 13.13, 14.14, 15.15, 16.16);
   2.960 +   
   2.961 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
   2.962 +   m44d_1.setidentity();
   2.963 +   cout << setw(40) << "m44d_1.setidentity(): " << m44d_1.to_string() << endl;
   2.964 +   }
   2.965 +
   2.966 +   {
   2.967 +   cout << "===============================================================" << endl <<
   2.968 +	 "Testing Matrix getrow() and getcol()" << endl;
   2.969 +   Matrix22i m22i_1(1, 2, 3, 4);
   2.970 +   Vector2i v2i_1(0);
   2.971 +
   2.972 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
   2.973 +   v2i_1 = m22i_1.getrow(0);
   2.974 +   cout << setw(40) << "v2i_1 = m22i_1.getrow(0): " << v2i_1.to_string() << endl;
   2.975 +   v2i_1 = m22i_1.getrow(1);
   2.976 +   cout << setw(40) << "v2i_1 = m22i_1.getrow(1): " << v2i_1.to_string() << endl;
   2.977 +   v2i_1 = m22i_1.getcol(0);
   2.978 +   cout << setw(40) << "v2i_1 = m22i_1.getcol(0): " << v2i_1.to_string() << endl;
   2.979 +   v2i_1 = m22i_1.getcol(1);
   2.980 +   cout << setw(40) << "v2i_1 = m22i_1.getcol(1): " << v2i_1.to_string() << endl;
   2.981 +
   2.982 +   Matrix33f m33f_1(1.1f, 2.2f, 3.3f, 4.4f, 5.5f, 6.6f, 7.7f, 8.8f, 9.9f);
   2.983 +   Vector3f v3f_1(0);
   2.984 +
   2.985 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
   2.986 +   v3f_1 = m33f_1.getrow(0);
   2.987 +   cout << setw(40) << "v3f_1 = m33f_1.getrow(0): " << v3f_1.to_string() << endl;
   2.988 +   v3f_1 = m33f_1.getrow(1);
   2.989 +   cout << setw(40) << "v3f_1 = m33f_1.getrow(1): " << v3f_1.to_string() << endl;
   2.990 +   v3f_1 = m33f_1.getrow(2);
   2.991 +   cout << setw(40) << "v3f_1 = m33f_1.getrow(2): " << v3f_1.to_string() << endl;
   2.992 +   v3f_1 = m33f_1.getcol(0);
   2.993 +   cout << setw(40) << "v3f_1 = m33f_1.getcol(0): " << v3f_1.to_string() << endl;
   2.994 +   v3f_1 = m33f_1.getcol(1);
   2.995 +   cout << setw(40) << "v3f_1 = m33f_1.getcol(1): " << v3f_1.to_string() << endl;
   2.996 +   v3f_1 = m33f_1.getcol(2);
   2.997 +   cout << setw(40) << "v3f_1 = m33f_1.getcol(2): " << v3f_1.to_string() << endl;
   2.998 +
   2.999 +   Matrix44d m44d_1(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, 11.11,
  2.1000 +		    12.12, 13.13, 14.14, 15.15, 16.16);
  2.1001 +   Vector4d v4d_1(0);
  2.1002 +
  2.1003 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
  2.1004 +   v4d_1 = m44d_1.getrow(0);
  2.1005 +   cout << setw(40) << "v4d_1 = m44d_1.getrow(0): " << v4d_1.to_string() << endl;
  2.1006 +   v4d_1 = m44d_1.getrow(1);
  2.1007 +   cout << setw(40) << "v4d_1 = m44d_1.getrow(1): " << v4d_1.to_string() << endl;
  2.1008 +   v4d_1 = m44d_1.getrow(2);
  2.1009 +   cout << setw(40) << "v4d_1 = m44d_1.getrow(2): " << v4d_1.to_string() << endl;
  2.1010 +   v4d_1 = m44d_1.getrow(3);
  2.1011 +   cout << setw(40) << "v4d_1 = m44d_1.getrow(3): " << v4d_1.to_string() << endl;
  2.1012 +
  2.1013 +   v4d_1 = m44d_1.getcol(0);
  2.1014 +   cout << setw(40) << "v4d_1 = m44d_1.getcol(0): " << v4d_1.to_string() << endl;
  2.1015 +   v4d_1 = m44d_1.getcol(1);
  2.1016 +   cout << setw(40) << "v4d_1 = m44d_1.getcol(1): " << v4d_1.to_string() << endl;
  2.1017 +   v4d_1 = m44d_1.getcol(2);
  2.1018 +   cout << setw(40) << "v4d_1 = m44d_1.getcol(2): " << v4d_1.to_string() << endl;
  2.1019 +   v4d_1 = m44d_1.getcol(3);
  2.1020 +   cout << setw(40) << "v4d_1 = m44d_1.getcol(3): " << v4d_1.to_string() << endl;
  2.1021 +   }
  2.1022 +
  2.1023 +   {
  2.1024 +   cout << "===============================================================" << endl <<
  2.1025 +	 "Testing Matrix setrow() and setcol()" << endl;
  2.1026 +   Matrix22i m22i_1;
  2.1027 +   Vector2i v2i_1(2, 3);
  2.1028 +
  2.1029 +   m22i_1.setidentity();
  2.1030 +   cout << setw(40) << "m22i_1: " << m22i_1.to_string() << endl;
  2.1031 +   m22i_1.setrow(0, v2i_1);
  2.1032 +   cout << setw(40) << "m22i_1.setrow(0, v2i_1): " << m22i_1.to_string() << endl;
  2.1033 +
  2.1034 +   m22i_1.setidentity();
  2.1035 +   m22i_1.setrow(1, v2i_1);
  2.1036 +   cout << setw(40) << "m22i_1.setrow(1, v2i_1): " << m22i_1.to_string() << endl;
  2.1037 +
  2.1038 +   m22i_1.setidentity();
  2.1039 +   m22i_1.setrow(1, 4, 5);
  2.1040 +   cout << setw(40) << "m22i_1.setrow(1, 4, 5): " << m22i_1.to_string() << endl;
  2.1041 +
  2.1042 +   m22i_1.setidentity();
  2.1043 +   m22i_1.setcol(0, v2i_1);
  2.1044 +   cout << setw(40) << "m22i_1.setcol(0, v2i_1): " << m22i_1.to_string() << endl;
  2.1045 +
  2.1046 +   m22i_1.setidentity();
  2.1047 +   m22i_1.setcol(1, v2i_1);
  2.1048 +   cout << setw(40) << "m22i_1.setcol(1, v2i_1): " << m22i_1.to_string() << endl;
  2.1049 +
  2.1050 +   m22i_1.setidentity();
  2.1051 +   m22i_1.setcol(1, 4, 5);
  2.1052 +   cout << setw(40) << "m22i_1.setcol(1, 4, 5): " << m22i_1.to_string() << endl;
  2.1053 +
  2.1054 +   Matrix33f m33f_1;
  2.1055 +   Vector3f v3f_1(0);
  2.1056 +
  2.1057 +   m33f_1.setidentity();
  2.1058 +   cout << setw(40) << "m33f_1: " << m33f_1.to_string() << endl;
  2.1059 +   m33f_1.setrow(0, v3f_1);
  2.1060 +   cout << setw(40) << "m33f_1.setrow(0, v3f_1): " << m33f_1.to_string() << endl;
  2.1061 +
  2.1062 +   m33f_1.setidentity();
  2.1063 +   m33f_1.setrow(1, v3f_1);
  2.1064 +   cout << setw(40) << "m33f_1.setrow(1, v3f_1): " << m33f_1.to_string() << endl;
  2.1065 +
  2.1066 +   m33f_1.setidentity();
  2.1067 +   m33f_1.setrow(1, 2.2f, 3.3f, 4.4f);
  2.1068 +   cout << setw(40) << "m33f_1.setrow(1, 2.2f, 3.3f, 4.4f): " 
  2.1069 +	<< m33f_1.to_string() << endl;
  2.1070 +
  2.1071 +   m33f_1.setidentity();
  2.1072 +   m33f_1.setcol(0, v3f_1);
  2.1073 +   cout << setw(40) << "m33f_1.setcol(0, v3f_1): " << m33f_1.to_string() << endl;
  2.1074 +
  2.1075 +   m33f_1.setidentity();
  2.1076 +   m33f_1.setcol(1, v3f_1);
  2.1077 +   cout << setw(40) << "m33f_1.setcol(1, v3f_1): " << m33f_1.to_string() << endl;
  2.1078 +
  2.1079 +   m33f_1.setidentity();
  2.1080 +   m33f_1.setcol(1, 2.2f, 3.3f, 4.4f);
  2.1081 +   cout << setw(40) << "m33f_1.setcol(1, 2.2f, 3.3f, 4.4f: " 
  2.1082 +	<< m33f_1.to_string() << endl;
  2.1083 +
  2.1084 +   Matrix44d m44d_1;
  2.1085 +   Vector4d v4d_1(0);
  2.1086 +
  2.1087 +   m44d_1.setidentity();
  2.1088 +   cout << setw(40) << "m44d_1: " << m44d_1.to_string() << endl;
  2.1089 +   m44d_1.setrow(0, v4d_1);
  2.1090 +   cout << setw(40) << "m44d_1.setrow(0, v4d_1): " << m44d_1.to_string() << endl;
  2.1091 +
  2.1092 +   m44d_1.setidentity();
  2.1093 +   m44d_1.setrow(1, v4d_1);
  2.1094 +   cout << setw(40) << "m44d_1.setrow(1, v4d_1): " << m44d_1.to_string() << endl;
  2.1095 +
  2.1096 +   m44d_1.setidentity();
  2.1097 +   m44d_1.setrow(1, 2.2, 3.3, 4.4, 5.5);
  2.1098 +   cout << setw(40) << "m44d_1.setrow(1, 2.2, 3.3, 4.4, 5.5): " 
  2.1099 +	<< m44d_1.to_string() << endl;
  2.1100 +
  2.1101 +   m44d_1.setidentity();
  2.1102 +   m44d_1.setcol(0, v4d_1);
  2.1103 +   cout << setw(40) << "m44d_1.setcol(0, v4d_1): " << m44d_1.to_string() << endl;
  2.1104 +
  2.1105 +   m44d_1.setidentity();
  2.1106 +   m44d_1.setcol(1, v4d_1);
  2.1107 +   cout << setw(40) << "m44d_1.setcol(1, v4d_1): " << m44d_1.to_string() << endl;
  2.1108 +
  2.1109 +   m44d_1.setidentity();
  2.1110 +   m44d_1.setcol(1, 2.2, 3.3, 4.4, 5.5);
  2.1111 +   cout << setw(40) << "m44d_1.setcol(1, 2.2, 3.3, 4.4, 5.5: " 
  2.1112 +	<< m44d_1.to_string() << endl;
  2.1113 +   }
  2.1114 +   }
  2.1115 +
  2.1116 +////////////////////////////////////////////////////////////////////////////////
  2.1117 +void test_all(void)
  2.1118 +   {
  2.1119 +   test_vector();
  2.1120 +   test_matrix();
  2.1121 +   }
  2.1122 +
  2.1123 +////////////////////////////////////////////////////////////////////////////////
  2.1124 +void show_menu(void)
  2.1125 +   {
  2.1126 +   cout << endl << endl
  2.1127 +	<< "Test what?" << endl
  2.1128 +	<< "0)      All" << endl << endl
  2.1129 +	<< "1)      Vector" << endl
  2.1130 +	<< "2)      Matrix" << endl
  2.1131 +	<< endl
  2.1132 +	<< "99      Quit" << endl;
  2.1133 +   }
  2.1134 +
  2.1135 +////////////////////////////////////////////////////////////////////////////////
  2.1136 +int main (int argc, char * argv[]) 
  2.1137 +   {
  2.1138 +   int retval = 0;
  2.1139 +
  2.1140 +   test_all();
  2.1141 +   return 0;
  2.1142 +
  2.1143 +   try
  2.1144 +      {
  2.1145 +      int choice = -1;
  2.1146 +      
  2.1147 +      while (choice != 99)
  2.1148 +	 {
  2.1149 +	 show_menu();
  2.1150 +	 cin >> choice;
  2.1151 +	 if(!cin)
  2.1152 +	    {
  2.1153 +	    cin.clear();
  2.1154 +	    cin.ignore(std::numeric_limits<std::streamsize>::max(),'\n');
  2.1155 +	    }
  2.1156 +	 if (choice != 99)
  2.1157 +	    {
  2.1158 +	    switch (choice)
  2.1159 +	       {
  2.1160 +	       case 0:
  2.1161 +		  test_all();
  2.1162 +		  break;
  2.1163 +	       case 1:
  2.1164 +		  test_vector();
  2.1165 +		  break;
  2.1166 +	       case 2:
  2.1167 +		  test_matrix();
  2.1168 +		  break;
  2.1169 +	       default:
  2.1170 +		  cout << "Unrecognized choice.  Please try again." << endl;
  2.1171 +	       }
  2.1172 +	    choice = -1;
  2.1173 +	    }
  2.1174 +	 }
  2.1175 +      }
  2.1176 +   catch (const std::exception & error)
  2.1177 +      {
  2.1178 +      string e = "Caught exception: ";
  2.1179 +      e += error.what();
  2.1180 +      cerr << e << endl;
  2.1181 +      retval = 1;
  2.1182 +      }
  2.1183 +
  2.1184 +   return retval;;
  2.1185 +
  2.1186 +   }
  2.1187 +
  2.1188 +#endif