/*****
 NAME
 	cdate-test.m - test program for CDate class
 VERSION
 	$Id$
 CHANGELOG
 	$Log$
 */

#include <coconut/cdate.h>
#include <stdlib.h>

void isLeapYear(u_int year)
{
	printf("year %u is ", year) ;
	if([CDate isLeapYear: year])
		printf("leap year !!") ;
	else
		printf("leap NOT year.") ;
	printf(" the last day of febrary is %u.\n", [CDate daysFromMonth:
	  year and: 2]) ;
}

void printDate(id <PDate> date)
{
	printf("day %u month %u year %u\n", [date day], [date month],
	  [date year]) ;
}

int main()
{
	id <PDate>	date1 ;

	printf("*** test program for CDate class\n") ;

	/* factory method test */
	isLeapYear(2002) ;
	isLeapYear(2004) ;

	/* cdate class test */
	date1 = [[CDate alloc] init] ;

	[date1 setDate: 27 month: 3 year: 2002] ;
	printDate(date1) ;

	[date1 release] ;
	printf("bye\n") ;
	exit(0) ;
}

