Added Argument tests.
[command.git] / tests / argument / handles_float_value.cpp
diff --git a/tests/argument/handles_float_value.cpp b/tests/argument/handles_float_value.cpp
new file mode 100644 (file)
index 0000000..3fd86fb
--- /dev/null
@@ -0,0 +1,34 @@
+#include <iostream>
+
+#include "argument.h"
+
+using namespace std;
+using namespace command;
+
+#define VALUE "567890.1234"
+
+typedef float ArgumentType;
+
+ArgumentType test;
+
+void function(ArgumentType value) {
+    test = value;
+}
+
+int main() {
+    Argument<ArgumentType> argument("Argument as float", function);
+
+    if (argument.understand(VALUE)) {
+        argument.handle();
+    }
+
+    if (test == std::stof(VALUE)) {
+        cout << "Argument class handles float values\n";
+        return 0;
+    }
+
+    cout << "Argument class do not handle float values\n";
+
+
+    return 1;
+}