Re: Regression tests for calendar(1)

2016-07-28 Thread Andy Bradford
Thus said "Andy Bradford" on 28 Jul 2016 02:56:59 -0600:

> Not enough? Different style required? Does the patch need to be broken
> up?

Or  a  different  approach?  Specifically, I  originally  had  in  mind,
a  single  monolithic  input  file  (generated  with  as  many  possible
combinations of rules  as I did in the current  wdout.in) with 366+ test
outputs (one  for each day  of the  year, with maybe  a few more  from a
non-leap year), but wasn't certain if that was necessary.

Thanks,

Andy
-- 
TAI64 timestamp: 4000579a1a60




Regression tests for calendar(1)

2016-07-28 Thread Andy Bradford
Hello,

A few weeks ago I submitted a patch to calendar(1) that helped it handle
fifth  weekday events  and 31st  events, and  afterward, I  noticed that
there were no regression tests. In writing them, I discovered that while
the patch fixed these two particular cases, it broke others. I'll send a
potential  fix which  passes all  the tests  in a  following email.  But
here  is a  potential set  of regressions  and comments/suggestions  are
appreciated.  Are there  too  many tests?  Not  enough? Different  style
required? Does the patch need to be broken up?

Thanks.

Index: Makefile
===
RCS file: /home/cvs/src/regress/usr.bin/Makefile,v
retrieving revision 1.32
diff -u -p -r1.32 Makefile
--- Makefile26 Jul 2015 17:29:41 -  1.32
+++ Makefile28 Jul 2016 08:25:26 -
@@ -1,7 +1,7 @@
 #  $OpenBSD: Makefile,v 1.32 2015/07/26 17:29:41 zhuk Exp $
 #  $NetBSD: Makefile,v 1.1 1997/12/30 23:27:11 cgd Exp $
 
-SUBDIR+= basename bc dc diff diff3 dirname doas file grep gzip
+SUBDIR+= basename bc calendar dc diff diff3 dirname doas file grep gzip
 SUBDIR+= m4 mandoc openssl sdiff sed signify sort tsort
 SUBDIR+= xargs
 
Index: calendar/20160101.wdout
===
RCS file: calendar/20160101.wdout
diff -N calendar/20160101.wdout
--- /dev/null   1 Jan 1970 00:00:00 -
+++ calendar/20160101.wdout 28 Jul 2016 08:25:26 -
@@ -0,0 +1,8 @@
+Jan 01*First Friday
+Jan 01*First Friday in Jan
+Jan 02*First Saturday
+Jan 02*First Saturday in Jan
+Jan 03*First Sunday
+Jan 03*First Sunday in Jan
+Jan 04*First Monday
+Jan 04*First Monday in Jan
Index: calendar/20160114.manout
===
RCS file: calendar/20160114.manout
diff -N calendar/20160114.manout
--- /dev/null   1 Jan 1970 00:00:00 -
+++ calendar/20160114.manout28 Jul 2016 08:25:26 -
@@ -0,0 +1,2 @@
+Jan 14*Every Thursday
+Jan 15*15th of every month
Index: calendar/20160115.wdout
===
RCS file: calendar/20160115.wdout
diff -N calendar/20160115.wdout
--- /dev/null   1 Jan 1970 00:00:00 -
+++ calendar/20160115.wdout 28 Jul 2016 08:25:26 -
@@ -0,0 +1,8 @@
+Jan 15*Third Friday
+Jan 15*Third Friday in Jan
+Jan 16*Third Saturday
+Jan 16*Third Saturday in Jan
+Jan 17*Third Sunday
+Jan 17*Third Sunday in Jan
+Jan 18*Third Monday
+Jan 18*Third Monday in Jan
Index: calendar/20160129.wdout
===
RCS file: calendar/20160129.wdout
diff -N calendar/20160129.wdout
--- /dev/null   1 Jan 1970 00:00:00 -
+++ calendar/20160129.wdout 28 Jul 2016 08:25:26 -
@@ -0,0 +1,9 @@
+Jan 29*Fifth Friday
+Jan 29*Fifth Friday in Jan
+Jan 30*Fifth Saturday
+Jan 30*Fifth Saturday in Jan
+Jan 31*Fifth Sunday
+Jan 31*Fifth Sunday in Jan
+Feb 01*First Monday
+Feb 01*First Monday in Feb
+Feb 01*Fifth Monday in Jan
Index: calendar/20160131.monout
===
RCS file: calendar/20160131.monout
diff -N calendar/20160131.monout
--- /dev/null   1 Jan 1970 00:00:00 -
+++ calendar/20160131.monout28 Jul 2016 08:25:26 -
@@ -0,0 +1,3 @@
+Jan 31*Every Sunday
+Feb 01*First of Month
+Feb 01*Every Monday
Index: calendar/20160201.wdout
===
RCS file: calendar/20160201.wdout
diff -N calendar/20160201.wdout
--- /dev/null   1 Jan 1970 00:00:00 -
+++ calendar/20160201.wdout 28 Jul 2016 08:25:26 -
@@ -0,0 +1,6 @@
+Feb 01*First Monday
+Feb 01*First Monday in Feb
+Feb 01*Fifth Monday in Jan
+Feb 02*First Tuesday
+Feb 02*First Tuesday in Feb
+Feb 02*Fifth Tuesday in Jan
Index: calendar/20160203.wdout
===
RCS file: calendar/20160203.wdout
diff -N calendar/20160203.wdout
--- /dev/null   1 Jan 1970 00:00:00 -
+++ calendar/20160203.wdout 28 Jul 2016 08:25:26 -
@@ -0,0 +1,6 @@
+Feb 03*First Wednesday
+Feb 03*First Wednesday in Feb
+Feb 03*Fifth Wednesday in Jan
+Feb 04*First Thursday
+Feb 04*First Thursday in Feb
+Feb 04*Fifth Thursday in Jan
Index: calendar/20160229.wdout
===
RCS file: calendar/20160229.wdout
diff -N calendar/20160229.wdout
--- /dev/null   1 Jan 1970 00:00:00 -
+++ calendar/20160229.wdout 28 Jul 2016 08:25:26 -
@@ -0,0 +1,5 @@
+Feb 29*Fifth Monday
+Feb 29*Fifth Monday in Feb
+Mar 01*First Tuesday
+Mar 01*