#include "../squiggle.h" #include #include #include #include #define N 100 void test_unit_uniform(uint64_t* seed){ double* unit_uniform_array = malloc(sizeof(double) * N); for(int i=0; i 1.0/1000.0){ printf("[-] Mean test for unit uniform NOT passed.\n"); }else { printf("[x] Mean test for unit uniform PASSED\n"); } if(fabs(delta_std) > 1.0/1000.0){ printf("[-] Std test for unit uniform NOT passed.\n"); }else { printf("[x] Std test for unit uniform PASSED\n"); } printf("\n"); } void test_uniform(double start, double end, uint64_t* seed){ double* uniform_array = malloc(sizeof(double) * N); for(int i=0; i width * 1.0/1000.0){ printf("[-] Mean test for [%.1f, %.1f] uniform NOT passed.\n", start, end); printf("Mean of [%.1f, %.1f] uniform: %f, vs expected mean: %f, delta: %f\n", start, end, mean, expected_mean, mean - expected_mean); }else { printf("[x] Mean test for unit uniform PASSED\n"); } if(fabs(delta_std) > width * 1.0/1000.0){ printf("[-] Std test for [%.1f, %.1f] uniform NOT passed.\n", start, end); printf("Std of [%.1f, %.1f] uniform: %f, vs expected std: %f, delta: %f\n", start, end, std, expected_std, std - expected_std); for(int i=0; i start){ test_uniform(start, end, seed); } } free(seed); }