Possibility to pass class method reference
[command.git] / tests / option / handles_void_value.cpp
1 #include <iostream>
2
3 #include "option.h"
4
5 using namespace std;
6 using namespace command;
7
8 #define NAME "test"
9
10 typedef void OptionType;
11
12 bool test = false;
13
14 void _function() {
15     test = true;
16 }
17
18 int main() {
19     Option<OptionType> option(NAME, "Option with void value", _function);
20
21     if (option.understand(NAME)) {
22         option.handle();
23     }
24     else {
25         cout << option.describe() << " do not understand void values\n";
26         return 1;
27     }
28
29     if (test) {
30         cout << option.describe() << " handles void values\n";
31         return 0;
32     }
33
34     cout << option.describe() << " do not handle void values\n" << endl;
35
36     return 1;
37 }