Scarab  v2.4.9
Project 8 C++ Utility Library
test_nonoption_parser.cc
Go to the documentation of this file.
1 /*
2  * test_nonoption_parser.cc
3  *
4  * Created on: Jul 23, 2018
5  * Author: N.S. Oblath
6  *
7  * Terminal output should be something like this:
8 2018-07-23 17:12:03 [ INFO] (tid 0x7fff9c9dc380) option_parser.cc(19): Creating arguments
9 2018-07-23 17:12:03 [ INFO] (tid 0x7fff9c9dc380) option_parser.cc(33): Parsing
10 2018-07-23 17:12:03 [ INFO] (tid 0x7fff9c9dc380) option_parser.cc(36): Checking parsed args
11 2018-07-23 17:12:03 [ INFO] (tid 0x7fff9c9dc380) option_parser.cc(37): Ordered args:
12 
13 [
14  We
15  are
16  5
17  ordered
18  args
19 ]
20 
21 2018-07-23 17:12:03 [ INFO] (tid 0x7fff9c9dc380) option_parser.cc(38): Keyword args:
22 
23 {
24  And : 1
25  are :
26  [
27 
28 
29 
30 
31 
32 
33  3.000000
34  ]
35 
36  args : 500000000.000000
37  key :
38  {
39  word : -4
40  }
41 
42  we : 2
43 }
44  *
45  */
46 
47 #include "nonoption_parser.hh"
48 
49 #include "logger.hh"
50 
51 using namespace scarab;
52 
53 LOGGER( testlog, "test_nonoption_parser" );
54 
55 int main()
56 {
57  LINFO( testlog, "Creating arguments" );
58  std::vector< std::string > t_args;
59  t_args.push_back( "We" );
60  t_args.push_back( "are" );
61  t_args.push_back( "5" );
62  t_args.push_back( "ordered" );
63  t_args.push_back( "args" );
64 
65  t_args.push_back( "And=1" );
66  t_args.push_back( "we=2" );
67  t_args.push_back( "are.6=3.0" );
68  t_args.push_back( "key.word=-4" );
69  t_args.push_back( "args=5e8" );
70 
71  LINFO( testlog, "Parsing" );
72  nonoption_parser t_parser( t_args );
73 
74  LINFO( testlog, "Checking parsed args" );
75  LINFO( testlog, "\tOrdered args:\n" << t_parser.ord_args() );
76  LINFO( testlog, "\tKeyword args:\n" << t_parser.kw_args() );
77 
78  return 0;
79 }
80 
LOGGER(mtlog, "authentication")
int main()
Contains the logger class and macros, based on Kasper&#39;s KLogger class.
#define LINFO(...)
Definition: logger.hh:367