home *** CD-ROM | disk | FTP | other *** search
-
- /*
- t4conv.c
-
- (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved.
-
- Tests Code Base conversion routines.
- */
-
- #include "p4misc.h"
- #include "d4all.h"
- #include "u4error.h"
- #include "w4.h"
-
- #include <string.h>
-
- main()
- {
- char encde[10] ;
-
- #ifdef NO_HUGE
- #ifdef IS_386
- d4init() ;
- #else
- d4initialize( 4, 4, 20, 1000, 20000L ) ;
- #endif
- #else
- d4init() ;
- #endif
- w4clear(-1) ;
-
- if ( c4atod("190000",6) != 190000.0 )
- {
- u4error( 0, "t4conv: c4atod", (char *) 0 );
- w4exit(1) ;
- }
-
- if ( strcmp( "190000", c4dtoa(190000.0,6,0) ) !=0 )
- {
- u4error( 0, "t4conv: c4dtoa", (char *) 0 );
- w4exit(1) ;
- }
-
- if ( c4atoi( "12", 2) != 12 )
- {
- u4error( 0, "t4conv: c4atoi", (char *) 0 );
- w4exit(1) ;
- }
-
- if ( strcmp( c4dt_format("19880101", "CCYY.MM.DD"), "1988.01.01" ) != 0 )
- {
- u4error( 0, "t4conv: c4dt_format", (char *) 0 );
- w4exit(1) ;
- }
-
- c4encode( encde, "123456", "AA%BB*CC", "CCAABB");
- if ( strcmp( encde, "34%56*12" ) != 0)
- {
- u4error( 0, "t4conv: c4encode", (char *) 0 );
- w4exit(1) ;
- }
-
- c4ltoa( (long) 10, encde, 8);
- if ( strcmp( encde, " 10") != 0 )
- {
- u4error( 0, "t4conv: c4ltoa", (char *) 0 );
- w4exit(1) ;
- }
-
- c4ltoa( (long) 10, encde, -8);
- if ( strcmp( encde, "00000010") != 0 )
- {
- u4error( 0, "t4conv: c4ltoa", (char *) 0 );
- w4exit(1) ;
- }
-
- #ifdef H4TEST
- {
- int rc ;
- d4init_undo() ;
- rc = h4free_check(32000) ;
- d4init() ;
- if ( rc != 0 )
- {
- u4error( 0, "t4conv: Memory items not freed", (char *) 0 );
- w4exit(1) ;
- }
- }
- #endif
-
- w4handle(1) ;
- w4( w4row()+1,0, "t4conv: SUCCESS" ) ;
- w4exit(0) ;
- }
-
-