New tests for UTC parser and UTC formatting
[ACL.git] / test / utc_convert.cpp
diff --git a/test/utc_convert.cpp b/test/utc_convert.cpp
new file mode 100644 (file)
index 0000000..f9dbb87
--- /dev/null
@@ -0,0 +1,38 @@
+/*******************************************************
+ *  Unit test for the UTC class
+ *
+ * test conversion and formatting of UTC objects
+ ******************************************************
+ *
+ */
+
+#include "date.h"
+#include <assert.h>
+
+int main()
+{
+   String formatted;
+
+   date d1(15, 9, 2002);
+   hour h1(15, 23, 46);
+
+   UTC  u1(d1, h1);
+
+   std::cout << "Contructor with date = 15-9-2002, hour = 15:23:46: " << u1 << "\n";
+   formatted = u1.format();
+   std::cout << "Formatted with default format: " << formatted << "\n";
+   assert(formatted == "2002-09-15 15:23:46");
+
+
+   String s3("23-10-2019 23:45");
+   UTC    u3(s3);
+
+   std::cout << "Contructor from String " << s3 << " : " << u3 << "\n";
+   formatted = u3.format();
+   std::cout << "Formatted with default format: " << formatted << "\n";
+   assert(formatted == "2019-10-23 23:45:00");
+
+
+   return 0;
+}
+