home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / db02_src.zip / tester.cc < prev    next >
C/C++ Source or Header  |  1993-11-05  |  2KB  |  96 lines

  1. /**************************************************************************
  2.  * Source Id :
  3.  *
  4.  * $Id: tester.cc,v 1.4 1993/05/26 01:01:39 kevinl Exp $
  5.  *-------------------------------------------------------------------------
  6.  * Project Notes :
  7.  *
  8.  *  Diamond Base
  9.  *  ============
  10.  *      A solid database implementation, spurred on by the continuing
  11.  *  Metal (Lead) Base saga.
  12.  *
  13.  *  Project Team :
  14.  *        A. Davison
  15.  *        K. Lentin
  16.  *        D. Platt
  17.  *
  18.  *    Project Commenced : 05-02-1993
  19.  *
  20.  *-------------------------------------------------------------------------
  21.  *  Module Notes :
  22.  *
  23.  *  Testing rserv and then some bucket writing
  24.  *
  25.  *
  26.  *  Original Author : Krazy Kev
  27.  *
  28.  *-------------------------------------------------------------------------
  29.  * Revision History:
  30.  *
  31.  * $Log: tester.cc,v $
  32. // Revision 1.4  1993/05/26  01:01:39  kevinl
  33. // MALLOC_H_MISSING
  34. //
  35. // Revision 1.3  1993/03/29  08:20:09  darrenp
  36. // Added new malloc library support
  37. //
  38. // Revision 1.2  1993/03/26  06:16:38  darrenp
  39. // standardized error codes.
  40. //
  41. // Revision 1.1  1993/02/11  04:09:10  darrenp
  42. // Initial revision
  43. //
  44.  **************************************************************************/
  45.  
  46. #include "myobj.h"
  47. #include <iostream.h>
  48. #include <unistd.h>
  49. #include <stdlib.h>
  50. #ifdef BORLANDC
  51. #include <time.h>
  52. #endif
  53. #include "rserv.h"
  54. #ifndef MALLOC_H_MISSING
  55. #include <malloc.h>
  56. #endif
  57.  
  58. int
  59. main()
  60. {
  61. #ifdef BORLANDC
  62.     randomize();
  63. #else
  64.     srand(getpid() * getppid());
  65. #endif
  66.  
  67.     myObject obj;
  68.     recServer rs;
  69.     cout << "Server created" << endl;
  70.     if (rs.createDb("testdb", 512) != db_ok)
  71.         exit(0);
  72.  
  73.     bucket b(1, obj.getKeyLength(), 512, INNER, 0, 0, 0);
  74.     b.info();
  75.     for (int i = 0; i < 20; i++)
  76.     {
  77.         myObject insObj;
  78.         b.insert(insObj, i);
  79.     }
  80.     b.info();
  81.     b.dump();
  82.  
  83.     long idx;
  84.     cout << "newRec" << endl;
  85.     if (rs.newRec(idx) != db_ok)
  86.         exit (0);
  87.  
  88.     cout << "idx=" << idx << endl;
  89.     cout << "putRec" << endl;
  90.     if (rs.putRec(idx, b.getData()) != db_ok)
  91.         exit (0);
  92.  
  93.     cout << "Success" << endl;
  94.     return 0;
  95. }
  96.