1 /* This file is part of the hkl library.
3 * The hkl library is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * The hkl library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with the hkl library. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright (C) 2003-2015 Synchrotron SOLEIL
17 * L'Orme des Merisiers Saint-Aubin
18 * BP 48 91192 GIF-sur-YVETTE CEDEX
20 * Authors: Picca Frédéric-Emmanuel <picca@synchrotron-soleil.fr>
23 #include <tap/basic.h>
24 #include <tap/float.h>
26 #include "hkl-source-private.h"
28 static void new_copy(void)
32 hkl_source_init(&s
, 1.54, 1, 0, 0);
35 is_double(c
.wave_length
, s
.wave_length
, HKL_EPSILON
, __func__
);
36 ok(FALSE
== hkl_vector_cmp(&c
.direction
, &s
.direction
), __func__
);
39 static void init(void)
43 hkl_source_init(&s
, 1, 1, 0, 0);
45 is_double(1., s
.wave_length
, HKL_EPSILON
, __func__
);
46 is_double(1., s
.direction
.data
[0], HKL_EPSILON
, __func__
);
47 is_double(0., s
.direction
.data
[1], HKL_EPSILON
, __func__
);
48 is_double(0., s
.direction
.data
[2], HKL_EPSILON
, __func__
);
53 HklSource ref
, s1
, s2
;
55 hkl_source_init(&ref
, 1.54, 1, 0, 0);
56 hkl_source_init(&s1
, 1.54, 1, 0, 0);
57 hkl_source_init(&s2
, 1, 1, 0, 0);
59 ok(TRUE
== hkl_source_cmp(&ref
, &s1
), __func__
);
60 ok(FALSE
== hkl_source_cmp(&ref
, &s2
), __func__
);
63 static void compute_ki(void)
66 HklVector ki_ref
= {{HKL_TAU
/ 1.54, 0, 0}};
69 hkl_source_init(&s
, 1.54, 1, 0, 0);
71 hkl_source_compute_ki(&s
, &ki
);
72 ok(0 == hkl_vector_cmp(&ki_ref
, &ki
), __func__
);
75 static void get_wavelength(void)
79 hkl_source_init(&s
, 1, 1, 0, 0);
81 is_double(1., hkl_source_get_wavelength(&s
), HKL_EPSILON
, __func__
);