openMSX
Functions
gl_vec_Test.cc File Reference
#include "gl_vec.hh"
#include <cassert>
#include <iostream>
Include dependency graph for gl_vec_Test.cc:

Go to the source code of this file.

Functions

template<int N, typename T >
void print (const vecN< N, T > &x)
 
template<typename T >
bool approxEq (T x, T y)
 
template<int N, typename T >
bool approxEq (const vecN< N, T > &x, const vecN< N, T > &y)
 
int main ()
 
void test_constr (vec4 &z)
 
void test_constr (float x, vec4 &z)
 
void test_constr (float a, float b, float c, float d, vec4 &z)
 
void test_change0 (float x, vec4 &z)
 
void test_change2 (float x, vec4 &z)
 
void test_extract0 (const vec4 &x, float &z)
 
void test_extract2 (const vec4 &x, float &z)
 
bool test_equal (const vec4 &x, const vec4 &y)
 
bool test_not_equal (const vec4 &x, const vec4 &y)
 
void test_add (const vec4 &x, const vec4 &y, vec4 &z)
 
void test_add (vec4 &x, const vec4 &y)
 
void test_negate (const vec4 &x, vec4 &y)
 
void test_mul (const vec4 &x, const vec4 &y, vec4 &z)
 
void test_mul (float x, const vec4 &y, vec4 &z)
 
void test_div (const vec4 &x, const vec4 &y, vec4 &z)
 
void test_div (float x, const vec4 &y, vec4 &z)
 
void test_div (const vec4 &x, float y, vec4 &z)
 
void test_sum (const vec4 &x, float &y)
 
void test_sum_broadcast (const vec4 &x, vec4 &y)
 
void test_dot (const vec4 &x, const vec4 &y, float &z)
 
void test_dot_broadcast (const vec4 &x, const vec4 &y, vec4 &z)
 
void test_length2 (const vec4 &x, float &y)
 
void test_length (const vec4 &x, float &y)
 
void test_normalize (const vec4 &x, vec4 &y)
 
void test_recip (const vec4 &x, vec4 &y)
 
void test_constr (vec3 &z)
 
void test_constr (float x, vec3 &z)
 
void test_constr (float a, float b, float c, vec3 &z)
 
void test_constr (vec4 x, vec3 &y)
 
void test_change0 (float x, vec3 &z)
 
void test_change2 (float x, vec3 &z)
 
void test_extract0 (const vec3 &x, float &z)
 
void test_extract2 (const vec3 &x, float &z)
 
bool test_equal (const vec3 &x, const vec3 &y)
 
bool test_not_equal (const vec3 &x, const vec3 &y)
 
void test_add (const vec3 &x, const vec3 &y, vec3 &z)
 
void test_add (vec3 &x, const vec3 &y)
 
void test_negate (const vec3 &x, vec3 &y)
 
void test_mul (const vec3 &x, const vec3 &y, vec3 &z)
 
void test_mul (float x, const vec3 &y, vec3 &z)
 
void test_div (const vec3 &x, const vec3 &y, vec3 &z)
 
void test_div (float x, const vec3 &y, vec3 &z)
 
void test_div (const vec3 &x, float y, vec3 &z)
 
void test_min (const vec3 &x, const vec3 &y, vec3 &z)
 
void test_min (const vec4 &x, const vec4 &y, vec4 &z)
 
void test_clamp (const vec3 &x, const vec3 &y, const vec3 &z, vec3 &w)
 
void test_clamp (const vec4 &x, const vec4 &y, const vec4 &z, vec4 &w)
 
void test_clamp (const vec3 &x, float y, float z, vec3 &w)
 
void test_clamp (const vec4 &x, float y, float z, vec4 &w)
 
void test_clamp (const vec4 &x, vec4 &y)
 
void test_sum (const vec3 &x, float &y)
 
void test_dot (const vec3 &x, const vec3 &y, float &z)
 
void test_length2 (const vec3 &x, float &y)
 
void test_length (const vec3 &x, float &y)
 
void test_normalize (const vec3 &x, vec3 &y)
 
void test_round (const vec4 &x, ivec4 &y)
 
void test_trunc (const vec4 &x, ivec4 &y)
 

Function Documentation

◆ approxEq() [1/2]

template<typename T >
bool approxEq ( x,
y 
)

Definition at line 18 of file gl_vec_Test.cc.

Referenced by main().

◆ approxEq() [2/2]

template<int N, typename T >
bool approxEq ( const vecN< N, T > &  x,
const vecN< N, T > &  y 
)

Definition at line 23 of file gl_vec_Test.cc.

◆ main()

int main ( )

◆ print()

template<int N, typename T >
void print ( const vecN< N, T > &  x)

Definition at line 8 of file gl_vec_Test.cc.

◆ test_add() [1/4]

void test_add ( const vec4 x,
const vec4 y,
vec4 z 
)

Definition at line 506 of file gl_vec_Test.cc.

◆ test_add() [2/4]

void test_add ( vec4 x,
const vec4 y 
)

Definition at line 510 of file gl_vec_Test.cc.

◆ test_add() [3/4]

void test_add ( const vec3 x,
const vec3 y,
vec3 z 
)

Definition at line 625 of file gl_vec_Test.cc.

◆ test_add() [4/4]

void test_add ( vec3 x,
const vec3 y 
)

Definition at line 629 of file gl_vec_Test.cc.

◆ test_change0() [1/2]

void test_change0 ( float  x,
vec4 z 
)

Definition at line 479 of file gl_vec_Test.cc.

◆ test_change0() [2/2]

void test_change0 ( float  x,
vec3 z 
)

Definition at line 598 of file gl_vec_Test.cc.

◆ test_change2() [1/2]

void test_change2 ( float  x,
vec4 z 
)

Definition at line 483 of file gl_vec_Test.cc.

◆ test_change2() [2/2]

void test_change2 ( float  x,
vec3 z 
)

Definition at line 602 of file gl_vec_Test.cc.

◆ test_clamp() [1/5]

void test_clamp ( const vec3 x,
const vec3 y,
const vec3 z,
vec3 w 
)

Definition at line 671 of file gl_vec_Test.cc.

◆ test_clamp() [2/5]

void test_clamp ( const vec4 x,
const vec4 y,
const vec4 z,
vec4 w 
)

Definition at line 676 of file gl_vec_Test.cc.

◆ test_clamp() [3/5]

void test_clamp ( const vec3 x,
float  y,
float  z,
vec3 w 
)

Definition at line 681 of file gl_vec_Test.cc.

◆ test_clamp() [4/5]

void test_clamp ( const vec4 x,
float  y,
float  z,
vec4 w 
)

Definition at line 686 of file gl_vec_Test.cc.

◆ test_clamp() [5/5]

void test_clamp ( const vec4 x,
vec4 y 
)

Definition at line 691 of file gl_vec_Test.cc.

◆ test_constr() [1/7]

void test_constr ( vec4 z)

Definition at line 466 of file gl_vec_Test.cc.

◆ test_constr() [2/7]

void test_constr ( float  x,
vec4 z 
)

Definition at line 470 of file gl_vec_Test.cc.

◆ test_constr() [3/7]

void test_constr ( float  a,
float  b,
float  c,
float  d,
vec4 z 
)

Definition at line 474 of file gl_vec_Test.cc.

◆ test_constr() [4/7]

void test_constr ( vec3 z)

Definition at line 581 of file gl_vec_Test.cc.

◆ test_constr() [5/7]

void test_constr ( float  x,
vec3 z 
)

Definition at line 585 of file gl_vec_Test.cc.

◆ test_constr() [6/7]

void test_constr ( float  a,
float  b,
float  c,
vec3 z 
)

Definition at line 589 of file gl_vec_Test.cc.

◆ test_constr() [7/7]

void test_constr ( vec4  x,
vec3 y 
)

Definition at line 593 of file gl_vec_Test.cc.

◆ test_div() [1/6]

void test_div ( const vec4 x,
const vec4 y,
vec4 z 
)

Definition at line 529 of file gl_vec_Test.cc.

◆ test_div() [2/6]

void test_div ( float  x,
const vec4 y,
vec4 z 
)

Definition at line 533 of file gl_vec_Test.cc.

◆ test_div() [3/6]

void test_div ( const vec4 x,
float  y,
vec4 z 
)

Definition at line 537 of file gl_vec_Test.cc.

◆ test_div() [4/6]

void test_div ( const vec3 x,
const vec3 y,
vec3 z 
)

Definition at line 648 of file gl_vec_Test.cc.

◆ test_div() [5/6]

void test_div ( float  x,
const vec3 y,
vec3 z 
)

Definition at line 652 of file gl_vec_Test.cc.

◆ test_div() [6/6]

void test_div ( const vec3 x,
float  y,
vec3 z 
)

Definition at line 656 of file gl_vec_Test.cc.

◆ test_dot() [1/2]

void test_dot ( const vec4 x,
const vec4 y,
float &  z 
)

Definition at line 551 of file gl_vec_Test.cc.

◆ test_dot() [2/2]

void test_dot ( const vec3 x,
const vec3 y,
float &  z 
)

Definition at line 701 of file gl_vec_Test.cc.

◆ test_dot_broadcast()

void test_dot_broadcast ( const vec4 x,
const vec4 y,
vec4 z 
)

Definition at line 555 of file gl_vec_Test.cc.

◆ test_equal() [1/2]

bool test_equal ( const vec4 x,
const vec4 y 
)

Definition at line 497 of file gl_vec_Test.cc.

◆ test_equal() [2/2]

bool test_equal ( const vec3 x,
const vec3 y 
)

Definition at line 616 of file gl_vec_Test.cc.

◆ test_extract0() [1/2]

void test_extract0 ( const vec4 x,
float &  z 
)

Definition at line 488 of file gl_vec_Test.cc.

◆ test_extract0() [2/2]

void test_extract0 ( const vec3 x,
float &  z 
)

Definition at line 607 of file gl_vec_Test.cc.

◆ test_extract2() [1/2]

void test_extract2 ( const vec4 x,
float &  z 
)

Definition at line 492 of file gl_vec_Test.cc.

◆ test_extract2() [2/2]

void test_extract2 ( const vec3 x,
float &  z 
)

Definition at line 611 of file gl_vec_Test.cc.

◆ test_length() [1/2]

void test_length ( const vec4 x,
float &  y 
)

Definition at line 565 of file gl_vec_Test.cc.

◆ test_length() [2/2]

void test_length ( const vec3 x,
float &  y 
)

Definition at line 711 of file gl_vec_Test.cc.

◆ test_length2() [1/2]

void test_length2 ( const vec4 x,
float &  y 
)

Definition at line 560 of file gl_vec_Test.cc.

◆ test_length2() [2/2]

void test_length2 ( const vec3 x,
float &  y 
)

Definition at line 706 of file gl_vec_Test.cc.

◆ test_min() [1/2]

void test_min ( const vec3 x,
const vec3 y,
vec3 z 
)

Definition at line 661 of file gl_vec_Test.cc.

◆ test_min() [2/2]

void test_min ( const vec4 x,
const vec4 y,
vec4 z 
)

Definition at line 666 of file gl_vec_Test.cc.

◆ test_mul() [1/4]

void test_mul ( const vec4 x,
const vec4 y,
vec4 z 
)

Definition at line 520 of file gl_vec_Test.cc.

◆ test_mul() [2/4]

void test_mul ( float  x,
const vec4 y,
vec4 z 
)

Definition at line 524 of file gl_vec_Test.cc.

◆ test_mul() [3/4]

void test_mul ( const vec3 x,
const vec3 y,
vec3 z 
)

Definition at line 639 of file gl_vec_Test.cc.

◆ test_mul() [4/4]

void test_mul ( float  x,
const vec3 y,
vec3 z 
)

Definition at line 643 of file gl_vec_Test.cc.

◆ test_negate() [1/2]

void test_negate ( const vec4 x,
vec4 y 
)

Definition at line 515 of file gl_vec_Test.cc.

◆ test_negate() [2/2]

void test_negate ( const vec3 x,
vec3 y 
)

Definition at line 634 of file gl_vec_Test.cc.

◆ test_normalize() [1/2]

void test_normalize ( const vec4 x,
vec4 y 
)

Definition at line 570 of file gl_vec_Test.cc.

◆ test_normalize() [2/2]

void test_normalize ( const vec3 x,
vec3 y 
)

Definition at line 716 of file gl_vec_Test.cc.

◆ test_not_equal() [1/2]

bool test_not_equal ( const vec4 x,
const vec4 y 
)

Definition at line 501 of file gl_vec_Test.cc.

◆ test_not_equal() [2/2]

bool test_not_equal ( const vec3 x,
const vec3 y 
)

Definition at line 620 of file gl_vec_Test.cc.

◆ test_recip()

void test_recip ( const vec4 x,
vec4 y 
)

Definition at line 575 of file gl_vec_Test.cc.

◆ test_round()

void test_round ( const vec4 x,
ivec4 y 
)

Definition at line 721 of file gl_vec_Test.cc.

◆ test_sum() [1/2]

void test_sum ( const vec4 x,
float &  y 
)

Definition at line 542 of file gl_vec_Test.cc.

◆ test_sum() [2/2]

void test_sum ( const vec3 x,
float &  y 
)

Definition at line 696 of file gl_vec_Test.cc.

◆ test_sum_broadcast()

void test_sum_broadcast ( const vec4 x,
vec4 y 
)

Definition at line 546 of file gl_vec_Test.cc.

◆ test_trunc()

void test_trunc ( const vec4 x,
ivec4 y 
)

Definition at line 725 of file gl_vec_Test.cc.