tests/pr/test_pr.c

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

DEFINITIONS

This source file includes following functions.
  1. main

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

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