Added Argument tests.
[command.git] / tests / argument / handles_int_value.cpp
1 #include <cstring>
2 #include <iostream>
3
4 #include "argument.h"
5
6 using namespace std;
7 using namespace command;
8
9 #define VALUE "1234567890"
10
11 typedef int ArgumentType;
12
13 ArgumentType test;
14
15 void function(ArgumentType value) {
16     test = value;
17 }
18
19 int main() {
20     Argument<ArgumentType> argument("Argument as int", function);
21
22     if (argument.understand(VALUE)) {
23         argument.handle();
24     }
25
26     if (test == std::stoi(VALUE)) {
27         cout << "Argument class handles int values\n";
28         return 0;
29     }
30
31     cout << "Argument class do not handle int values\n";
32
33     return 1;
34 }