CR2RE Pipeline Reference Manual 1.7.0
hdrl_cat_filter-test.c
1/*
2 * This file is part of the HDRL
3 * Copyright (C) 2017 European Southern Observatory
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20#ifdef HAVE_CONFIG_H
21#include "config.h"
22#endif
23
24#include <cpl_test.h>
25
26#include "../hdrl_cat_filter.h"
27
28
29#define NUM 100
30
31
32int main(void)
33{
34 cpl_test_init(PACKAGE_BUGREPORT, CPL_MSG_WARNING);
35
36 /* Test 1 */
37 double x1[NUM];
38 for (cpl_size i = 0; i < NUM; i++) {
39 x1[i] = 0.;
40 }
41 padext(x1, NUM);
42
43 /* Test 2 */
44 double x2[NUM];
45 for (cpl_size i = 0; i < NUM; i++) {
46 if (i < NUM / 2) {
47 x2[i] = -2000.;
48 } else {
49 x2[i] = 0.;
50 }
51 }
52 padext(x2, NUM);
53
54 /* Test 3 */
55 double x3[NUM];
56 for (cpl_size i = 0; i < NUM; i++) {
57 if (i < NUM / 2) {
58 x3[i] = 0.;
59 } else {
60 x3[i] = -2000.;
61 }
62 }
63 padext(x3, NUM);
64
65 /* Test 4 */
66 double x4[NUM];
67 for (cpl_size i = 0; i < NUM; i++) {
68 x4[i] = -2000.;
69 }
70 padext(x4, NUM);
71
72
73 return cpl_test_end(0);
74}
void padext(double x[], cpl_size n)
Pads out array with missing points and linearly extrapolates the ends.