test_htgop_get_radiative_properties_bounds.c (2098B)
1 /* Copyright (C) 2018-2021, 2023 |Méso|Star> (contact@meso-star.com) 2 * 3 * This program 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. 7 * 8 * This program 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. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <http://www.gnu.org/licenses/>. */ 15 16 #include "htgop.h" 17 #include "test_htgop_utils.h" 18 19 #include <rsys/math.h> 20 #include <float.h> 21 22 /* Generate the check_layer_lw_ka_bounds */ 23 #define DOMAIN lw 24 #define DATA ka 25 #include "test_htgop_get_radiative_properties_bounds.h" 26 /* Generate the check_layer_sw_ka_bounds */ 27 #define DOMAIN sw 28 #define DATA ka 29 #include "test_htgop_get_radiative_properties_bounds.h" 30 /* Generate the check_layer_sw_ks_bounds */ 31 #define DOMAIN sw 32 #define DATA ks 33 #include "test_htgop_get_radiative_properties_bounds.h" 34 /* Generate the check_layer_sw_kext_bounds */ 35 #define GET_K(Tab, Id) ((Tab)->ka_tab[Id] + (Tab)->ks_tab[Id]) 36 #define DOMAIN sw 37 #define DATA kext 38 #include "test_htgop_get_radiative_properties_bounds.h" 39 40 int 41 main(int argc, char** argv) 42 { 43 struct mem_allocator allocator; 44 struct htgop* htgop; 45 46 if(argc < 2) { 47 fprintf(stderr, "Usage: %s FILENAME\n", argv[0]); 48 return 1; 49 } 50 51 CHK(mem_init_proxy_allocator(&allocator, &mem_default_allocator) == RES_OK); 52 CHK(htgop_create(NULL, &allocator, 1, &htgop) == RES_OK); 53 CHK(htgop_load(htgop, argv[1]) == RES_OK); 54 55 check_layer_lw_ka_bounds(htgop); 56 check_layer_sw_ka_bounds(htgop); 57 check_layer_sw_ks_bounds(htgop); 58 check_layer_sw_kext_bounds(htgop); 59 60 CHK(htgop_ref_put(htgop) == RES_OK); 61 62 check_memory_allocator(&allocator); 63 mem_shutdown_proxy_allocator(&allocator); 64 CHK(mem_allocated_size() == 0); 65 return 0; 66 }