From ccf810ce693d65a090fcdb3c2a42f2a13fe15e89 Mon Sep 17 00:00:00 2001 From: Pietro Incardona <incardon@mpi-cbg.de> Date: Mon, 29 Jun 2015 00:58:00 +0200 Subject: [PATCH] Disabling randomized when on unit tests --- configure.ac | 2 ++ src/util.hpp | 20 ++++++++------------ vtk_box_3D_2_test.vtk | 24 ++++++++++++------------ vtk_box_3D_test.vtk | 12 ++++++------ vtk_box_test.vtk | 12 ++++++------ 5 files changed, 34 insertions(+), 36 deletions(-) diff --git a/configure.ac b/configure.ac index 7bc1810..2542125 100755 --- a/configure.ac +++ b/configure.ac @@ -73,6 +73,8 @@ if test x"$mem_check" = x"yes"; then AC_DEFINE([MEMLEAK_CHECK],[],[Memory check]) fi +AC_DEFINE([ON_IO_UNIT_TESTS],[],[IO unit tests]) + ##### CHECK FOR BOOST ############## AX_BOOST([1.52],[],[]) diff --git a/src/util.hpp b/src/util.hpp index 16d4252..9533c1d 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -5,6 +5,8 @@ * Author: Pietro Incardona */ +#include "config.h" + #ifndef UTIL_HPP_ #define UTIL_HPP_ @@ -67,86 +69,80 @@ struct RGB getColor(int group, std::uniform_real_distribution<float> & d, std::d { struct RGB col; + float s = d(g); + +#ifdef ON_IO_UNIT_TESTS + s = 0.5; +#endif + if (group == 0) { - float s = d(g); col.R = s/2 + 0.5; col.G = 0.0; col.B = 0.0; } else if (group == 1) { - float s = d(g); col.R = 0.0; col.G = s/2 + 0.5; col.B = 0.0; } else if (group == 2) { - float s = d(g); col.R = 0.0; col.G = 0.0; col.B = s; } else if (group == 3) { - float s = d(g); col.R = s/2 + 0.5; col.G = s/2 + 0.5; col.B = 0.0; } else if (group == 4) { - float s = d(g); col.R = s/2 + 0.5; col.G = 0.0; col.B = s/2 + 0.5; } else if (group == 5) { - float s = d(g); col.R = 0.0; col.G = s/2 + 0.5; col.B = s/2 + 0.5; } else if (group == 6) { - float s = d(g); col.R = s/2 + 0.5; col.G = s/4 + 0.5; col.B = 0.0; } else if (group == 7) { - float s = d(g); col.R = s/4 + 0.5; col.G = s/2 + 0.5; col.B = 0.0; } else if (group == 8) { - float s = d(g); col.R = 0.0; col.G = s/2 + 0.5; col.B = s/4 + 0.5; } else if (group == 9) { - float s = d(g); col.R = 0.0; col.G = s/4 + 0.5; col.B = s/2 + 0.5; } else if (group == 10) { - float s = d(g); col.R = s/4 + 0.5; col.G = 0.0; col.B = s/2 + 0.5; } else if (group == 11) { - float s = d(g); col.R = s/2 + 0.5; col.G = 0.0; col.B = s/4 + 0.5; diff --git a/vtk_box_3D_2_test.vtk b/vtk_box_3D_2_test.vtk index f937817..15b3a76 100644 --- a/vtk_box_3D_2_test.vtk +++ b/vtk_box_3D_2_test.vtk @@ -129,17 +129,17 @@ CELL_TYPES 12 11 CELL_DATA 12 COLOR_SCALARS data 4 -0.500004 0.000000 0.000000 1.0 -0.565769 0.000000 0.000000 1.0 -0.877803 0.000000 0.000000 1.0 -0.729325 0.000000 0.000000 1.0 -0.766384 0.000000 0.000000 1.0 -0.609480 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 -0.000000 0.523522 0.000000 1.0 -0.000000 0.839432 0.000000 1.0 -0.000000 0.839648 0.000000 1.0 -0.000000 0.967346 0.000000 1.0 -0.000000 0.691751 0.000000 1.0 -0.000000 0.759708 0.000000 1.0 +0.000000 0.750000 0.000000 1.0 +0.000000 0.750000 0.000000 1.0 +0.000000 0.750000 0.000000 1.0 +0.000000 0.750000 0.000000 1.0 +0.000000 0.750000 0.000000 1.0 +0.000000 0.750000 0.000000 1.0 diff --git a/vtk_box_3D_test.vtk b/vtk_box_3D_test.vtk index b1dd26a..c91e235 100644 --- a/vtk_box_3D_test.vtk +++ b/vtk_box_3D_test.vtk @@ -68,10 +68,10 @@ CELL_TYPES 6 11 CELL_DATA 6 COLOR_SCALARS data 4 -0.500004 0.000000 0.000000 1.0 -0.565769 0.000000 0.000000 1.0 -0.877803 0.000000 0.000000 1.0 -0.729325 0.000000 0.000000 1.0 -0.766384 0.000000 0.000000 1.0 -0.609480 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 diff --git a/vtk_box_test.vtk b/vtk_box_test.vtk index dee9998..8a50615 100644 --- a/vtk_box_test.vtk +++ b/vtk_box_test.vtk @@ -44,10 +44,10 @@ CELL_TYPES 6 8 CELL_DATA 6 COLOR_SCALARS data 4 -0.500004 0.000000 0.000000 1.0 -0.565769 0.000000 0.000000 1.0 -0.877803 0.000000 0.000000 1.0 -0.729325 0.000000 0.000000 1.0 -0.766384 0.000000 0.000000 1.0 -0.609480 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 +0.750000 0.000000 0.000000 1.0 -- GitLab