Gregorian calendar program (fix)

William McKeeman mckeeman at wanginst.UUCP
Sat Jan 18 08:43:30 AEST 1986


This is a resubmission of greg, a program to compute dates by the gregorian
calendar.  Many thanks to those who pointed out errors in the previous
version.  (The problem was some wrongheaded algebraic simplification.)  While
I know of no errors in this version, it is very new code and there are about
10**11 valid input patterns.  The 100 or so tests included don't make much of
a dent in that.  Please send bugs and complaints to the address below.

W. M. McKeeman            mckeeman at WangInst
Wang Institute            decvax!wanginst!mckeeman
Tyngsboro MA 01879
-----------------------------cut here-------------------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	gregorian.1
#	makefile
#	gregorian.c
#	test.exe
#	test.author
# This archive created: Fri Jan 17 17:28:52 1986
export PATH; PATH=/bin:$PATH
echo shar: extracting "'gregorian.1'" '(6664 characters)'
if test -f 'gregorian.1'
then
	echo shar: will not over-write existing file "'gregorian.1'"
else
sed 's/^	X//' << \SHAR_EOF > 'gregorian.1'
	X.TH GREG 1 local
	X.SH NAME
	Xgreg \- compute details of Gregorian calendar
	X.SH SYNTAX
	X.B "greg Year Month DayOfMonth [DayOfWeek WeekOfMonth DayOfYear JulianDay]"
	X.SH SYNOPSIS
	X.I Greg
	Xprovides calendar information.
	XIt approximates the functionality of unix cal except that the information
	Xis provided in a way that is appropriate for use in other programs 
	Xrather than visual display.
	X.PP
	XThe internal function "gregorian" is designed to be used as a component
	Xof other programs.
	X.SH DESCRIPTION
	XThe program is invertible in the sense of a logic programming predicate.
	XThat is, inputs with positive values are checked for consistency;
	Xmissing inputs (indicated by otherwise illegal value 0) are given
	Xthe correct positive value if possible.
	X.PP
	XIf all the output is correct, the program will exit with 0.
	X.PP
	XIf the input cannot be reconciled, the program will exit with 1.
	X.PP
	XIf the input leaves the output indeterminate, the program will exit with 2.
	X.PP
	XIf the C implementation cannot support the calculation because of
	Xarithmetic precision, the program will exit with 3.
	X.SH PARAMETERS
	XThere are seven related inputs.
	XInputs 1-3 are required.
	XIf inputs 4-7 are omitted, zero is assumed for each.
	X.PP
	XThe
	X.I Year
	Xis an integer >=
	X.I 1582
	X.PP
	XThe
	X.I Month
	Xis an integer between
	X.I 1
	Xand
	X.I 12.
	X.PP
	XThe
	X.I DayOfMonth
	Xis an integer between 
	X.I 1
	Xand
	X.I 28, 29, 30
	Xor
	X.I 31
	Xdepending on the month.
	X.PP
	XThe
	X.I DayOfWeek
	Xis an integer between
	X.I 1
	Xand
	X.I 7
	Xcorresponding to
	X.I
	XSunday, Monday, ... Saturday.
	XIt is the column position of
	Xthe date in the conventional monthly calendar tableau.
	X.PP
	XThe
	X.I WeekOfMonth
	Xis an integer between
	X.I 1
	Xand
	X.I 6
	Xcorresponding to weeks in the calendar month.
	XIt is the row position of the date
	Xin the conventional monthly calendar tableau.
	XThe first of the month is always in week
	X.I 1.
	X.PP
	XThe
	X.I DayOfYear
	Xis an integer between
	X.I 1
	Xand
	X.I 365
	Xor
	X.I 366
	X.PP
	XThe
	X.I JulianDay
	Xis an integer >=
	X.I
	X2299161,
	Xcorresponding to
	X.I
	X15 October, 1582.
	XIt measures the time in days from 1 Jan 4713 BC (Julian calendar).
	XEach julian day starts at noon, GMT of the corresponding day of the Gregorian
	Xcalendar.  Astronomers express the relation between julian day j and date d as
	Xdd.5/mm/yyyy = j.0 where both "day"s are real numbers.  dd.5 is noon of day
	Xdd.  j.0 is the beginning of julian day j.
	X.bp
	XThere are four patterns of input for the seven parameters
	Xthat can possibly give a correct result.
	XThey are given below.
	XP signifies positive integer (an input).
	X? signifies either 0 (an unknown) or a positive integer (an input).
	X.nf
	X.ta 1i +2n +2n +2n +2n +2n 
	X	P	P	P	?	-- year
	X	P	?	P	?	-- month of year
	X	P	?	?	?	-- day of month
	X	?	?	P	?	-- day of week
	X	?	?	P	?	-- week of month
	X	?	P	?	?	-- day of year
	X	?	?	?	P	-- julian day
	X.fi
	X.SH FILES
	Xnone
	X.SH METHOD
	X.PP
	XThe Gregorian Calendar was adopted starting October 15, 1582
	X(September 14, 1752 in Britain and her colonies).
	XDates prior to adoption were in the Julian Calendar system
	X(no relation to julian days).
	XDates before the conversion are denoted OS (old system);
	Xdates after the conversion are denoted NS (new system).
	XThis program will extrapolate Gregorian dates back to 1 AD
	Xalthough it will issue a warning (inconsistent) for dates prior to the
	Xadoption of the Gregorian calendar.
	X1 BC OS immediately preceded 1 AD OS (no year 0)
	Xso the algorithms are invalid, even for extrapolation, prior to 1 AD.
	X.PP
	XThe algorithms, some from the references below, are tableless.
	XThe collection given here is valid from January 1, 1 AD NS.
	XThe algorithms, which depend on a number of
	X.I ad hoc
	Xfunctions over integers,
	Xare cryptic but the alternative of using tables does not help much.
	XThe notation is C.
	XLogical values are to be interpreted as 1 == true and 0 == false.
	XWhere it is supposed that the names of the functions
	Xare not sufficiently mnemonic, an italic comment is appended.
	XThe code in gregorian.c is algebraically simplified where
	Xpossible when the functions below are back substituted into
	Xother defining formulas.
	XMore than one version is given for some formulas.
	X.nf
	X.ta 2i
	X
	X    LeapsBefore(y) ==  (y-1)/4 - (y-1)/100 + (y-1)/400    \fI leap years between 1 AD and year y\fP
	X
	X    Leap(y) == LeapsBefore(y+1) - LeapsBefore(y)
	X
	X    Leap(y) == y%400 == 0 || (y%100 != 0 && y%4 == 0)
	X
	X    StonesNumber(y, yd) == (yd + (yd>59+Leap(y))*(2-Leap(y)) + 91)*100
	X
	X    DaysInYearBefore(m, y) == 3055*(m+2)/100 - 91 - (m>2)*(2-Leap(y))
	X
	X    DayOfYear(y, m, d) == DaysInYearBefore(m, y) + d
	X
	X    MonthOfYear(y, yd) == StonesNumber(y, yd)/3055 - 2
	X
	X    DayOfMonth(y, yd) == StonesNumber(y, yd)%3055/100 + 1
	X
	X    DaysInYear(y) == 365 + Leap(y)
	X
	X    DaysInYear(y) == DaysInYearBefore(13, y)
	X
	X    DaysInMonth(m, y) == ((m == 2) ? 28+Leap(y) : 30+(m==1 || m%5%3 != 1))
	X
	X    DaysInMonth(m, y) == DaysInYearBefore(m+1, y) - DaysInYearBefore(m, y) 
	X
	X    JulianDaysB4(y) == (y-1)*365 + LeapsBefore(y) + 1721425
	X
	X    JulianDay(y, m, d) == JulianDaysBefore(y) + DayOfYear(y, m, d)
	X
	X    YearOf(jd) = 1 + (jd-=(17214256), jd-=(jd+1)/146097, jd+=(jd+1)/36524, jd-(jd+1)/1461)/365
	X.I
	X	year in which julian day jd occurs
	X    DayOf(jd) == jd - JulianDaysBefore(YearOf(jd))
	X.I
	X	given the julian day jd, day of year from 1 Jan
	X
	X    WeekDay(jd) = (jd+1)%7+1    \fI	Sunday = 1, etc\. \fP
	X
	X    Week(dm, dw) = (13 + dm - dw)/7
	X.I
	X	week of month from day of month and day of week
	X.fi
	X.SH LIMITS
	XInputs are converted by
	X.I atoi
	Xwhich does not check for non-digits.
	XThe julian day is, by definition, bounded from below by 2299161
	X(15 October, 1582).
	XThe program will fail for implementations of C with
	X.I
	Xsizeof (long int) < 4.
	XThere is no practical upper limit on year or julian day.
	XThe program extrapolates backward correctly to January 1, 1 AD NS
	Xbut reports the input is "inconsistent" prior to October 15, 1582.
	X.SH SEE ALSO
	X1. Any almanac, under calendar, perpetual.
	X(Note the World Almanac (1985, 1986) gives a julian day incorrect by one). 
	X.PP
	X2. Any encyclopedia, under calendar.
	X.PP
	X3. The Astronomical Ephemeris (any year)
	X.PP
	X3. CAL(1).  The information supplied by greg corresponds to cal starting
	XSeptember 14, 1752 AD.
	X.PP
	X4. Elmore, Perpetual Calendar, Am.J.Phys.44,3 (May 1976) pp 482-3.
	X.PP
	X5. Fliegel & Van Flandern, A Machine Algorithm for Processing Calendar
	XDates, (letter to the editor) CACM 11,10 (October 1968) pg. 657.
	X.PP
	X6. Stone, Tableless Date Conversion. Algorithm 398. Collected Algorithms from
	Xthe CACM (rcvd Jan 1970) and a Remark by Robertson (rcvd Dec 1970).
	X.PP
	X7. Tantzen, Conversions Between Calendar Date and Julian Day Number,
	XAlgorithm 199. Collected Algorithms from the CACM (August 1963).
	X.PP
	X8. Uspensky & Heaslet, Elementary Number Theory, McGraw-Hill, (1939) p.206-221.
SHAR_EOF
if test 6664 -ne "`wc -c < 'gregorian.1'`"
then
	echo shar: error transmitting "'gregorian.1'" '(should have been 6664 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'makefile'" '(677 characters)'
if test -f 'makefile'
then
	echo shar: will not over-write existing file "'makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'makefile'
	X# Makefile for "greg" -- W. M. McKeeman -- Wang Institute -- 1985
	X# Assuming you have unshared all of this,
	X# make greg
	X# will compile greg and
	X# make man
	X# will produce the manual page.
	X# make test
	X# will compare greg's output with some results prepared by the author
	X
	Xgreg:	gregorian.c
	X	cc -o greg gregorian.c
	X
	Xtest:	greg test.exe test.author
	X	test.exe > test.results
	X	diff test.results test.author
	X	echo "all tests passed"
	X
	Xman:	gregorian.1
	X	nroff -man gregorian.1 > gregorian.man
	X
	Xlaser:	gregorian.1
	X	iroff -man gregorian.1
	X
	Xfornet:	gregorian.1 makefile gregorian.c test.exe
	X	test.exe > test.author
	X	@shar -a gregorian.1 makefile gregorian.c test.exe test.author > fornet
	X
SHAR_EOF
if test 677 -ne "`wc -c < 'makefile'`"
then
	echo shar: error transmitting "'makefile'" '(should have been 677 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'gregorian.c'" '(4998 characters)'
if test -f 'gregorian.c'
then
	echo shar: will not over-write existing file "'gregorian.c'"
else
sed 's/^	X//' << \SHAR_EOF > 'gregorian.c'
	X/************************************************************************/
	X/* Program:     greg                                                    */
	X/* Purpose:     compute and verify information for Gregorian calendar   */
	X/* Copyright:   W. M. McKeeman 1986.  This program may be used or 	*/
	X/*		modified for any purpose so long as this copyright	*/
	X/*		notice is incorporated in the resulting source code.	*/
	X/* Input:       year, month, day                                        */
	X/*              day of month week & year, week of month, julian day.    */
	X/*              input values are zero (meaning "to be computed") or     */
	X/*              positive integers (meaning "to be checked and used")    */
	X/* Output:      consistent positive values for input:                   */
	X/*              return 0 if all output is valid,                        */
	X/*              return 1 if input is inconsistent,                      */
	X/*              return 2 if input is incomplete,                        */
	X/*              return 3 if int or long int is too short.               */
	X/* Example:                                                             */
	X/*   y = 1985; m = 12; d = 10; wd = 0; wk = 0; yd = 0;   jd = 0;        */
	X/*   gregorian(&y, &m, &d, &wd, &wk, &yd, &jd) returns 0 and leaves:    */
	X/*   y = 1985; m = 12; d = 10; wd = 3; wk = 2; yd = 344; jd = 2446410;  */
	X/* Method:        tableless.  see man page                              */
	X/************************************************************************/
	X#include <stdio.h>
	X
	X#define success 0
	X#define inconsistent 1
	X#define incomplete 2
	X#define systemfailure 3
	X
	X#define defined(e) ((e) != 0)
	X#define makeconsistent(v1, v2) \
	X    {if (defined(v1) && (v1) != (v2)) return inconsistent; else (v1) = (v2);}
	X#define LeapsB4(y) (((y)-1)/4 - ((y)-1)/100 + ((y)-1)/400)
	X
	X#define AD0001Jan00        1721425L
	X#define AD1582Oct15        2299161L
	X#define AD14699Nov15       7090078L
	X
	Xint
	Xgregorian(year, month, day0month, day0week, week0month, day0year, julianDay)
	Xint *year, *month, *day0month, *day0week, *week0month, *day0year;
	Xlong int *julianDay;                            /* 7 significant digits */
	X{
	X    int d, w, m, y, ly, leaps;
	X    long int td, jd;
	X    if defined(*julianDay) {
	X        jd = *julianDay;
	X        if (jd <= AD0001Jan00) return inconsistent;
	X        td = jd - AD0001Jan00 - 1;
	X        y = 1 + (td -= (td+1)/146097, td += (td+1)/36524, td-(td+1)/1461)/365;
	X        makeconsistent(*year, y);
	X        d = jd - ((y-1)*365 + LeapsB4(y) + AD0001Jan00);
	X        makeconsistent(*day0year, d);
	X    }
	X
	X    if (!defined(*year)) return incomplete; else y = *year;
	X    leaps = LeapsB4(y);
	X    ly = y%400 == 0 || (y%100 != 0 && y%4 == 0);
	X
	X    if (!defined(*day0year)) {
	X        if (!defined(*month)) return incomplete;
	X        if (!defined(*day0month)) {
	X            if (!defined(*day0week)||!defined(*week0month))return incomplete;
	X            *day0month = 7*(*week0month-1) + *day0week - 
	X                (y+leaps+3055L*(*month+2)/100-84-(*month>2)*(2-ly))%7;
	X        }
	X        *day0year = 3055L*(*month+2)/100 - 91 + *day0month - (*month>2)*(2-ly);
	X    }
	X
	X    td = (*day0year + (*day0year>59+ly)*(2-ly) + 91)*100L;
	X    m = td/3055 - 2;
	X    makeconsistent(*month, m);
	X    d = td%3055/100 + 1;
	X    makeconsistent(*day0month, d);
	X
	X    jd = AD0001Jan00 + (y-1)*365 + LeapsB4(y) + *day0year;
	X    makeconsistent(*julianDay, jd);
	X    w = (jd+1)%7 + 1;
	X    makeconsistent(*day0week, w);
	X    w = (13 + *day0month - *day0week)/7;
	X    makeconsistent(*week0month, w);
	X
	X    return *month > 12 || *julianDay < AD1582Oct15 || *day0month >
	X        (*month == 2 ? 28+ly : 30+(*month == 1 || *month%5%3 != 1));
	X}
	X
	Xmain(argc, argv)                                /* driver for gregorian */
	Xint argc; char *argv[];
	X{
	X    int r, i, p[7];
	X    long int jd;                                /* 7 significant digits */
	X
	X    if (sizeof (long int) < 4 || sizeof (int) < 2) r = systemfailure;
	X    else if (argc > 8) r = inconsistent;        /* too many inputs      */
	X    else if (argc < 4) r = incomplete;          /* need y m d at least  */
	X    else {
	X        r = success;
	X        for (i=1;i<=6;i++) {
	X            p[i] = i < argc ? atoi(argv[i]) : 0;
	X            if (p[i] < 0) r = inconsistent;     /* no negative input    */
	X        }
	X        jd = argc == 8 ? atol(argv[7]) : 0L;    /* julian day is (long) */
	X        if (r != inconsistent)
	X            r = gregorian(&p[1], &p[2], &p[3], &p[4], &p[5], &p[6], &jd);
	X    }
	X
	X    switch (r) {
	X    case inconsistent:
	X        puts("greg: input does not describe a valid gregorian date");
	X    case success:
	X        printf("%d %d %d %d %d %d %ld\n", p[1],p[2],p[3],p[4],p[5],p[6],jd);
	X        break;
	X    case incomplete:
	X        puts("greg: insufficient information");
	X        puts("usage: greg year month day [day0week week0month day0year jd]");
	X        break;
	X    case systemfailure:
	X        puts("greg: insufficient precision in either (int) or (long int)");
	X        break;
	X    }
	X    exit(r);
	X}
SHAR_EOF
if test 4998 -ne "`wc -c < 'gregorian.c'`"
then
	echo shar: error transmitting "'gregorian.c'" '(should have been 4998 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'test.exe'" '(15378 characters)'
if test -f 'test.exe'
then
	echo shar: will not over-write existing file "'test.exe'"
else
sed 's/^	X//' << \SHAR_EOF > 'test.exe'
	X#!/bin/sh
	X# tests of program greg  (Bourne shell script)
	X
	Xcal 12 1985 # delete this line if you don't have cal to run
	Xecho smoke test
	Xecho greg 1985	12	10  # birthday for this program
	Xgreg 1985	12	10  # birthday for this program
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho test input validity checking capability
	Xecho 1985	12	10	  3	2	   344	2446410
	Xgreg 1985	12	10	  3	2	   344	2446410
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho test various input inversions
	Xecho 1985	 0	 0	  0	0	   344	0
	Xgreg 1985	 0	 0	  0	0	   344	0
	Xecho $? -----end of test---------------------------------------------------
	Xecho 0		 0	 0	  0	0	   0	2446410
	Xgreg 0		 0	 0	  0	0	   0	2446410
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	 0	  3	1	   0	
	Xgreg 1985	12	 0	  3	1	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	 0	  3	2	   0	
	Xgreg 1985	12	 0	  3	2	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	 0	  3	3	   0	
	Xgreg 1985	12	 0	  3	3	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	 0	  3	4	   0	
	Xgreg 1985	12	 0	  3	4	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	 0	  3	5	   0	
	Xgreg 1985	12	 0	  3	5	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	 0	  3	6	   0	
	Xgreg 1985	12	 0	  3	6	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	 0	  3	7	   0	
	Xgreg 1985	12	 0	  3	7	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	 0	  7	6	   0	
	Xgreg 1985	12	 0	  7	6	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	11	 0	  1	1	   0	
	Xgreg 1985	11	 0	  1	1	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	10	  3	0	   344	
	Xgreg 1985	12	10	  3	0	   344	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	10	  0	2	   0	
	Xgreg 1985	12	10	  0	2	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	10	  0	3	   0	
	Xgreg 1985	12	10	  0	3	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	10	  2	0	   0	
	Xgreg 1985	12	10	  2	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	10	  0	0	   344	
	Xgreg 1985	12	10	  0	0	   344	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	 0	  0	0	   344	
	Xgreg 1985	12	 0	  0	0	   344	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	 0	10	  0	0	   344	
	Xgreg 1985	 0	10	  0	0	   344	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	10	  0	0	   345	
	Xgreg 1985	12	10	  0	0	   345	
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho test first of a bunch of months
	Xecho 1985	 1	 1	  0	0	   0	
	Xgreg 1985	 1	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	 2	 1	  0	0	   0	
	Xgreg 1985	 2	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	 3	 1	  0	0	   0	
	Xgreg 1985	 3	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	 4	 1	  0	0	   0	
	Xgreg 1985	 4	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	 5	 1	  0	0	   0	
	Xgreg 1985	 5	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	 6	 1	  0	0	   0	
	Xgreg 1985	 6	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	 7	 1	  0	0	   0	
	Xgreg 1985	 7	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	 8	 1	  0	0	   0	
	Xgreg 1985	 8	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	 9	 1	  0	0	   0	
	Xgreg 1985	 9	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	10	 1	  0	0	   0	
	Xgreg 1985	10	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	11	 1	  0	0	   0	
	Xgreg 1985	11	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1985	12	 1	  0	0	   0	
	Xgreg 1985	12	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho test funny leap years
	Xcal 3 2000 # delete this line if you don't have cal to run
	Xecho 2000	 3	 1	  0	0	   0	
	Xgreg 2000	 3	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xcal 3 1900 # delete this line if you don't have cal to run
	Xecho 1900	 3	 1	  0	0	   0	
	Xgreg 1900	 3	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xcal 3 1952 # delete this line if you don't have cal to run
	Xecho 1952	 3	 1	  0	0	   0	
	Xgreg 1952	 3	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xcal 3 1953 # delete this line if you don't have cal to run
	Xecho 1953	 3	 1	  0	0	   0	
	Xgreg 1953	 3	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xcal 3 1954 # delete this line if you don't have cal to run
	Xecho 1954	 3	 1	  0	0	   0	
	Xgreg 1954	 3	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho test first and last day
	Xcal 1984 # delete this line if you don't have cal to run
	Xecho 1984	 1	 1	  0	0	   0	
	Xgreg 1984	 1	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	12	31	  0	0	   0	
	Xgreg 1984	12	31	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 0	 0	  0	0	   1	
	Xgreg 1984	 0	 0	  0	0	   1	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 0	 0	  0	0	   366	
	Xgreg 1984	 0	 0	  0	0	   366	
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho violate various calendar limitations
	Xecho 1984	 0	 0	  0	0	   367	
	Xgreg 1984	 0	 0	  0	0	   367	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	13	 1	  0	0	   0	
	Xgreg 1984	13	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho thoroughly test a February
	Xecho 1984	 2	 1	  0	0	   0	
	Xgreg 1984	 2	 1	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	 2	  0	0	   0	
	Xgreg 1984	 2	 2	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	 3	  0	0	   0	
	Xgreg 1984	 2	 3	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	 4	  0	0	   0	
	Xgreg 1984	 2	 4	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	 5	  0	0	   0	
	Xgreg 1984	 2	 5	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	 6	  0	0	   0	
	Xgreg 1984	 2	 6	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	 7	  0	0	   0	
	Xgreg 1984	 2	 7	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	 8	  0	0	   0	
	Xgreg 1984	 2	 8	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	 9	  0	0	   0	
	Xgreg 1984	 2	 9	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	10	  0	0	   0	
	Xgreg 1984	 2	10	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	11	  0	0	   0	
	Xgreg 1984	 2	11	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	12	  0	0	   0	
	Xgreg 1984	 2	12	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	13	  0	0	   0	
	Xgreg 1984	 2	13	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	14	  0	0	   0	
	Xgreg 1984	 2	14	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	15	  0	0	   0	
	Xgreg 1984	 2	15	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	16	  0	0	   0	
	Xgreg 1984	 2	16	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	17	  0	0	   0	
	Xgreg 1984	 2	17	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	18	  0	0	   0	
	Xgreg 1984	 2	18	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	19	  0	0	   0	
	Xgreg 1984	 2	19	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	20	  0	0	   0	
	Xgreg 1984	 2	20	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	21	  0	0	   0	
	Xgreg 1984	 2	21	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	22	  0	0	   0	
	Xgreg 1984	 2	22	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	23	  0	0	   0	
	Xgreg 1984	 2	23	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	24	  0	0	   0	
	Xgreg 1984	 2	24	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	25	  0	0	   0	
	Xgreg 1984	 2	25	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	26	  0	0	   0	
	Xgreg 1984	 2	26	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	27	  0	0	   0	
	Xgreg 1984	 2	27	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	28	  0	0	   0	
	Xgreg 1984	 2	28	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	29	  0	0	   0	
	Xgreg 1984	 2	29	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho should fail
	Xecho 1985	 2	29	  0	0	   0	
	Xgreg 1985	 2	29	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	30	  0	0	   0	
	Xgreg 1984	 2	30	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	Xecho test around March 1 and invert wrt julian day
	Xecho 1984	 0	 0	  0	0	   59	
	Xgreg 1984	 0	 0	  0	0	   59	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 0		 0	 0	  0	0	    0	2445759
	Xgreg 0		 0	 0	  0	0	    0	2445759
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 0	 0	  0	0	   60	
	Xgreg 1984	 0	 0	  0	0	   60	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 0		 0	 0	  0	0	    0	2445760
	Xgreg 0		 0	 0	  0	0	    0	2445760
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 0	 0	  0	0	   61	
	Xgreg 1984	 0	 0	  0	0	   61	
	Xecho $? -----end of test---------------------------------------------------
	Xecho 0		 0	 0	  0	0	    0	2445761
	Xgreg 0		 0	 0	  0	0	    0	2445761
	Xecho $? -----end of test---------------------------------------------------
	Xecho 1984	 2	 0	  0	0	   61	
	Xgreg 1984	 2	 0	  0	0	   61	
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho known Julian Days
	Xecho '2446066.5  == Jan 1.0 1985 GMT: the Astronomical Ephemeris'
	Xecho "2446065.5  == 0000 hours Jan 0 1985:  Observer's Handbook 1985 pg 20"
	Xecho '2446065    == 12n GMT 12/31/84: 1985 World Almanac pg 751 (wrong)'
	Xecho 1984	 12	 31	  0	0	   0	2446066
	Xgreg 1984	 12	 31	  0	0	   0	2446066
	Xecho $? -----end of test---------------------------------------------------
	Xecho '2446430    == 12n GMT 12/31/85: 1986 World Almanac pg 751 (wrong)'
	Xecho 1985	 12	 31	  0	0	   0	2446430
	Xgreg 1985	 12	 31	  0	0	   0	2446430
	Xecho $? -----end of test---------------------------------------------------
	Xcal 3 1900 # delete this line if you don't have cal to run
	Xecho 'from Tantzen paper k=1'
	Xecho 1900	 3	 1	  0	0	   0	2415080
	Xgreg 1900	 3	 1	  0	0	   0	2415080
	Xecho $? -----end of test---------------------------------------------------
	Xcal 12 1999 # delete this line if you don't have cal to run
	Xecho 'from Tantzen paper k=36465'
	Xecho 1999	 12	 31	  0	0	   0	2451544
	Xgreg 1999	 12	 31	  0	0	   0	2451544
	Xecho $? -----end of test---------------------------------------------------
	Xecho '2440587.5 == Jan 1.0 1970 GMT: Astronomical Ephemeris'
	Xecho '2440588   == 12n 1/1/70: Fliegel paper'
	Xcal 1 1970 # delete this line if you don't have cal to run
	Xecho 1970	 1	 1	  0	0	   0	2440588
	Xgreg 1970	 1	 1	  0	0	   0	2440588
	Xecho $? -----end of test---------------------------------------------------
	Xecho '2305813   == Bhaskar correction to error in submitted version'
	Xecho 1600	12	31	  0	0	   0	2305813
	Xgreg 1600	12	31	  0	0	   0	2305813
	Xecho $? -----end of test---------------------------------------------------
	Xecho 0		 0	 0	  0	0	   0	2305812
	Xgreg 0		 0	 0	  0	0	   0	2305812
	Xecho $? -----end of test---------------------------------------------------
	Xecho 0		 0	 0	  0	0	   0	2305813
	Xgreg 0		 0	 0	  0	0	   0	2305813
	Xecho $? -----end of test---------------------------------------------------
	Xecho 0		 0	 0	  0	0	   0	2305814
	Xgreg 0		 0	 0	  0	0	   0	2305814
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho white box magic constants
	Xecho Jan 0 0001 +- 1
	Xecho 	0	 0	 0	  0	0	   0	1721424
	Xgreg 	0	 0	 0	  0	0	   0	1721424
	Xecho $? -----end of test---------------------------------------------------
	Xecho 	0	 0	 0	  0	0	   0	1721425
	Xgreg 	0	 0	 0	  0	0	   0	1721425
	Xecho $? -----end of test---------------------------------------------------
	Xecho 	0	 0	 0	  0	0	   0	1721426
	Xgreg 	0	 0	 0	  0	0	   0	1721426
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho Oct 15 1582 +-1
	Xecho 	0	 0	 0	  0	0	   0	2299160
	Xgreg 	0	 0	 0	  0	0	   0	2299160
	Xecho $? -----end of test---------------------------------------------------
	Xecho 	0	 0	 0	  0	0	   0	2299161
	Xgreg 	0	 0	 0	  0	0	   0	2299161
	Xecho $? -----end of test---------------------------------------------------
	Xecho 	0	 0	 0	  0	0	   0	2299162
	Xgreg 	0	 0	 0	  0	0	   0	2299162
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho try a very big year just for the fun of it
	Xecho 	5000000 1 1
	Xgreg 	5000000 1 1
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho test bad parameters
	Xecho	no parameters					
	Xgreg	# empty					
	Xecho $? -----end of test---------------------------------------------------
	Xecho    1	 0	 0	  0	0	   0	    0	0 # too many
	Xgreg    1	 0	 0	  0	0	   0	    0	0
	Xecho $? -----end of test---------------------------------------------------
	Xecho   -1	 0	 0	  0	0	   0	# negative year
	Xgreg   -1	 0	 0	  0	0	   0	
	Xecho $? -----end of test---------------------------------------------------
	X
	Xecho 'end of tests'
SHAR_EOF
if test 15378 -ne "`wc -c < 'test.exe'`"
then
	echo shar: error transmitting "'test.exe'" '(should have been 15378 characters)'
fi
chmod +x 'test.exe'
fi # end of overwriting check
echo shar: extracting "'test.author'" '(16307 characters)'
if test -f 'test.author'
then
	echo shar: will not over-write existing file "'test.author'"
else
sed 's/^	X//' << \SHAR_EOF > 'test.author'
	X   December 1985
	X S  M Tu  W Th  F  S
	X 1  2  3  4  5  6  7
	X 8  9 10 11 12 13 14
	X15 16 17 18 19 20 21
	X22 23 24 25 26 27 28
	X29 30 31
	X
	Xsmoke test
	Xgreg 1985 12 10
	X1985 12 10 3 2 344 2446410
	X0 -----end of test---------------------------------------------------
	Xtest input validity checking capability
	X1985 12 10 3 2 344 2446410
	X1985 12 10 3 2 344 2446410
	X0 -----end of test---------------------------------------------------
	Xtest various input inversions
	X1985 0 0 0 0 344 0
	X1985 12 10 3 2 344 2446410
	X0 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 2446410
	X1985 12 10 3 2 344 2446410
	X0 -----end of test---------------------------------------------------
	X1985 12 0 3 1 0
	X1985 12 3 3 1 337 2446403
	X0 -----end of test---------------------------------------------------
	X1985 12 0 3 2 0
	X1985 12 10 3 2 344 2446410
	X0 -----end of test---------------------------------------------------
	X1985 12 0 3 3 0
	X1985 12 17 3 3 351 2446417
	X0 -----end of test---------------------------------------------------
	X1985 12 0 3 4 0
	X1985 12 24 3 4 358 2446424
	X0 -----end of test---------------------------------------------------
	X1985 12 0 3 5 0
	X1985 12 31 3 5 365 2446431
	X0 -----end of test---------------------------------------------------
	X1985 12 0 3 6 0
	Xgreg: input does not describe a valid gregorian date
	X1985 12 38 3 6 372 0
	X1 -----end of test---------------------------------------------------
	X1985 12 0 3 7 0
	Xgreg: input does not describe a valid gregorian date
	X1985 12 45 3 7 379 0
	X1 -----end of test---------------------------------------------------
	X1985 12 0 7 6 0
	Xgreg: input does not describe a valid gregorian date
	X1985 12 42 7 6 376 0
	X1 -----end of test---------------------------------------------------
	X1985 11 0 1 1 0
	Xgreg: input does not describe a valid gregorian date
	X1985 11 -4 1 1 300 0
	X1 -----end of test---------------------------------------------------
	X1985 12 10 3 0 344
	X1985 12 10 3 2 344 2446410
	X0 -----end of test---------------------------------------------------
	X1985 12 10 0 2 0
	X1985 12 10 3 2 344 2446410
	X0 -----end of test---------------------------------------------------
	X1985 12 10 0 3 0
	Xgreg: input does not describe a valid gregorian date
	X1985 12 10 3 3 344 2446410
	X1 -----end of test---------------------------------------------------
	X1985 12 10 2 0 0
	Xgreg: input does not describe a valid gregorian date
	X1985 12 10 2 0 344 2446410
	X1 -----end of test---------------------------------------------------
	X1985 12 10 0 0 344
	X1985 12 10 3 2 344 2446410
	X0 -----end of test---------------------------------------------------
	X1985 12 0 0 0 344
	X1985 12 10 3 2 344 2446410
	X0 -----end of test---------------------------------------------------
	X1985 0 10 0 0 344
	X1985 12 10 3 2 344 2446410
	X0 -----end of test---------------------------------------------------
	X1985 12 10 0 0 345
	Xgreg: input does not describe a valid gregorian date
	X1985 12 10 0 0 345 0
	X1 -----end of test---------------------------------------------------
	Xtest first of a bunch of months
	X1985 1 1 0 0 0
	X1985 1 1 3 1 1 2446067
	X0 -----end of test---------------------------------------------------
	X1985 2 1 0 0 0
	X1985 2 1 6 1 32 2446098
	X0 -----end of test---------------------------------------------------
	X1985 3 1 0 0 0
	X1985 3 1 6 1 60 2446126
	X0 -----end of test---------------------------------------------------
	X1985 4 1 0 0 0
	X1985 4 1 2 1 91 2446157
	X0 -----end of test---------------------------------------------------
	X1985 5 1 0 0 0
	X1985 5 1 4 1 121 2446187
	X0 -----end of test---------------------------------------------------
	X1985 6 1 0 0 0
	X1985 6 1 7 1 152 2446218
	X0 -----end of test---------------------------------------------------
	X1985 7 1 0 0 0
	X1985 7 1 2 1 182 2446248
	X0 -----end of test---------------------------------------------------
	X1985 8 1 0 0 0
	X1985 8 1 5 1 213 2446279
	X0 -----end of test---------------------------------------------------
	X1985 9 1 0 0 0
	X1985 9 1 1 1 244 2446310
	X0 -----end of test---------------------------------------------------
	X1985 10 1 0 0 0
	X1985 10 1 3 1 274 2446340
	X0 -----end of test---------------------------------------------------
	X1985 11 1 0 0 0
	X1985 11 1 6 1 305 2446371
	X0 -----end of test---------------------------------------------------
	X1985 12 1 0 0 0
	X1985 12 1 1 1 335 2446401
	X0 -----end of test---------------------------------------------------
	Xtest funny leap years
	X   March 2000
	X S  M Tu  W Th  F  S
	X          1  2  3  4
	X 5  6  7  8  9 10 11
	X12 13 14 15 16 17 18
	X19 20 21 22 23 24 25
	X26 27 28 29 30 31
	X
	X2000 3 1 0 0 0
	X2000 3 1 4 1 61 2451605
	X0 -----end of test---------------------------------------------------
	X   March 1900
	X S  M Tu  W Th  F  S
	X             1  2  3
	X 4  5  6  7  8  9 10
	X11 12 13 14 15 16 17
	X18 19 20 21 22 23 24
	X25 26 27 28 29 30 31
	X
	X1900 3 1 0 0 0
	X1900 3 1 5 1 60 2415080
	X0 -----end of test---------------------------------------------------
	X   March 1952
	X S  M Tu  W Th  F  S
	X                   1
	X 2  3  4  5  6  7  8
	X 9 10 11 12 13 14 15
	X16 17 18 19 20 21 22
	X23 24 25 26 27 28 29
	X30 31
	X1952 3 1 0 0 0
	X1952 3 1 7 1 61 2434073
	X0 -----end of test---------------------------------------------------
	X   March 1953
	X S  M Tu  W Th  F  S
	X 1  2  3  4  5  6  7
	X 8  9 10 11 12 13 14
	X15 16 17 18 19 20 21
	X22 23 24 25 26 27 28
	X29 30 31
	X
	X1953 3 1 0 0 0
	X1953 3 1 1 1 60 2434438
	X0 -----end of test---------------------------------------------------
	X   March 1954
	X S  M Tu  W Th  F  S
	X    1  2  3  4  5  6
	X 7  8  9 10 11 12 13
	X14 15 16 17 18 19 20
	X21 22 23 24 25 26 27
	X28 29 30 31
	X
	X1954 3 1 0 0 0
	X1954 3 1 2 1 60 2434803
	X0 -----end of test---------------------------------------------------
	Xtest first and last day
	X
	X
	X
	X				1984
	X
	X	 Jan			Feb		       Mar
	X S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
	X 1  2  3  4  5  6  7             1  2  3  4                1  2  3
	X 8  9 10 11 12 13 14    5  6  7  8  9 10 11    4  5  6  7  8  9 10
	X15 16 17 18 19 20 21   12 13 14 15 16 17 18   11 12 13 14 15 16 17
	X22 23 24 25 26 27 28   19 20 21 22 23 24 25   18 19 20 21 22 23 24
	X29 30 31               26 27 28 29            25 26 27 28 29 30 31
	X
	X	 Apr			May		       Jun
	X S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
	X 1  2  3  4  5  6  7          1  2  3  4  5                   1  2
	X 8  9 10 11 12 13 14    6  7  8  9 10 11 12    3  4  5  6  7  8  9
	X15 16 17 18 19 20 21   13 14 15 16 17 18 19   10 11 12 13 14 15 16
	X22 23 24 25 26 27 28   20 21 22 23 24 25 26   17 18 19 20 21 22 23
	X29 30                  27 28 29 30 31         24 25 26 27 28 29 30
	X
	X	 Jul			Aug		       Sep
	X S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
	X 1  2  3  4  5  6  7             1  2  3  4                      1
	X 8  9 10 11 12 13 14    5  6  7  8  9 10 11    2  3  4  5  6  7  8
	X15 16 17 18 19 20 21   12 13 14 15 16 17 18    9 10 11 12 13 14 15
	X22 23 24 25 26 27 28   19 20 21 22 23 24 25   16 17 18 19 20 21 22
	X29 30 31               26 27 28 29 30 31      23 24 25 26 27 28 29
	X                                              30
	X	 Oct			Nov		       Dec
	X S  M Tu  W Th  F  S    S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
	X    1  2  3  4  5  6                1  2  3                      1
	X 7  8  9 10 11 12 13    4  5  6  7  8  9 10    2  3  4  5  6  7  8
	X14 15 16 17 18 19 20   11 12 13 14 15 16 17    9 10 11 12 13 14 15
	X21 22 23 24 25 26 27   18 19 20 21 22 23 24   16 17 18 19 20 21 22
	X28 29 30 31            25 26 27 28 29 30      23 24 25 26 27 28 29
	X                                              30 31
	X
	X
	X
	X1984 1 1 0 0 0
	X1984 1 1 1 1 1 2445701
	X0 -----end of test---------------------------------------------------
	X1984 12 31 0 0 0
	X1984 12 31 2 6 366 2446066
	X0 -----end of test---------------------------------------------------
	X1984 0 0 0 0 1
	X1984 1 1 1 1 1 2445701
	X0 -----end of test---------------------------------------------------
	X1984 0 0 0 0 366
	X1984 12 31 2 6 366 2446066
	X0 -----end of test---------------------------------------------------
	Xviolate various calendar limitations
	X1984 0 0 0 0 367
	Xgreg: input does not describe a valid gregorian date
	X1984 13 1 3 1 367 2446067
	X1 -----end of test---------------------------------------------------
	X1984 13 1 0 0 0
	Xgreg: input does not describe a valid gregorian date
	X1984 13 1 3 1 367 2446067
	X1 -----end of test---------------------------------------------------
	Xthoroughly test a February
	X1984 2 1 0 0 0
	X1984 2 1 4 1 32 2445732
	X0 -----end of test---------------------------------------------------
	X1984 2 2 0 0 0
	X1984 2 2 5 1 33 2445733
	X0 -----end of test---------------------------------------------------
	X1984 2 3 0 0 0
	X1984 2 3 6 1 34 2445734
	X0 -----end of test---------------------------------------------------
	X1984 2 4 0 0 0
	X1984 2 4 7 1 35 2445735
	X0 -----end of test---------------------------------------------------
	X1984 2 5 0 0 0
	X1984 2 5 1 2 36 2445736
	X0 -----end of test---------------------------------------------------
	X1984 2 6 0 0 0
	X1984 2 6 2 2 37 2445737
	X0 -----end of test---------------------------------------------------
	X1984 2 7 0 0 0
	X1984 2 7 3 2 38 2445738
	X0 -----end of test---------------------------------------------------
	X1984 2 8 0 0 0
	X1984 2 8 4 2 39 2445739
	X0 -----end of test---------------------------------------------------
	X1984 2 9 0 0 0
	X1984 2 9 5 2 40 2445740
	X0 -----end of test---------------------------------------------------
	X1984 2 10 0 0 0
	X1984 2 10 6 2 41 2445741
	X0 -----end of test---------------------------------------------------
	X1984 2 11 0 0 0
	X1984 2 11 7 2 42 2445742
	X0 -----end of test---------------------------------------------------
	X1984 2 12 0 0 0
	X1984 2 12 1 3 43 2445743
	X0 -----end of test---------------------------------------------------
	X1984 2 13 0 0 0
	X1984 2 13 2 3 44 2445744
	X0 -----end of test---------------------------------------------------
	X1984 2 14 0 0 0
	X1984 2 14 3 3 45 2445745
	X0 -----end of test---------------------------------------------------
	X1984 2 15 0 0 0
	X1984 2 15 4 3 46 2445746
	X0 -----end of test---------------------------------------------------
	X1984 2 16 0 0 0
	X1984 2 16 5 3 47 2445747
	X0 -----end of test---------------------------------------------------
	X1984 2 17 0 0 0
	X1984 2 17 6 3 48 2445748
	X0 -----end of test---------------------------------------------------
	X1984 2 18 0 0 0
	X1984 2 18 7 3 49 2445749
	X0 -----end of test---------------------------------------------------
	X1984 2 19 0 0 0
	X1984 2 19 1 4 50 2445750
	X0 -----end of test---------------------------------------------------
	X1984 2 20 0 0 0
	X1984 2 20 2 4 51 2445751
	X0 -----end of test---------------------------------------------------
	X1984 2 21 0 0 0
	X1984 2 21 3 4 52 2445752
	X0 -----end of test---------------------------------------------------
	X1984 2 22 0 0 0
	X1984 2 22 4 4 53 2445753
	X0 -----end of test---------------------------------------------------
	X1984 2 23 0 0 0
	X1984 2 23 5 4 54 2445754
	X0 -----end of test---------------------------------------------------
	X1984 2 24 0 0 0
	X1984 2 24 6 4 55 2445755
	X0 -----end of test---------------------------------------------------
	X1984 2 25 0 0 0
	X1984 2 25 7 4 56 2445756
	X0 -----end of test---------------------------------------------------
	X1984 2 26 0 0 0
	X1984 2 26 1 5 57 2445757
	X0 -----end of test---------------------------------------------------
	X1984 2 27 0 0 0
	X1984 2 27 2 5 58 2445758
	X0 -----end of test---------------------------------------------------
	X1984 2 28 0 0 0
	X1984 2 28 3 5 59 2445759
	X0 -----end of test---------------------------------------------------
	X1984 2 29 0 0 0
	X1984 2 29 4 5 60 2445760
	X0 -----end of test---------------------------------------------------
	Xshould fail
	X1985 2 29 0 0 0
	Xgreg: input does not describe a valid gregorian date
	X1985 2 29 0 0 60 0
	X1 -----end of test---------------------------------------------------
	X1984 2 30 0 0 0
	Xgreg: input does not describe a valid gregorian date
	X1984 2 30 0 0 61 0
	X1 -----end of test---------------------------------------------------
	Xtest around March 1 and invert wrt julian day
	X1984 0 0 0 0 59
	X1984 2 28 3 5 59 2445759
	X0 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 2445759
	X1984 2 28 3 5 59 2445759
	X0 -----end of test---------------------------------------------------
	X1984 0 0 0 0 60
	X1984 2 29 4 5 60 2445760
	X0 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 2445760
	X1984 2 29 4 5 60 2445760
	X0 -----end of test---------------------------------------------------
	X1984 0 0 0 0 61
	X1984 3 1 5 1 61 2445761
	X0 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 2445761
	X1984 3 1 5 1 61 2445761
	X0 -----end of test---------------------------------------------------
	X1984 2 0 0 0 61
	Xgreg: input does not describe a valid gregorian date
	X1984 2 0 0 0 61 0
	X1 -----end of test---------------------------------------------------
	Xknown Julian Days
	X2446066.5  == Jan 1.0 1985 GMT: the Astronomical Ephemeris
	X2446065.5  == 0000 hours Jan 0 1985:  Observer's Handbook 1985 pg 20
	X2446065    == 12n GMT 12/31/84: 1985 World Almanac pg 751 (wrong)
	X1984 12 31 0 0 0 2446066
	X1984 12 31 2 6 366 2446066
	X0 -----end of test---------------------------------------------------
	X2446430    == 12n GMT 12/31/85: 1986 World Almanac pg 751 (wrong)
	X1985 12 31 0 0 0 2446430
	Xgreg: input does not describe a valid gregorian date
	X1985 12 31 0 0 364 2446430
	X1 -----end of test---------------------------------------------------
	X   March 1900
	X S  M Tu  W Th  F  S
	X             1  2  3
	X 4  5  6  7  8  9 10
	X11 12 13 14 15 16 17
	X18 19 20 21 22 23 24
	X25 26 27 28 29 30 31
	X
	Xfrom Tantzen paper k=1
	X1900 3 1 0 0 0 2415080
	X1900 3 1 5 1 60 2415080
	X0 -----end of test---------------------------------------------------
	X   December 1999
	X S  M Tu  W Th  F  S
	X          1  2  3  4
	X 5  6  7  8  9 10 11
	X12 13 14 15 16 17 18
	X19 20 21 22 23 24 25
	X26 27 28 29 30 31
	X
	Xfrom Tantzen paper k=36465
	X1999 12 31 0 0 0 2451544
	X1999 12 31 6 5 365 2451544
	X0 -----end of test---------------------------------------------------
	X2440587.5 == Jan 1.0 1970 GMT: Astronomical Ephemeris
	X2440588   == 12n 1/1/70: Fliegel paper
	X   January 1970
	X S  M Tu  W Th  F  S
	X             1  2  3
	X 4  5  6  7  8  9 10
	X11 12 13 14 15 16 17
	X18 19 20 21 22 23 24
	X25 26 27 28 29 30 31
	X
	X1970 1 1 0 0 0 2440588
	X1970 1 1 5 1 1 2440588
	X0 -----end of test---------------------------------------------------
	X2305813   == Bhaskar correction to error in submitted version
	X1600 12 31 0 0 0 2305813
	X1600 12 31 1 6 366 2305813
	X0 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 2305812
	X1600 12 30 7 5 365 2305812
	X0 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 2305813
	X1600 12 31 1 6 366 2305813
	X0 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 2305814
	X1601 1 1 2 1 1 2305814
	X0 -----end of test---------------------------------------------------
	Xwhite box magic constants
	XJan 0 0001 +- 1
	X0 0 0 0 0 0 1721424
	Xgreg: input does not describe a valid gregorian date
	X0 0 0 0 0 0 1721424
	X1 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 1721425
	Xgreg: input does not describe a valid gregorian date
	X0 0 0 0 0 0 1721425
	X1 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 1721426
	Xgreg: input does not describe a valid gregorian date
	X1 1 1 2 1 1 1721426
	X1 -----end of test---------------------------------------------------
	XOct 15 1582 +-1
	X0 0 0 0 0 0 2299160
	Xgreg: input does not describe a valid gregorian date
	X1582 10 14 5 3 287 2299160
	X1 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 2299161
	X1582 10 15 6 3 288 2299161
	X0 -----end of test---------------------------------------------------
	X0 0 0 0 0 0 2299162
	X1582 10 16 7 3 289 2299162
	X0 -----end of test---------------------------------------------------
	Xtry a very big year just for the fun of it
	X5000000 1 1
	X5000000 1 1 7 1 1 1827933560
	X0 -----end of test---------------------------------------------------
	Xtest bad parameters
	Xno parameters
	Xgreg: insufficient information
	Xusage: greg year month day [day0week week0month day0year jd]
	X2 -----end of test---------------------------------------------------
	X1 0 0 0 0 0 0 0
	Xgreg: input does not describe a valid gregorian date
	X0 0 0 0 0 0 0
	X1 -----end of test---------------------------------------------------
	X-1 0 0 0 0 0
	Xgreg: input does not describe a valid gregorian date
	X-1 0 0 0 0 0 0
	X1 -----end of test---------------------------------------------------
	Xend of tests
SHAR_EOF
if test 16307 -ne "`wc -c < 'test.author'`"
then
	echo shar: error transmitting "'test.author'" '(should have been 16307 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
-- 
W. M. McKeeman            mckeeman at WangInst
Wang Institute            decvax!wanginst!mckeeman
Tyngsboro MA 01879



More information about the Comp.sources.bugs mailing list