commit 8a68cde950b885fa209de3b5a7a2e4b5ff2e42c9
parent b1747b1fb88ed763da93dde722b0b046e7575e4e
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 19 Sep 2016 14:33:46 +0200
Fix the tests on the ssf_bsdf_view data structure
Diffstat:
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/test_ssf_bsdf_view.c b/src/test_ssf_bsdf_view.c
@@ -18,10 +18,16 @@
#include <rsys/double3.h>
+static INLINE double
+rand_canonic(void)
+{
+ return (double)rand()/(double)RAND_MAX;
+}
+
int
main(int argc, char** argv)
{
- const size_t NSTEPS = 10000;
+ const size_t NSTEPS = 100000;
struct ssf_bxdf* bxdf;
struct ssf_bxdf* bxdf2;
struct ssf_bsdf* bsdf;
@@ -68,7 +74,9 @@ main(int argc, char** argv)
sum = 0;
sqr_sum = 0;
FOR_EACH(i, 0, NSTEPS) {
- const double weight = ssf_bsdf_view_sample(view, 0.5, 0.5, w, N, dir);
+ const double u = rand_canonic();
+ const double v = rand_canonic();
+ const double weight = ssf_bsdf_view_sample(view, u, v, w, N, dir);
sum += weight;
sqr_sum += weight*weight;
}
@@ -84,6 +92,7 @@ main(int argc, char** argv)
CHECK(ssf_bsdf_view_ref_put(view), RES_OK);
CHECK(ssf_bxdf_ref_put(bxdf), RES_OK);
+ CHECK(ssf_bxdf_ref_put(bxdf2), RES_OK);
CHECK(ssf_bsdf_ref_put(bsdf), RES_OK);
check_memory_allocator(&allocator);