Использование minunit.h
для тестирования встроенных структур gsl.
Я написал следующий тест:
static
char * test_gsl_polar_complex_number_struct()
{
double r = 0.325784;
double theta = 0.421329;
gsl_complex test_polr_complex_number = gsl_complex_polar ( r, theta );
printf("expected r: %f, actual r: %f\n", r, GSL_REAL(test_polr_complex_number));
mu_assert("real part of polar complex number does not match expected",
GSL_REAL(test_polr_complex_number) == r);
return 0;
}
Я получаю неудачный тест со следующим выводом:
expected r: 0.325784, actual r: 0.297293
expected theta: 0.421329, actual theta: 0.133237
real part of polar complex number does not match expected
Примечательно, что точно такой же тест выполняется без ошибок на прямоугольной сложной структуре.
gsl-complex.h
, макросGSL_REAL
определяется как:#define GSL_REAL(z) ((z).dat[0])
- person Joshua Cook   schedule 30.08.2015