File: list_test.cpp

package info (click to toggle)
c-munipack 2.1.38-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 55,888 kB
  • sloc: ansic: 200,762; cpp: 106,123; lex: 9,035; yacc: 4,916; sh: 4,074; fortran: 2,613; xml: 2,105; python: 1,182; makefile: 546; perl: 104
file content (113 lines) | stat: -rw-r--r-- 3,197 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**************************************************************

list_test.c (C-Munipack project)
Listing test
Copyright (C) 2003 David Motl, dmotl@volny.cz

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

**************************************************************/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cmunipack.h>

extern CmpackConsole *g_console;

/* Input file names */
#define IN_FILE				"test_pht.pht"

/* Output data file */
#define DIFF_OUT_FILE		"diff_out.dat"
#define INST_OUT_FILE		"inst_out.dat"
#define TRACK_OUT_FILE		"track_out.dat"
#define STDDEV_OUT_FILE		"stdev_out.dat"
#define VARFIND_OUT_FILE	"vfind_out.dat"

/* Variable star indices */
static const int var[] = { 1 };

/* Comparison star indices */
static const int comp[] = { 2, 3 };

/* Check star indices */
static const int check[] = { 4, 5 };

/* Differential magnitudes */
static int test_diff(const char *outfile)
{
	CmpackLCurve *lc = cmpack_lcurve_init();
	CmpackTable *table = cmpack_tab_init(CMPACK_TABLE_UNSPECIFIED);

	cmpack_lcurve_set_console(lc, g_console);
	cmpack_lcurve_set_aperture(lc, 1);
	cmpack_lcurve_set_var(lc, var, sizeof(var)/sizeof(int));
	cmpack_lcurve_set_comp(lc, comp, sizeof(comp)/sizeof(int));
	cmpack_lcurve_set_check(lc, check, sizeof(check)/sizeof(int));

	/* Destroy context */
	cmpack_lcurve_destroy(lc);
	cmpack_tab_destroy(table);
	return 0;
}

/* Instrumental magnitudes */
static int test_inst(const char *outfile)
{
	CmpackLCurve *lc = cmpack_lcurve_init();
	CmpackTable *table = cmpack_tab_init(CMPACK_TABLE_UNSPECIFIED);

	cmpack_lcurve_set_console(lc, g_console);
	cmpack_lcurve_set_aperture(lc, 1);
	cmpack_lcurve_set_var(lc, var, sizeof(var)/sizeof(int));
	cmpack_lcurve_set_comp(lc, comp, sizeof(comp)/sizeof(int));
	cmpack_lcurve_set_check(lc, check, sizeof(check)/sizeof(int));

	/* Destroy context */
	cmpack_lcurve_destroy(lc);
	cmpack_tab_destroy(table);
	return 0;
}

/* Instrumental magnitudes */
static int test_track(const char *outfile)
{
	return 0;
}

/* Instrumental magnitudes */
static int test_stddev(const char *outfile)
{
	return 0;
}

/* Testing tool for read-all files */
int list_test(void)
{
	/* Listing of differential magnitudes */
	test_diff(DIFF_OUT_FILE);

	/* Listing of instrumental magnitudes */
	test_inst(INST_OUT_FILE);

	/* Make track list */
	test_track(TRACK_OUT_FILE);

	/* Make table of standard deviations */
	test_stddev(STDDEV_OUT_FILE);

	return 0;
}