--- a/tests/vector.cc Thu Apr 24 18:12:32 2008 +0200
+++ b/tests/vector.cc Sun Apr 27 09:44:49 2008 +0200
@@ -1,12 +1,15 @@
+#include <xmmintrin.h>
#include "vector.h"
int main() {
+ {
+ /* Vector3 */
Vector3 a(1, 2, 3);
cout << "=== Vector3 test ===" << endl;
cout << "a = " << a << endl;
Vector3 b(2, 3, 2);
cout << "b = " << b << endl;
-
+
cout << "a + b = " << a + b << endl;
cout << "b - a = " << b - a << endl;
cout << "dot(a,b) = " << dot(a,b) << endl;
@@ -16,8 +19,28 @@
cout << "-a = " << -a << endl;
cout << "a.mag() = " << a.mag() << endl;
- cout << "a.unit() = " << a.unit() << endl;
- cout << "a.unit().mag() = " << a.unit().mag() << endl;
+ cout << "normalize(a) = " << normalize(a) << endl;
+ cout << "normalize(a).mag() = " << normalize(a).mag() << endl;
+ }
+
+ {
+ /* VectorPacket */
+ VectorPacket a(_mm_set_ps(4,3,2,1), _mm_set_ps(8,7,6,5), _mm_set_ps(12,11,10,9));
+ VectorPacket b(_mm_set_ps(41,31,21,11), _mm_set_ps(42,32,22,12), _mm_set_ps(43,33,23,13));
+ cout << "=== VectorPacket test ===" << endl;
+ cout << "a = " << a << endl;
+ cout << "b = " << b << endl;
+
+ cout << "a + b = " << a + b << endl;
+ cout << "b - a = " << b - a << endl;
+/* cout << "dot(a,b) = " << dot(a,b) << endl;
+ cout << "cross(a,b) = " << cross(a,b) << endl;
+ cout << "a * 2 = " << a * 2 << endl;
+ cout << "3 * b = " << 3 * b << endl;
+ cout << "-a = " << -a << endl;
+
+ cout << "normalize(a) = " << normalize(a) << endl;*/
+ }
return 0;
}