home *** CD-ROM | disk | FTP | other *** search
-
- /* t4date.c
-
- (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved.
-
- Tests Code Base date conversion routines.
- */
-
- #include "p4misc.h"
- #include "d4all.h"
- #include "w4.h"
- #include "u4error.h"
-
- #include <string.h>
-
- #ifndef UNIX
- #include <conio.h>
- #endif
-
- main()
- {
- double total_date, index_date, index_test_date;
- char dbf_date[10];
- int c ;
-
- #ifdef NO_HUGE
- #ifdef IS_386
- d4init() ;
- #else
- d4initialize( 4, 4, 20, 1000, 20000L ) ;
- #endif
- #else
- d4init() ;
- #endif
- w4clear(-1) ;
-
- memset( dbf_date, 0, (size_t) sizeof(dbf_date) ) ;
-
- index_date = 2444606.0 ;
- c4dt_str( dbf_date, &index_date );
-
- if ( strcmp( dbf_date, "19810101") != 0 )
- {
- u4error( 0, "\nDate Conversion Error on 19810101", (char *) 0 ) ;
- w4exit(1) ;
- }
-
- total_date = 366L*400L+index_date;
-
- w4( 0,0, "Testing Date: " ) ;
- c = w4col() ;
-
- for ( ; index_date <= total_date; index_date++)
- {
- #ifndef UNIX
- if ( kbhit() )
- {
- int rc ;
-
- g4char() ; /* Use up the character. */
- rc = w4display( "Do you wish to stop the Date Test (Y/N) ?", (char *) 0 ) ;
-
- if ( rc == (int) 'Y' || rc == (int) 'y' )
- {
- w4( w4row()+1,0, "Aborting Date Test on User Request." ) ;
- w4exit(0) ;
- }
- }
- #endif
- w4( w4row(),c, dbf_date ) ;
-
- memset( dbf_date, 0, (size_t) sizeof(dbf_date) ) ;
- c4dt_str( dbf_date, &index_date );
- if ( c4dt_julian( dbf_date, &index_test_date ) != 0 )
- {
- u4error( 0, "t4date: c4dt_julian", (char *) 0 ) ;
- w4exit(1) ;
- }
-
- if (index_date != index_test_date )
- {
- u4error( 0, "t4date: c4dt_julian", (char *) 0 ) ;
- w4exit(1) ;
- }
-
- }
-
-
- #ifdef H4TEST
- {
- int rc ;
- d4init_undo() ;
- rc = h4free_check(32000) ;
- d4init() ;
- if ( rc != 0 )
- {
- u4error( 0, "t4date: Memory items not freed", (char *) 0 );
- w4exit(1) ;
- }
- }
- #endif
-
- w4handle(1) ;
- w4( w4row()+1,0, "t4date: SUCCESS" ) ;
- w4exit(0) ;
- }
-