tests/wk/test_wk.c

/* [<][>]
[^][v][top][bottom][index][help] */

FUNCTIONS

This source file includes following functions.
  1. main

   1 /***************************************
   2   $Revision: 1.3 $
   3 
   4   Example code: Unit test driver for mysql_driver.c
   5 
   6   ******************/ /******************
   7   Modification History:
   8         ottrey (07/04/1999) Created.
   9   ******************/ /******************
  10   Copyright (c) 1999                              RIPE NCC
  11  
  12   All Rights Reserved
  13   
  14   Permission to use, copy, modify, and distribute this software and its
  15   documentation for any purpose and without fee is hereby granted,
  16   provided that the above copyright notice appear in all copies and that
  17   both that copyright notice and this permission notice appear in
  18   supporting documentation, and that the name of the author not be
  19   used in advertising or publicity pertaining to distribution of the
  20   software without specific, written prior permission.
  21   
  22   THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  23   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS; IN NO EVENT SHALL
  24   AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
  25   DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
  26   AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  27   OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  28   ***************************************/
  29 #include "../test_.c"   /* unit test template */
  30 #include "query_command.h"
  31 #include "which_keytypes.h"
  32 
  33 #define TEST1 "1 Test 1"
  34 
  35 
  36 int main(int argc, char **argv) {
     /* [<][>][^][v][top][bottom][index][help] */
  37   FILE *infile;
  38   char input[STR_L];
  39   char *str;
  40 
  41   mask_t  keytypes_bitmap;
  42    
  43   /* Default to get the input from stdin */
  44   infile = stdin;
  45 
  46   /* Get the options from the command line */
  47   get_options(argc, argv);
  48 
  49   /* TEST1 */
  50   if (Test[1] == 1) {
  51     print_title(TEST1);
  52 
  53     if (Infile_name != NULL) {
  54       infile = fopen(Infile_name, "r");
  55 
  56       if (infile == NULL) {
  57         perror("Couldn't load infile");
  58         return -1;
  59       }
  60     }
  61 
  62     while (fgets(input, STR_L, infile)) {
  63       /* strip the \n */
  64       input[strlen(input)-1] = '\0';
  65 
  66       if (Verbose == 1) {
  67         printf("input=%s\n", input);
  68       }
  69       keytypes_bitmap = WK_new(input);
  70       str = WK_to_string(keytypes_bitmap);
  71       printf("Possible keytypes=%s\n", str);
  72       free(str);
  73     }
  74     close(infile);
  75   } /* TEST1 */
  76 
  77   return 0;
  78 
  79 } /* main() */
  80 

/* [<][>][^][v][top][bottom][index][help] */