FORS Pipeline Reference Manual 4.9.20
|
00001 /* $Id: fors_star-test.c,v 1.2 2007/10/17 09:17:41 jmlarsen Exp $ 00002 * 00003 * This file is part of the FORS Library 00004 * Copyright (C) 2002-2006 European Southern Observatory 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00019 */ 00020 00021 /* 00022 * $Author: jmlarsen $ 00023 * $Date: 2007/10/17 09:17:41 $ 00024 * $Revision: 1.2 $ 00025 * $Name: fors-4_9_20 $ 00026 */ 00027 00028 #ifdef HAVE_CONFIG_H 00029 #include <config.h> 00030 #endif 00031 00032 #include <fors_star.h> 00033 #include <fors_utils.h> 00034 00035 #include <test_simulate.h> 00036 #include <test.h> 00037 00044 #undef cleanup 00045 #define cleanup \ 00046 do { \ 00047 fors_star_delete(&s); \ 00048 fors_star_delete(&t); \ 00049 } while (0) 00050 00053 static void 00054 test_star(void) 00055 { 00056 double x = 110; 00057 double y = 399; 00058 double smajor = 3; 00059 double sminor = 2; 00060 double fwhm = 3.5; 00061 double theta = -0.1; 00062 double m = -17; 00063 double dm = 0.05; 00064 double si = 1.0; 00065 00066 fors_star *s = fors_star_new(x, y, 00067 fwhm, 00068 smajor, sminor, 00069 theta, 00070 m, dm, si); 00071 00072 fors_star *t = fors_star_duplicate(s); 00073 00074 test( fors_star_equal(s, t) ); 00075 00076 test_abs( fors_star_distsq(s, t), 0, 0.001 ); 00077 00078 cleanup; 00079 return; 00080 } 00081 00082 00086 int main(void) 00087 { 00088 TEST_INIT; 00089 00090 test_star(); 00091 00092 TEST_END; 00093 } 00094