File: ut_test.h

package info (click to toggle)
netcdf-parallel 1%3A4.9.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 116,192 kB
  • sloc: ansic: 279,265; sh: 14,143; cpp: 5,971; yacc: 2,612; makefile: 2,075; lex: 1,218; javascript: 280; xml: 173; awk: 2
file content (78 lines) | stat: -rw-r--r-- 1,824 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
/*
 *	Copyright 2018, University Corporation for Atmospheric Research
 *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
 */

#ifndef ZTEST_H
#define ZTEST_H

#include "nclist.h"

typedef struct Dimdef {
    char* name;
    size64_t size;
    int isunlimited;
} Dimdef;

typedef struct Vardef  {
    char* name;
    nc_type typeid;
    size_t typesize;
    int rank;
    Dimdef* dimrefs[NC_MAX_VAR_DIMS];
    size64_t dimsizes[NC_MAX_VAR_DIMS];
    size64_t chunksizes[NC_MAX_VAR_DIMS];
} Vardef;

/* Expose functions for unit tests */
typedef struct NCZ_UT_PRINTER {
    int printsort;
    void (*printer)(struct NCZ_UT_PRINTER*);
    /* Union of all fields */
    int rank;
    size64_t count;
    size64_t offset;
    size64_t* indices;
    size64_t* vector;
    void** pvector;
    NCZOdometer* odom;
    void* output;
    size_t used;
} NCZ_UT_PRINTER;

/* Arguments from command line */
struct UTOptions {
    int debug;
    char** cmds;
    char* file;
    char* output;
    char* kind;
    char* profile;
    NCZChunkRange ranges[NC_MAX_VAR_DIMS];
    int nslices;
    NCZSlice slices[NC_MAX_VAR_DIMS];
    NClist* dimdefs; /*List<struct Dimdef*> */
    NClist* vardefs; /*List<struct Vardef*> */
    int* idata;
};

struct Test {
    char* cmd;
    int (*test)(void);
};

EXTERNL struct UTOptions utoptions;

#define NCCHECK(expr) nccheck((expr),__LINE__)

EXTERNL void usage(int err);
EXTERNL int ut_init(int argc, char** argv, struct UTOptions* test);
EXTERNL void ut_final(void);

EXTERNL void nccheck(int stat, int line);
EXTERNL char* makeurl(const char* file, NCZM_IMPL, struct UTOptions*);
//extern int setup(int argc, char** argv);
EXTERNL struct Test* findtest(const char* cmd, struct Test* tests);
EXTERNL int runtests(const char** cmds, struct Test* tests);

#endif /*ZTEST_H*/