#include <xsh_fit.h>
#include <tests.h>
#include <cpl_test.h>
#include <math.h>
#include <float.h>
Go to the source code of this file.
Defines | |
#define | MODULE_ID "XSH_FIT" |
#define | XSH_TEST_MARGIN 2.0 |
#define | xsh_test(expr) |
#define | xsh_test_tol(first, second, tolerance) |
#define | IMAGESZ 10 |
#define | NFRAMES 10 |
#define | IMAGESZFIT 256 |
#define | xsh_fit_imagelist_is_zero(A, B) xsh_fit_imagelist_is_zero_macro(A, B) |
#define | xsh_fit_image_is_zero(A, B) xsh_fit_image_is_zero_macro(A, B) |
Functions | |
static void | xsh_fit_imagelist_polynomial_tests (void) |
static void | xsh_fit_imagelist_is_zero_macro (const cpl_imagelist *self, double tol) |
Verify that all elements in an imagelist are zero (within a tolerance). | |
static void | xsh_fit_image_is_zero_macro (const cpl_image *self, double tol) |
Verify that all elements in an image are zero (within a tolerance). | |
static cpl_error_code | xsh_image_fill_noise_uniform (cpl_image *self, double min_pix, double max_pix) |
Fill an image with uniform random noise distribution. | |
int | main (void) |
Unit tests of fit module. |
#define IMAGESZ 10 |
Definition at line 63 of file test-xsh_fit.c.
Referenced by xsh_fit_imagelist_polynomial_tests().
#define IMAGESZFIT 256 |
Definition at line 65 of file test-xsh_fit.c.
Referenced by xsh_fit_imagelist_polynomial_tests().
#define MODULE_ID "XSH_FIT" |
Definition at line 38 of file test-xsh_fit.c.
#define NFRAMES 10 |
Definition at line 64 of file test-xsh_fit.c.
#define xsh_fit_image_is_zero | ( | A, | |||
B | ) | xsh_fit_image_is_zero_macro(A, B) |
Definition at line 69 of file test-xsh_fit.c.
Referenced by xsh_fit_imagelist_polynomial_tests().
#define xsh_fit_imagelist_is_zero | ( | A, | |||
B | ) | xsh_fit_imagelist_is_zero_macro(A, B) |
Definition at line 67 of file test-xsh_fit.c.
Referenced by xsh_fit_imagelist_polynomial_tests().
#define xsh_test | ( | expr | ) |
do { \ if (!(expr)) assure(0, CPL_ERROR_ILLEGAL_OUTPUT, "Test failed"); \ } while(0) \
Definition at line 43 of file test-xsh_fit.c.
Referenced by xsh_fit_imagelist_polynomial_tests().
#define XSH_TEST_MARGIN 2.0 |
Definition at line 41 of file test-xsh_fit.c.
do { \ const double xsh_test_first = (double)(first); \ const double xsh_test_second = (double)(second); \ const double xsh_test_tolerance = (double)(tolerance); \ /* The error margin on the tolerance */ \ const double xsh_test_margin = (double)(XSH_TEST_MARGIN); \ \ if (!(fabs(xsh_test_first - xsh_test_second) <= \ xsh_test_tolerance * xsh_test_margin)) \ { \ xsh_test(0); \ } \ } while (0)
Definition at line 48 of file test-xsh_fit.c.
Referenced by xsh_fit_image_is_zero_macro().
int main | ( | void | ) |
Unit tests of fit module.
Definition at line 99 of file test-xsh_fit.c.
References check, MODULE_ID, TEST_END, TESTS_INIT, xsh_error_dump, and xsh_fit_imagelist_polynomial_tests().
static void xsh_fit_image_is_zero_macro | ( | const cpl_image * | self, | |
double | tol | |||
) | [static] |
Verify that all elements in an image are zero (within a tolerance).
self | The image to check | |
tol | The non-negative tolerance param line The line number of the caller |
Definition at line 447 of file test-xsh_fit.c.
References xsh_test_tol.
Referenced by xsh_fit_imagelist_is_zero_macro().
static void xsh_fit_imagelist_is_zero_macro | ( | const cpl_imagelist * | self, | |
double | tol | |||
) | [static] |
Verify that all elements in an imagelist are zero (within a tolerance).
self | The list of images to check | |
tol | The non-negative tolerance |
Definition at line 418 of file test-xsh_fit.c.
References check, n, and xsh_fit_image_is_zero_macro().
static void xsh_fit_imagelist_polynomial_tests | ( | void | ) | [static] |
Definition at line 117 of file test-xsh_fit.c.
References IMAGESZ, IMAGESZFIT, xsh_fit_image_is_zero, xsh_fit_imagelist_is_zero, xsh_fit_imagelist_polynomial(), xsh_image_fill_noise_uniform(), and xsh_test.
Referenced by main().
static cpl_error_code xsh_image_fill_noise_uniform | ( | cpl_image * | self, | |
double | min_pix, | |||
double | max_pix | |||
) | [static] |
Fill an image with uniform random noise distribution.
self | Image to fill | |
min_pix | Minimum output pixel value. | |
max_pix | Maximum output pixel value. |
FIXME: Add Integer support to cpl_image_fill_noise_uniform()
Definition at line 481 of file test-xsh_fit.c.
Referenced by xsh_fit_imagelist_polynomial_tests().