summaryrefslogtreecommitdiff
path: root/test/randomtest.cc
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2020-09-19 15:12:08 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2020-09-19 15:14:24 +0200
commit62e577cee9e199692d15cf741c0e29ae28f25c52 (patch)
tree3cfe20ce434b986e58efbc9bececcda41502ed33 /test/randomtest.cc
parent19ac4649f16621430b7d34635410fd67fd8ef49e (diff)
Make use of uUnit as a submodule (dgunit renamed).
Diffstat (limited to 'test/randomtest.cc')
-rw-r--r--test/randomtest.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/randomtest.cc b/test/randomtest.cc
index bc79432..a1869f7 100644
--- a/test/randomtest.cc
+++ b/test/randomtest.cc
@@ -24,7 +24,7 @@
* along with DrumGizmo; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-#include "dgunit.h"
+#include <uunit.h>
#include <random.h>
@@ -32,14 +32,14 @@
#include <cmath>
class RandomTest
- : public DGUnit
+ : public uUnit
{
public:
RandomTest()
{
- DGUNIT_TEST(RandomTest::rangeTest);
- DGUNIT_TEST(RandomTest::normalTest);
- DGUNIT_TEST(RandomTest::chooseTest);
+ uUNIT_TEST(RandomTest::rangeTest);
+ uUNIT_TEST(RandomTest::normalTest);
+ uUNIT_TEST(RandomTest::chooseTest);
}
void rangeTest()
@@ -55,16 +55,16 @@ public:
{
float rand_float = rand.floatInRange(float_lb, float_ub);
float rand_int = rand.intInRange(int_lb, int_ub);
- DGUNIT_ASSERT(rand_float >= float_lb && rand_float <= float_ub);
- DGUNIT_ASSERT(rand_int >= int_lb && rand_int <= int_ub);
+ uUNIT_ASSERT(rand_float >= float_lb && rand_float <= float_ub);
+ uUNIT_ASSERT(rand_int >= int_lb && rand_int <= int_ub);
}
// check if the series of random numbers is the one we expect
// for a certain seed.
rand = Random(666);
- DGUNIT_ASSERT_EQUAL(0, rand.intInRange(0,100));
- DGUNIT_ASSERT_EQUAL(61, rand.intInRange(0,100));
- DGUNIT_ASSERT_EQUAL(23, rand.intInRange(0,100));
+ uUNIT_ASSERT_EQUAL(0, rand.intInRange(0,100));
+ uUNIT_ASSERT_EQUAL(61, rand.intInRange(0,100));
+ uUNIT_ASSERT_EQUAL(23, rand.intInRange(0,100));
}
void normalTest()
@@ -89,8 +89,8 @@ public:
float estimated_stddev = sqrt(sum_of_squares/nr_of_samples - estimated_mean*estimated_mean);
float epsilon = 0.1;
- DGUNIT_ASSERT(estimated_mean >= real_mean-epsilon && estimated_mean <= real_mean+epsilon);
- DGUNIT_ASSERT(estimated_stddev >= real_stddev-epsilon && estimated_stddev <= real_stddev+epsilon);
+ uUNIT_ASSERT(estimated_mean >= real_mean-epsilon && estimated_mean <= real_mean+epsilon);
+ uUNIT_ASSERT(estimated_stddev >= real_stddev-epsilon && estimated_stddev <= real_stddev+epsilon);
}
void chooseTest()
@@ -102,7 +102,7 @@ public:
for (int i=0; i<nr_of_samples; i++)
{
- DGUNIT_ASSERT_EQUAL(42, rand.choose(vec));
+ uUNIT_ASSERT_EQUAL(42, rand.choose(vec));
}
}
};