Fixed tests and mat type typedefs

This commit is contained in:
Christophe Riccio 2013-04-17 12:26:34 +02:00
parent abbb0fc7cb
commit 54e9d54579
4 changed files with 229 additions and 27 deletions

View File

@ -3055,15 +3055,15 @@ namespace glm
/// Default double-precision floating-point 2x2 matrix.
/// @see gtc_type_precision
typedef f32mat2x2 f64mat2;
typedef f64mat2x2 f64mat2;
/// Default double-precision floating-point 3x3 matrix.
/// @see gtc_type_precision
typedef f32mat3x3 f64mat3;
typedef f64mat3x3 f64mat3;
/// Default double-precision floating-point 4x4 matrix.
/// @see gtc_type_precision
typedef f32mat4x4 f64mat4;
typedef f64mat4x4 f64mat4;
/// Default double-precision floating-point quaternion.
/// @see gtc_type_precision

View File

@ -170,10 +170,14 @@ int test_vec3_size()
{
int Error = 0;
Error += sizeof(glm::vec3) == sizeof(glm::lowp_vec3) ? 0 : 1;
Error += sizeof(glm::vec3) == sizeof(glm::mediump_vec3) ? 0 : 1;
Error += sizeof(glm::vec3) == sizeof(glm::highp_vec3) ? 0 : 1;
Error += 12 == sizeof(glm::mediump_vec3) ? 0 : 1;
Error += sizeof(glm::dvec3) == sizeof(glm::highp_vec3) ? 0 : 1;
Error += 24 == sizeof(glm::highp_vec3) ? 0 : 1;
Error += sizeof(glm::dvec3) == sizeof(glm::lowp_dvec3) ? 0 : 1;
Error += sizeof(glm::dvec3) == sizeof(glm::mediump_dvec3) ? 0 : 1;
Error += sizeof(glm::dvec3) == sizeof(glm::highp_dvec3) ? 0 : 1;
Error += 24 == sizeof(glm::highp_dvec3) ? 0 : 1;
Error += glm::vec3().length() == 3 ? 0 : 1;
Error += glm::dvec3().length() == 3 ? 0 : 1;
@ -352,14 +356,12 @@ int test_vec3_swizzle_functions()
{
int Error = 0;
//
// NOTE: template functions cannot pick up the implicit conversion from
// a swizzle to the unswizzled type, therefore the operator() must be
// used. E.g.:
//
// glm::dot(u.xy, v.xy); <--- Compile error
// glm::dot(u.xy(), v.xy()); <--- Compiles correctly
//
#if(GLM_SUPPORT_SWIZZLE_OPERATOR())
float r;
@ -433,7 +435,5 @@ int main()
Error += test_vec3_swizzle_operators();
Error += test_vec3_swizzle_functions();
printf("Errors: %d\n", Error);
return Error;
}

View File

@ -204,10 +204,14 @@ int test_vec4_size()
{
int Error = 0;
Error += sizeof(glm::vec4) == sizeof(glm::lowp_vec4) ? 0 : 1;
Error += sizeof(glm::vec4) == sizeof(glm::mediump_vec4) ? 0 : 1;
Error += sizeof(glm::vec4) == sizeof(glm::highp_vec4) ? 0 : 1;
Error += 16 == sizeof(glm::mediump_vec4) ? 0 : 1;
Error += sizeof(glm::dvec4) == sizeof(glm::highp_vec4) ? 0 : 1;
Error += 32 == sizeof(glm::highp_vec4) ? 0 : 1;
Error += sizeof(glm::dvec4) == sizeof(glm::lowp_dvec4) ? 0 : 1;
Error += sizeof(glm::dvec4) == sizeof(glm::mediump_dvec4) ? 0 : 1;
Error += sizeof(glm::dvec4) == sizeof(glm::highp_dvec4) ? 0 : 1;
Error += 32 == sizeof(glm::highp_dvec4) ? 0 : 1;
Error += glm::vec4().length() == 4 ? 0 : 1;
Error += glm::dvec4().length() == 4 ? 0 : 1;

View File

@ -290,6 +290,105 @@ static int test_ivec_precision()
{
int Error(0);
{
glm::i8vec2 v1;
glm::lowp_i8vec2 v2(v1);
glm::mediump_i8vec2 v3(v1);
glm::highp_i8vec2 v4(v1);
Error += glm::all(glm::equal(v1, glm::i8vec2(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i8vec2(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i8vec2(v4))) ? 0 : 1;
}
{
glm::i8vec3 v1;
glm::lowp_i8vec3 v2(v1);
glm::mediump_i8vec3 v3(v1);
glm::highp_i8vec3 v4(v1);
Error += glm::all(glm::equal(v1, glm::i8vec3(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i8vec3(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i8vec3(v4))) ? 0 : 1;
}
{
glm::i8vec4 v1;
glm::lowp_i8vec4 v2(v1);
glm::mediump_i8vec4 v3(v1);
glm::highp_i8vec4 v4(v1);
Error += glm::all(glm::equal(v1, glm::i8vec4(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i8vec4(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i8vec4(v4))) ? 0 : 1;
}
{
glm::i16vec2 v1;
glm::lowp_i16vec2 v2(v1);
glm::mediump_i16vec2 v3(v1);
glm::highp_i16vec2 v4(v1);
Error += glm::all(glm::equal(v1, glm::i16vec2(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i16vec2(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i16vec2(v4))) ? 0 : 1;
}
{
glm::i16vec3 v1;
glm::lowp_i16vec3 v2(v1);
glm::mediump_i16vec3 v3(v1);
glm::highp_i16vec3 v4(v1);
Error += glm::all(glm::equal(v1, glm::i16vec3(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i16vec3(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i16vec3(v4))) ? 0 : 1;
}
{
glm::i16vec4 v1;
glm::lowp_i16vec4 v2(v1);
glm::mediump_i16vec4 v3(v1);
glm::highp_i16vec4 v4(v1);
Error += glm::all(glm::equal(v1, glm::i16vec4(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i16vec4(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i16vec4(v4))) ? 0 : 1;
}
{
glm::i32vec2 v1;
glm::lowp_i32vec2 v2(v1);
glm::mediump_i32vec2 v3(v1);
glm::highp_i32vec2 v4(v1);
Error += glm::all(glm::equal(v1, glm::i32vec2(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i32vec2(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i32vec2(v4))) ? 0 : 1;
}
{
glm::i32vec3 v1;
glm::lowp_i32vec3 v2(v1);
glm::mediump_i32vec3 v3(v1);
glm::highp_i32vec3 v4(v1);
Error += glm::all(glm::equal(v1, glm::i32vec3(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i32vec3(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i32vec3(v4))) ? 0 : 1;
}
{
glm::i32vec4 v1;
glm::lowp_i32vec4 v2(v1);
glm::mediump_i32vec4 v3(v1);
glm::highp_i32vec4 v4(v1);
Error += glm::all(glm::equal(v1, glm::i32vec4(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i32vec4(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::i32vec4(v4))) ? 0 : 1;
}
{
glm::i64vec2 v1;
glm::lowp_i64vec2 v2(v1);
@ -387,6 +486,105 @@ static int test_uvec_precision()
{
int Error(0);
{
glm::u8vec2 v1;
glm::lowp_u8vec2 v2(v1);
glm::mediump_u8vec2 v3(v1);
glm::highp_u8vec2 v4(v1);
Error += glm::all(glm::equal(v1, glm::u8vec2(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u8vec2(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u8vec2(v4))) ? 0 : 1;
}
{
glm::u8vec3 v1;
glm::lowp_u8vec3 v2(v1);
glm::mediump_u8vec3 v3(v1);
glm::highp_u8vec3 v4(v1);
Error += glm::all(glm::equal(v1, glm::u8vec3(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u8vec3(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u8vec3(v4))) ? 0 : 1;
}
{
glm::u8vec4 v1;
glm::lowp_u8vec4 v2(v1);
glm::mediump_u8vec4 v3(v1);
glm::highp_u8vec4 v4(v1);
Error += glm::all(glm::equal(v1, glm::u8vec4(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u8vec4(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u8vec4(v4))) ? 0 : 1;
}
{
glm::u16vec2 v1;
glm::lowp_u16vec2 v2(v1);
glm::mediump_u16vec2 v3(v1);
glm::highp_u16vec2 v4(v1);
Error += glm::all(glm::equal(v1, glm::u16vec2(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u16vec2(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u16vec2(v4))) ? 0 : 1;
}
{
glm::u16vec3 v1;
glm::lowp_u16vec3 v2(v1);
glm::mediump_u16vec3 v3(v1);
glm::highp_u16vec3 v4(v1);
Error += glm::all(glm::equal(v1, glm::u16vec3(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u16vec3(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u16vec3(v4))) ? 0 : 1;
}
{
glm::u16vec4 v1;
glm::lowp_u16vec4 v2(v1);
glm::mediump_u16vec4 v3(v1);
glm::highp_u16vec4 v4(v1);
Error += glm::all(glm::equal(v1, glm::u16vec4(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u16vec4(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u16vec4(v4))) ? 0 : 1;
}
{
glm::u32vec2 v1;
glm::lowp_u32vec2 v2(v1);
glm::mediump_u32vec2 v3(v1);
glm::highp_u32vec2 v4(v1);
Error += glm::all(glm::equal(v1, glm::u32vec2(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u32vec2(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u32vec2(v4))) ? 0 : 1;
}
{
glm::u32vec3 v1;
glm::lowp_u32vec3 v2(v1);
glm::mediump_u32vec3 v3(v1);
glm::highp_u32vec3 v4(v1);
Error += glm::all(glm::equal(v1, glm::u32vec3(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u32vec3(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u32vec3(v4))) ? 0 : 1;
}
{
glm::u32vec4 v1;
glm::lowp_u32vec4 v2(v1);
glm::mediump_u32vec4 v3(v1);
glm::highp_u32vec4 v4(v1);
Error += glm::all(glm::equal(v1, glm::u32vec4(v2))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u32vec4(v3))) ? 0 : 1;
Error += glm::all(glm::equal(v1, glm::u32vec4(v4))) ? 0 : 1;
}
{
glm::u64vec2 v1;
glm::lowp_u64vec2 v2(v1);