home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c160 / 1.ddi / TEST / T4CONV.C next >
Encoding:
C/C++ Source or Header  |  1990-06-22  |  1.9 KB  |  96 lines

  1.  
  2. /*
  3.    t4conv.c
  4.  
  5.    (c)Copyright Sequiter Software Inc., 1987-1990. All rights reserved.
  6.  
  7.    Tests Code Base conversion routines.
  8. */
  9.  
  10. #include "p4misc.h"
  11. #include "d4all.h"
  12. #include "u4error.h"
  13. #include "w4.h"
  14.  
  15. #include <string.h>
  16.  
  17. main()
  18. {
  19.    char   encde[10] ;
  20.  
  21.    #ifdef NO_HUGE
  22.       #ifdef IS_386
  23.          d4init() ;
  24.       #else
  25.          d4initialize( 4, 4, 20, 1000, 20000L ) ;
  26.       #endif
  27.    #else
  28.       d4init() ;
  29.    #endif
  30.    w4clear(-1) ;
  31.  
  32.    if ( c4atod("190000",6) != 190000.0 )
  33.    {
  34.       u4error( 0, "t4conv:  c4atod", (char *) 0 );
  35.       w4exit(1) ;
  36.    }
  37.  
  38.    if ( strcmp( "190000", c4dtoa(190000.0,6,0) ) !=0 )
  39.    {
  40.       u4error( 0, "t4conv:  c4dtoa", (char *) 0 );
  41.       w4exit(1) ;
  42.    }
  43.  
  44.    if ( c4atoi( "12", 2) != 12 )
  45.    {
  46.       u4error( 0, "t4conv:  c4atoi", (char *) 0 );
  47.       w4exit(1) ;
  48.    }
  49.  
  50.    if ( strcmp( c4dt_format("19880101", "CCYY.MM.DD"), "1988.01.01" ) != 0 )
  51.    {
  52.       u4error( 0, "t4conv:  c4dt_format", (char *) 0 );
  53.       w4exit(1) ;
  54.    }
  55.  
  56.    c4encode( encde, "123456", "AA%BB*CC", "CCAABB");
  57.    if ( strcmp( encde, "34%56*12" ) != 0)
  58.    {
  59.       u4error( 0, "t4conv:  c4encode", (char *) 0 );
  60.       w4exit(1) ;
  61.    }
  62.  
  63.    c4ltoa( (long) 10, encde, 8);
  64.    if ( strcmp( encde, "      10") != 0 )
  65.    {
  66.       u4error( 0, "t4conv:  c4ltoa", (char *) 0 );
  67.       w4exit(1) ;
  68.    }
  69.  
  70.    c4ltoa( (long) 10, encde, -8);
  71.    if ( strcmp( encde, "00000010") != 0 )
  72.    {
  73.       u4error( 0, "t4conv:  c4ltoa", (char *) 0 );
  74.       w4exit(1) ;
  75.    }
  76.  
  77.    #ifdef H4TEST
  78.    {
  79.       int  rc ;
  80.       d4init_undo() ;
  81.       rc = h4free_check(32000) ;
  82.       d4init() ;
  83.       if ( rc != 0 )
  84.       {
  85.          u4error( 0, "t4conv:  Memory items not freed", (char *) 0 );
  86.          w4exit(1) ;
  87.       }
  88.    }
  89.    #endif
  90.  
  91.    w4handle(1) ;
  92.    w4( w4row()+1,0, "t4conv:  SUCCESS" ) ;
  93.    w4exit(0) ;
  94. }
  95.  
  96.