FORS Pipeline Reference Manual  5.0.9
fors_star-test.c
1 /* $Id: fors_star-test.c,v 1.2 2007-10-17 09:17:41 jmlarsen Exp $
2  *
3  * This file is part of the FORS Library
4  * Copyright (C) 2002-2006 European Southern Observatory
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 /*
22  * $Author: jmlarsen $
23  * $Date: 2007-10-17 09:17:41 $
24  * $Revision: 1.2 $
25  * $Name: not supported by cvs2svn $
26  */
27 
28 #ifdef HAVE_CONFIG_H
29 #include <config.h>
30 #endif
31 
32 #include <fors_star.h>
33 #include <fors_utils.h>
34 
35 #include <test_simulate.h>
36 #include <test.h>
37 
44 #undef cleanup
45 #define cleanup \
46 do { \
47  fors_star_delete(&s); \
48  fors_star_delete(&t); \
49 } while (0)
50 
53 static void
54 test_star(void)
55 {
56  double x = 110;
57  double y = 399;
58  double smajor = 3;
59  double sminor = 2;
60  double fwhm = 3.5;
61  double theta = -0.1;
62  double m = -17;
63  double dm = 0.05;
64  double si = 1.0;
65 
66  fors_star *s = fors_star_new(x, y,
67  fwhm,
68  smajor, sminor,
69  theta,
70  m, dm, si);
71 
73 
74  test( fors_star_equal(s, t) );
75 
76  test_abs( fors_star_distsq(s, t), 0, 0.001 );
77 
78  cleanup;
79  return;
80 }
81 
82 
86 int main(void)
87 {
88  TEST_INIT;
89 
90  test_star();
91 
92  TEST_END;
93 }
94 
bool fors_star_equal(const fors_star *s, const fors_star *t)
Test for equality.
Definition: fors_star.c:309
double fors_star_distsq(const fors_star *s, const fors_star *t)
Get distance between stars.
Definition: fors_star.c:347
int main(void)
Test of star module.
fors_star * fors_star_new(double x, double y, double fwhm, double smajor, double sminor, double orientation, double m, double dm, double si)
Constructor.
Definition: fors_star.c:114
fors_star * fors_star_duplicate(const fors_star *star)
Copy constructor.
Definition: fors_star.c:248