* comments updated
[hkl.git] / test / hkl-test-detector.c
blobb6e16eca13b3d950812710ba416fdcd8923544e3
1 #include <math.h>
3 #include <hkl/hkl-detector.h>
5 #include "hkl-test.h"
7 #ifdef HKL_TEST_SUITE_NAME
8 # undef HKL_TEST_SUITE_NAME
9 #endif
10 #define HKL_TEST_SUITE_NAME detector
12 HKL_TEST_SUITE_FUNC(compute_kf)
14 HklDetector det = {0};
15 HklGeometry *geom = NULL;
16 HklAxis *axis1 = NULL;
17 HklAxis *axis2 = NULL;
18 HklHolder *holder = NULL;
19 HklVector kf;
20 HklVector kf_ref = {{0, HKL_TAU / HKL_SOURCE_DEFAULT_WAVE_LENGTH, 0}};
21 HklAxisConfig config;
23 geom = hkl_geometry_new();
24 holder = hkl_geometry_add_holder(geom);
25 axis1 = hkl_holder_add_rotation_axis(holder, "a", 1, 0, 0);
26 axis2 = hkl_holder_add_rotation_axis(holder, "b", 0, 1, 0);
28 hkl_axis_get_config(axis1, &config);
29 config.value = M_PI_2;
30 hkl_axis_set_config(axis1, &config);
31 hkl_axis_set_config(axis2, &config);
33 hkl_detector_compute_kf(&det, geom, &kf);
34 HKL_ASSERT_EQUAL(0, hkl_vector_cmp(&kf_ref, &kf));
36 hkl_geometry_free(geom);
38 return HKL_TEST_PASS;
41 HKL_TEST_SUITE_BEGIN
43 HKL_TEST( compute_kf );
45 HKL_TEST_SUITE_END