File: tst_xml.c

package info (click to toggle)
g2clib 2.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,524 kB
  • sloc: ansic: 28,287; python: 76; sh: 46; makefile: 26
file content (41 lines) | stat: -rw-r--r-- 914 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
/* This is a test for the NCEPLIBS-g2c project. This test is for
 * g2cxml.c.
 *
 * Ed Hartnett 8/27/22
 */

#include "grib2_int.h"
#include <stdio.h>
#include <stdlib.h>

int
main()
{
    int ret;
    char desc[G2C_MAX_GRIB_DESC_LEN + 1];

    printf("Testing XML ingestion...\n");
    if (g2c_xml_init())
        return G2C_ERROR;
    if ((ret = g2c_find_desc("Code table 0.0", 0, desc)))
        return ret;
    if (strcmp("Meteorological products", desc))
        return G2C_ERROR;
    if ((ret = g2c_find_desc_str("Code table 0.0", "0", desc)))
        return ret;
    if (strcmp("Meteorological products", desc))
        return G2C_ERROR;

    /* Calling init again is harmless. */
    if (g2c_xml_init())
        return G2C_ERROR;

    g2c_free_tables();

    /* Calling free again is harmless. */
    g2c_free_tables();

    printf("desc %s\n", desc);
    printf("SUCCESS!!!\n");
    return G2C_NOERROR;
}