Added test fir now()
authorArjen Baart <arjen@andromeda.nl>
Wed, 25 Sep 2019 04:16:39 +0000 (06:16 +0200)
committerArjen Baart <arjen@andromeda.nl>
Wed, 25 Sep 2019 04:16:39 +0000 (06:16 +0200)
ChangeLog
configure.ac
doc/date.xml
test/Makefile.am
test/date_check_today.cpp
test/hour_check_now.cpp [new file with mode: 0644]
test/hour_now [new file with mode: 0755]

index 86dec94..ead7104 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,8 @@
-Aug 29, 2019 - Release 0.3
+Aug 29, 2019 - Release 0.2
 ============================
 
   - Implemented hour class
-
-Jun 22, 2019 - Release 0.2
-============================
-
-   - Added date class
+  - Implemented date class
 
 May 30, 2019 - Release 0.1
 ============================
index 5657a2b..3c53ac7 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.69])
-AC_INIT([libACL], [0.3], [arjen@androemda.nl])
+AC_INIT([libACL], [0.2], [arjen@androemda.nl])
 AM_INIT_AUTOMAKE([-Wall foreign])
 AC_CONFIG_MACRO_DIRS([m4])
 AC_CONFIG_FILES([Makefile src/Makefile test/Makefile doc/Makefile])
index 50a9579..6c983ff 100644 (file)
@@ -52,7 +52,7 @@ For this date object to be a proper calendar date, the month must be between
 </item>
 <item tag="date(unsigned day, string month, short year)">
 </item>
-<item tag="date(string s)">
+<item tag="date(String s)">
 </item>
 </description>
 </section>
@@ -62,7 +62,7 @@ For this date object to be a proper calendar date, the month must be between
 <description>
 <item tag="operator=(date &amp;d)">
 </item>
-<item tag="operator=(string &amp;s)">
+<item tag="operator=(String &amp;s)">
 Parse string s and extract a day, month and year if the string contains an actual date.
 </item>
 </description>
@@ -106,11 +106,11 @@ The relational operators are defined with obvious meanings:
 <section>
 <heading>Attributes</heading>
 <description>
-<item tag="unsigned day()">
+<item tag="unsigned Day()">
 </item>
-<item tag="unsigned month()">
+<item tag="unsigned Month()">
 </item>
-<item tag="short year()">
+<item tag="short Year()">
 </item>
 </description>
 </section>
index ef02d0f..aeeb56e 100644 (file)
@@ -1,10 +1,10 @@
-TESTS = $(check_PROGRAMS) date_today check_output
+TESTS = $(check_PROGRAMS) date_today hour_now check_output
 
 AM_CPPFLAGS = -I../src
 LDADD = ../src/.libs/libACL.la
 check_PROGRAMS = string_assign string_basics string_compare string_cat string_substring string_regex \
                  date_assign date_parse date_compare date_arithmetic date_attributes date_check_today \
-                 hour_assign hour_parse hour_compare hour_arithmetic
+                 hour_assign hour_parse hour_compare hour_arithmetic hour_check_now
 
 string_assign_SOURCES      = string_assign.cpp
 string_basics_SOURCES      = string_basics.cpp
@@ -27,3 +27,6 @@ hour_assign_SOURCES        = hour_assign.cpp
 hour_parse_SOURCES         = hour_parse.cpp
 hour_compare_SOURCES       = hour_compare.cpp
 hour_arithmetic_SOURCES    = hour_arithmetic.cpp
+hour_check_now_SOURCES     = hour_check_now.cpp
+
+hour_now : hour_check_now
index 5d0d9e0..b47d397 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************
  *  Unit test for the date class
  *
- * test contrustor and assignment of Sting objects
+ * test if the today() function returns the system date
  ******************************************************
  *
  */
diff --git a/test/hour_check_now.cpp b/test/hour_check_now.cpp
new file mode 100644 (file)
index 0000000..e0cb6ba
--- /dev/null
@@ -0,0 +1,27 @@
+/*******************************************************
+ *  Unit test for the hour class
+ *
+ * test if the now() function returns the system date
+ ******************************************************
+ *
+ */
+
+#include "date.h"
+#include <assert.h>
+
+int main(int argc, char *argv[])
+{
+   hour d0;
+
+   if (argc == 2)
+   {
+      String system_date(argv[1]);
+      hour d1(system_date);
+
+      d0 = now();
+      assert(d0 == d1);
+   }
+
+   return 0;
+}
+
diff --git a/test/hour_now b/test/hour_now
new file mode 100755 (executable)
index 0000000..f7a7246
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+STATUS=0
+
+TODAY=`date`
+./hour_check_now "$TODAY"
+exit $?