Vec3DUnitTest.cpp File Reference
#include <Math/Vector.h>
#include <Math/Helpers.h>
#include "Logger.h"

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
10 {
11  logger(INFO,"Checks several Vec3D unit operations");
12  Vec3D a = {1,2,3};
13  Vec3D b = {4,5,6};
14  Vec3D c;
15 
16  c = b - a; //same as c = b.operator-(a);
17  helpers::check(c,{3,3,3},0,"Vector subtraction");
18 
19  c = - a; //same as c = operator-(a);
20  helpers::check(c,{-1,-2,-3},0,"Negation of a vector");
21 
22  c -= a; //same as c.operator-=(a);
23  helpers::check(c,{-2,-4,-6},0,"Vector self-subtraction");
24 
25  c = b + a; //same as c = b.operator-(a);
26  helpers::check(c,{5,7,9},0,"Vector addition");
27 
28  c = a; //same as c = operator+(a); //missing operator
29  //helpers::check(c,{1,2,3},0,"Plus-operation of a vector");
30 
31  c += a; //same as c.operator-=(a);
32  helpers::check(c,{2,4,6},0,"Vector self-addition");
33 
34  helpers::check(Vec3D::dot(a,b),32,0,"Dot product");
35 
36  helpers::check(Vec3D::cross(a,b),{-3,6,-3},0,"Cross product");
37 
38  return 0;
39 }
Logger< MERCURYDPM_LOGLEVEL > logger("MercuryKernel")
Definition of different loggers with certain modules. A user can define its own custom logger here.
Scalar * b
Definition: benchVecAdd.cpp:17
Definition: Kernel/Math/Vector.h:30
static Vec3D cross(const Vec3D &a, const Vec3D &b)
Calculates the cross product of two Vec3D: .
Definition: Vector.cc:143
static Mdouble dot(const Vec3D &a, const Vec3D &b)
Calculates the dot product of two Vec3D: .
Definition: Vector.cc:56
const Scalar * a
Definition: level2_cplx_impl.h:32
#define INFO(i)
Definition: mumps_solver.h:54
int c
Definition: calibrate.py:100
void check(double real, double ideal, double error, std::string errorMessage)
Definition: TestHelpers.cc:16

References a, b, calibrate::c, helpers::check(), Vec3D::cross(), Vec3D::dot(), INFO, and logger.