- date: test parser for invalid dates and syntax errors
- date: Parser for stream input
+- date: Weekday and week number
-- Include classes: time, complex, integer
+- Include classes: UTC, complex, integer
+- UTC: Convert to and from time_t, struct tm
-TESTS = $(check_PROGRAMS) check_output
+TESTS = $(check_PROGRAMS) date_today 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_assign date_parse date_compare date_arithmetic date_attributes date_check_today
string_assign_SOURCES = string_assign.cpp
string_basics_SOURCES = string_basics.cpp
date_parse_SOURCES = date_parse.cpp
date_compare_SOURCES = date_compare.cpp
date_arithmetic_SOURCES = date_arithmetic.cpp
+date_attributes_SOURCES = date_attributes.cpp
+date_check_today_SOURCES = date_check_today.cpp
+
+date_today : date_check_today
--- /dev/null
+/*******************************************************
+ * Unit test for the date class
+ *
+ * test date attribute functions
+ ******************************************************
+ *
+ */
+
+#include "date.h"
+#include <assert.h>
+
+int main()
+{
+ date d0(9, 6, 2019);
+
+ std::cout << d0 << " Day = " << d0.Day() << "\n";
+ assert(d0.Day() == 9);
+
+ std::cout << d0 << " Month = " << d0.Month() << "\n";
+ assert(d0.Month() == 6);
+
+ std::cout << d0 << " Monthname = " << d0.MonthName() << "\n";
+ assert(d0.MonthName() == "Jun");
+
+ std::cout << d0 << " Year = " << d0.Year() << "\n";
+ assert(d0.Year() == 2019);
+
+ std::cout << d0 << " Leap = " << d0.Leap() << "\n";
+ assert(d0.Leap() == 0);
+
+ date d1(9, 6, 2020);
+ std::cout << d1 << " Leap = " << d1.Leap() << "\n";
+ assert(d1.Leap() == 1);
+
+ date d2(9, 6, 2000);
+ std::cout << d2 << " Leap = " << d2.Leap() << "\n";
+ assert(d2.Leap() == 1);
+
+ date d3(9, 6, 2100);
+ std::cout << d3 << " Leap = " << d3.Leap() << "\n";
+ assert(d3.Leap() == 0);
+
+ date d4(1, 1, 2019);
+ std::cout << d4.MonthName() << " " << d4.Year() << " has " << d4.DaysInMonth() << " days.\n";
+ assert(d4.DaysInMonth() == 31);
+
+ date d5(1, 2, 2019);
+ std::cout << d5.MonthName() << " " << d5.Year() << " has " << d5.DaysInMonth() << " days.\n";
+ assert(d5.DaysInMonth() == 28);
+
+ date d6(1, 2, 2020);
+ std::cout << d6.MonthName() << " " << d6.Year() << " has " << d6.DaysInMonth() << " days.\n";
+ assert(d6.DaysInMonth() == 29);
+
+ return 0;
+}
+
--- /dev/null
+/*******************************************************
+ * Unit test for the date class
+ *
+ * test contrustor and assignment of Sting objects
+ ******************************************************
+ *
+ */
+
+#include "date.h"
+#include <assert.h>
+
+int main(int argc, char *argv[])
+{
+ date d0;
+
+ if (argc == 2)
+ {
+ String system_date(argv[1]);
+ date d1(system_date);
+
+ d0 = today();
+ assert(d0 == d1);
+ }
+
+ return 0;
+}
+
--- /dev/null
+#!/bin/bash
+
+STATUS=0
+
+TODAY=`date`
+./date_check_today "$TODAY"
+exit $?