fix tests on windows (msvc)

This commit is contained in:
Recep Aslantas
2020-01-17 23:29:36 +03:00
parent 9af0ebd142
commit cf8dc82783
4 changed files with 6 additions and 11 deletions

View File

@@ -25,6 +25,8 @@ main(int argc, const char * argv[]) {
fprintf(stderr, CYAN "\nWelcome to cglm tests\n\n" RESET); fprintf(stderr, CYAN "\nWelcome to cglm tests\n\n" RESET);
srand((unsigned int)time(NULL));
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
int32_t len; int32_t len;

View File

@@ -9,8 +9,6 @@
void void
test_rand_mat4(mat4 dest) { test_rand_mat4(mat4 dest) {
glm_mat4_copy(GLM_MAT4_IDENTITY, dest); glm_mat4_copy(GLM_MAT4_IDENTITY, dest);
srand((unsigned int)time(NULL));
/* random position */ /* random position */
dest[3][0] = drand48(); dest[3][0] = drand48();
@@ -28,8 +26,6 @@ void
test_rand_mat3(mat3 dest) { test_rand_mat3(mat3 dest) {
mat4 m4; mat4 m4;
srand((unsigned int)time(NULL));
/* random rotatation around random axis with random angle */ /* random rotatation around random axis with random angle */
glm_rotate_make(m4, drand48(), (vec3){drand48(), drand48(), drand48()}); glm_rotate_make(m4, drand48(), (vec3){drand48(), drand48(), drand48()});
glm_mat4_pick3(m4, dest); glm_mat4_pick3(m4, dest);
@@ -37,8 +33,6 @@ test_rand_mat3(mat3 dest) {
void void
test_rand_vec3(vec3 dest) { test_rand_vec3(vec3 dest) {
srand((unsigned int)time(NULL));
dest[0] = drand48(); dest[0] = drand48();
dest[1] = drand48(); dest[1] = drand48();
dest[2] = drand48(); dest[2] = drand48();
@@ -53,8 +47,6 @@ test_rand_vec3s() {
void void
test_rand_vec4(vec4 dest) { test_rand_vec4(vec4 dest) {
srand((unsigned int)time(NULL));
dest[0] = drand48(); dest[0] = drand48();
dest[1] = drand48(); dest[1] = drand48();
dest[2] = drand48(); dest[2] = drand48();
@@ -70,14 +62,11 @@ test_rand_vec4s() {
float float
test_rand(void) { test_rand(void) {
srand((unsigned int)time(NULL));
return drand48(); return drand48();
} }
void void
test_rand_quat(versor q) { test_rand_quat(versor q) {
srand((unsigned int)time(NULL));
glm_quat(q, drand48(), drand48(), drand48(), drand48()); glm_quat(q, drand48(), drand48(), drand48(), drand48());
glm_quat_normalize(q); glm_quat_normalize(q);
} }

View File

@@ -30,6 +30,7 @@
<ClCompile Include="..\test\src\test_mat4.c" /> <ClCompile Include="..\test\src\test_mat4.c" />
<ClCompile Include="..\test\src\test_project.c" /> <ClCompile Include="..\test\src\test_project.c" />
<ClCompile Include="..\test\src\test_quat.c" /> <ClCompile Include="..\test\src\test_quat.c" />
<ClCompile Include="..\test\src\test_struct.c" />
<ClCompile Include="..\test\src\test_vec3.c" /> <ClCompile Include="..\test\src\test_vec3.c" />
<ClCompile Include="..\test\src\test_vec4.c" /> <ClCompile Include="..\test\src\test_vec4.c" />
</ItemGroup> </ItemGroup>

View File

@@ -50,6 +50,9 @@
<ClCompile Include="..\test\src\test_vec4.c"> <ClCompile Include="..\test\src\test_vec4.c">
<Filter>src</Filter> <Filter>src</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\test\src\test_struct.c">
<Filter>src</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="..\test\tests.h"> <ClInclude Include="..\test\tests.h">