+AUTOMAKE_OPTIONS = subdir-objects
+
+TESTS = \
+ descriptive_holds_data.test \
+ callable_invokes_provided_function.test \
+ parameter_is_descriptive.test
+
+noinst_PROGRAMS = $(TESTS)
+
+AM_CXXFLAGS = -O3 -I$(top_srcdir)/include -std=c++11
+
+descriptive_holds_data_test_SOURCES = descriptive/holds_data.cpp
+callable_invokes_provided_function_test_SOURCES = callable/invokes_provided_function.cpp
+parameter_is_descriptive_test_SOURCES = parameter/is_descriptive.cpp
--- /dev/null
+#include "callable.h"
+
+using namespace command;
+
+template<typename ArgumentType>
+class TestCallable : public Callable<ArgumentType> {
+public:
+ TestCallable(void (*function)(ArgumentType))
+ : Callable<ArgumentType>(function) {
+ }
+
+ void callFunction(ArgumentType test) {
+ this->call(test);
+ }
+};
--- /dev/null
+#include <cstring>
+#include <iostream>
+
+#include "TestCallable.h"
+#include "callable.h"
+
+using namespace std;
+using namespace command;
+
+bool test = false;
+
+void function(bool val) {
+ test = val;
+};
+
+int main() {
+
+ TestCallable<bool> callable(function);
+ callable.callFunction(true);
+
+ if (test == true) {
+ cout << "Callable class calls provided function\n";
+ return 0;
+ }
+
+ cout << "Callable class does not call provided function\n";
+
+ return 1;
+}
+
--- /dev/null
+#include <cstring>
+#include <iostream>
+
+#include "descriptive.h"
+
+using namespace std;
+using namespace command;
+
+#define STRING "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+
+int main() {
+ Descriptive descriptive(STRING);
+
+ int cmp = strcmp(descriptive.describe().c_str(), STRING);
+
+ if (cmp == 0) {
+ cout << "Descriptive class holds data correctly\n";
+ return 0;
+ }
+
+ cout << "Descriptive class changes provided description\n";
+
+ return 1;
+}
+
--- /dev/null
+#include <cstring>
+#include <iostream>
+
+#include "parameter.h"
+
+using namespace std;
+using namespace command;
+
+#define STRING "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+
+class TestParameter : public Parameter {
+public:
+ TestParameter(std::string description) : Parameter(description) { }
+
+ virtual void handle() { }
+ virtual bool understand(std::string argVal) { }
+};
+
+int main() {
+ TestParameter parameter(STRING);
+
+ int cmp = strcmp(parameter.describe().c_str(), STRING);
+
+ if (cmp == 0) {
+ cout << "Parameter class is descriptive\n";
+ return 0;
+ }
+
+ cout << "Parameter class changes provided description so is not descriptive\n";
+
+ return 1;
+}
+