-
Notifications
You must be signed in to change notification settings - Fork 22
/
test_reg_exp.cc
89 lines (62 loc) · 2.14 KB
/
test_reg_exp.cc
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
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
// ** Copyright UCAR (c) 1992 - 2021
// ** University Corporation for Atmospheric Research (UCAR)
// ** National Center for Atmospheric Research (NCAR)
// ** Research Applications Lab (RAL)
// ** P.O.Box 3000, Boulder, Colorado, 80307-3000, USA
// *=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
////////////////////////////////////////////////////////////////////////
using namespace std;
#include <iostream>
#include <unistd.h>
#include <stdlib.h>
#include <cmath>
#include "vx_cal.h"
#include "vx_util.h"
#include "vx_log.h"
////////////////////////////////////////////////////////////////////////
static void set_regex (const StringArray &);
static void set_test (const StringArray &);
static void usage();
static ConcatString RegexCS;
static ConcatString TestCS;
////////////////////////////////////////////////////////////////////////
static ConcatString program_name;
////////////////////////////////////////////////////////////////////////
int main(int argc, char * argv []) {
program_name = get_short_name(argv[0]);
CommandLine c;
c.set(argc, argv);
c.add(set_regex, "-regex", 1);
c.add(set_test, "-test", 1);
c.set_usage(usage);
c.parse();
if(RegexCS.length() == 0 || TestCS.length() == 0) {
usage();
exit(1);
}
mlog << Debug(1) << "Regex = '" << RegexCS << "'\n";
mlog << Debug(1) << "Test = '" << TestCS << "'\n";
mlog << Debug(1) << "Result = "
<< bool_to_string(check_reg_exp(RegexCS.c_str(), TestCS.c_str())) << "\n";
return(0);
}
////////////////////////////////////////////////////////////////////////
void set_regex(const StringArray & a) {
RegexCS = a[0];
return;
}
////////////////////////////////////////////////////////////////////////
void set_test(const StringArray & a) {
TestCS = a[0];
return;
}
////////////////////////////////////////////////////////////////////////
void usage() {
mlog << Error
<< "\nusage: " << program_name
<< " -regex string -test string\n\n";
exit(1);
return;
}
////////////////////////////////////////////////////////////////////////