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