Added some Command tests.
[command.git] / tests / command / src / option_test_command.cpp
1 #include <iostream>
2 #include <string>
3 #include <stdexcept>
4
5 #include "option.h"
6 #include "command.h"
7
8 using namespace command;
9
10 void option_function(std::string a) {
11     std::cout << "Help function " << a << std::endl;
12 }
13
14 int main(int argc, char *argv[]) {
15     try {
16         Command command(argc, argv, {
17             new Option<void>("void", "void Test", [](void) {
18                 std::cout << "VOID" << std::endl;
19             }),
20             new Option<char>("char", "char Test", [](char a) {
21                 std::cout << "char: " << a << std::endl;
22             }),
23             new Option<bool>("bool", "bool Test", [](bool b) {
24                 std::cout << "bool: " << b << std::endl;
25             }),
26             new Option<int>("int", "int Test", [](int i) {
27                 std::cout << "int: " << i << std::endl;
28             }),
29             new Option<float>("float", "float Test", [](float f) {
30                 std::cout << "float: " << f << std::endl;
31             }),
32             new Option<std::string>("std::string", "std::string Test", [](std::string s) {
33                 std::cout << "std::string: " << s << std::endl;
34             })
35         });
36     }
37     catch(const std::exception & e) {
38         std::cout << e.what() << std::endl;
39         return 1;
40     }
41
42     return 0;
43 }