## tests/ma/test_ma.c

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

## DEFINITIONS

This source file includes following functions.

1. main

       1 /***************************************
       2   $Revision: 1.1 $
       3
       4   Example code: Unit test driver for mysql_driver.c
       5
       6   ******************/ /******************
       7   Modification History:
       8         ottrey (29/07/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 "bitmask.h"
      31
      32 #define TEST1 "1 setting bits"
      33 #define TEST2 "2 AND operation"
      34 #define TEST3 "3 OR operation"
      35 #define TEST4 "4 XOR operation"
      36
      37 int main(int argc, char **argv) {
         /* [<][>][^][v][top][bottom][index][help] */
      38   mask_t  a, b, c;
      39
      40   /* Get the options from the command line */
      41   get_options(argc, argv);
      42
      43   /* TEST1 */
      44   if (Test[1] == 1) {
      45     print_title(TEST1);
      46
      47     a = MA_new(1, 4, 56, 3, 5, 7, 19, END);
      48
      49     MA_prt(a);
      50
      51     MA_set(&a, 3, 0);
      52     MA_set(&a, 7, 0);
      53     MA_set(&a, 9, 0);
      54     MA_set(&a, 19, 0);
      55
      56     MA_prt(a);
      57
      58   } /* TEST1 */
      59
      60   /* TEST2 */
      61   if (Test[2] == 1) {
      62     print_title(TEST2);
      63
      64     a = MA_new(1, 4, 56, 3, 5, 7, 19, END);
      65     b = MA_new(1, 2, 3, 4, 10, END);
      66
      67     MA_prt(a);
      68     MA_prt(b);
      69
      70     c = MA_and(a, b);
      71     MA_prt(c);
      72
      73   } /* TEST2 */
      74
      75   /* TEST3 */
      76   if (Test[3] == 1) {
      77     print_title(TEST3);
      78
      79     a = MA_new(1, 4, 56, 3, 5, 7, 19, END);
      80     b = MA_new(1, 2, 3, 4, 10, END);
      81
      82     MA_prt(a);
      83     MA_prt(b);
      84
      85     c = MA_or(a, b);
      86     MA_prt(c);
      87
      88   } /* TEST3 */
      89
      90   /* TEST4 */
      91   if (Test[4] == 1) {
      92     print_title(TEST4);
      93
      94     a = MA_new(1, 4, 56, 3, 5, 7, 19, END);
      95     b = MA_new(1, 2, 3, 4, 10, END);
      96
      97     MA_prt(a);
      98     MA_prt(b);
      99
     100     c = MA_xor(a, b);
     101     MA_prt(c);
     102
     103   } /* TEST4 */
     104
     105   return 0;
     106
     107 } /* main() */
     108

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