Updated random tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
glmCreateTestGTC(gtx_bit)
|
||||
glmCreateTestGTC(gtx_noise)
|
||||
glmCreateTestGTC(gtx_quaternion)
|
||||
glmCreateTestGTC(gtx_random)
|
||||
glmCreateTestGTC(gtx_rotate_vector)
|
||||
glmCreateTestGTC(gtx_simd_vec4)
|
||||
glmCreateTestGTC(gtx_simd_mat4)
|
||||
|
||||
@@ -11,17 +11,40 @@
|
||||
#include <glm/gtx/noise.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
int test_simplex()
|
||||
{
|
||||
float ValueSNoise2D = glm::simplex(glm::vec2(0.5f));
|
||||
float ValueSNoise3D = glm::simplex(glm::vec3(0.5f));
|
||||
float ValueSNoise4D = glm::simplex(glm::vec4(0.5f));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_perlin()
|
||||
{
|
||||
float ValueCNoise2D = glm::perlin(glm::vec2(0.5f));
|
||||
float ValueCNoise3D = glm::perlin(glm::vec3(0.5f));
|
||||
float ValueCNoise4D = glm::perlin(glm::vec4(0.5f));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_perlin_pedioric()
|
||||
{
|
||||
float ValuePNoise2D = glm::perlin(glm::vec2(0.5f), glm::vec2(0.5f));
|
||||
float ValuePNoise3D = glm::perlin(glm::vec3(0.5f), glm::vec3(0.5f));
|
||||
float ValuePNoise4D = glm::perlin(glm::vec4(0.5f), glm::vec4(0.5f));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_simplex();
|
||||
Error += test_perlin();
|
||||
Error += test_perlin_pedioric();
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
42
test/gtx/gtx_random.cpp
Normal file
42
test/gtx/gtx_random.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2011-05-31
|
||||
// Updated : 2011-05-31
|
||||
// Licence : This source is under MIT licence
|
||||
// File : test/gtx/random.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtx/random.hpp>
|
||||
#include <glm/gtx/epsilon.hpp>
|
||||
#include <iostream>
|
||||
|
||||
int test_signedRand1()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
{
|
||||
float ResultFloat = 0.0f;
|
||||
double ResultDouble = 0.0f;
|
||||
for(std::size_t i = 0; i < 100000; ++i)
|
||||
{
|
||||
ResultFloat += glm::signedRand1<float>();
|
||||
ResultDouble += glm::signedRand1<double>();
|
||||
}
|
||||
|
||||
Error += glm::equalEpsilon(ResultFloat, 0.0f, 0.0001f);
|
||||
Error += glm::equalEpsilon(ResultDouble, 0.0, 0.0001);
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
Error += test_signedRand1();
|
||||
|
||||
return Error;
|
||||
}
|
||||
Reference in New Issue
Block a user