Back to home page

Enduro/X

 
 

    


0001 /**
0002  * @brief Test Buffer compare routines (Bcmp and Bsubset)
0003  *
0004  * @file test_bcmp.c
0005  */
0006 /* -----------------------------------------------------------------------------
0007  * Enduro/X Middleware Platform for Distributed Transaction Processing
0008  * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0009  * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0010  * This software is released under one of the following licenses:
0011  * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0012  * See LICENSE file for full text.
0013  * -----------------------------------------------------------------------------
0014  * AGPL license:
0015  *
0016  * This program is free software; you can redistribute it and/or modify it under
0017  * the terms of the GNU Affero General Public License, version 3 as published
0018  * by the Free Software Foundation;
0019  *
0020  * This program is distributed in the hope that it will be useful, but WITHOUT ANY
0021  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0022  * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0023  * for more details.
0024  *
0025  * You should have received a copy of the GNU Affero General Public License along 
0026  * with this program; if not, write to the Free Software Foundation, Inc.,
0027  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0028  *
0029  * -----------------------------------------------------------------------------
0030  * A commercial use license is available from Mavimax, Ltd
0031  * contact@mavimax.com
0032  * -----------------------------------------------------------------------------
0033  */
0034 
0035 #include <stdio.h>
0036 #include <stdlib.h>
0037 #include <cgreen/cgreen.h>
0038 #include <ubf.h>
0039 #include <ndrstandard.h>
0040 #include <string.h>
0041 #include "test.fd.h"
0042 #include "ubfunit1.h"
0043 #include "ndebug.h"
0044 
0045 exprivate char *M_some_ptr1 = "HELLOptr";
0046 exprivate char *M_some_ptr2 = "HELLOptr";
0047 
0048 /**
0049  * Basic preparation before the test
0050  */
0051 Ensure(cmp_basic_setup1)
0052 {
0053     /* shared load */
0054     load_field_table(); 
0055 }
0056 
0057 
0058 /**
0059  * Load data1
0060  */
0061 exprivate void load1(UBFH *p_ub, BFLDOCC occ)
0062 {
0063     short s = 88;
0064     long l = -1021;
0065     char c = 'c';
0066     float f = 17.31;
0067     double d = 12312.1111;
0068     char carr[] = "CARRAY1 TEST STRING DATA";
0069     char tmp[1024];
0070     UBFH *p_tmp = (UBFH *)tmp;
0071     struct UBTESTVIEW2 v2;
0072     BVIEWFLD vf2;
0073     
0074     BFLDLEN len = strlen(carr);
0075     
0076     assert_equal(Bchg(p_ub, T_SHORT_FLD, occ, (char *)&s, 0), EXSUCCEED);
0077     assert_equal(Bchg(p_ub, T_LONG_FLD, occ, (char *)&l, 0), EXSUCCEED);
0078     assert_equal(Bchg(p_ub, T_CHAR_FLD, occ, (char *)&c, 0), EXSUCCEED);
0079     assert_equal(Bchg(p_ub, T_FLOAT_FLD, occ, (char *)&f, 0), EXSUCCEED);
0080     assert_equal(Bchg(p_ub, T_DOUBLE_FLD, occ, (char *)&d, 0), EXSUCCEED);
0081     assert_equal(Bchg(p_ub, T_STRING_FLD, occ, (char *)"TEST STR VAL", 0), EXSUCCEED);
0082     assert_equal(Bchg(p_ub, T_CARRAY_FLD, occ, (char *)carr, len), EXSUCCEED);
0083 
0084     /* Load equal UBF occ 0*/
0085     assert_equal(Binit(p_tmp, sizeof(tmp)), EXSUCCEED);
0086     assert_equal(Bchg(p_tmp, T_STRING_10_FLD, 0, "HELO", 0L), EXSUCCEED);
0087     assert_equal(Bchg(p_ub, T_UBF_FLD, occ, (char *)p_tmp, len), EXSUCCEED);
0088     /* Load equal PTR occ 0 */
0089     assert_equal(Bchg(p_ub, T_PTR_FLD, occ, (char *)&M_some_ptr1, len), EXSUCCEED);
0090     /* Load equal VIEW occ 0*/
0091     memset(&v2, 0, sizeof(v2));
0092     v2.tlong1=1000;
0093     vf2.data=(char *)&v2;
0094     vf2.vflags=0;
0095     NDRX_STRCPY_SAFE(vf2.vname, "UBTESTVIEW2");
0096     assert_equal(Bchg(p_ub, T_VIEW_FLD, occ, (char *)&vf2, len), EXSUCCEED);
0097     
0098 }
0099 
0100 /**
0101  * Load test data 3
0102  */
0103 exprivate void load3(UBFH *p_ub)
0104 {
0105     short s;
0106     long l;
0107     char c;
0108     float f;
0109     double d;
0110     char carr[] = "CARRAY1 TEST STRING DATA";
0111     BFLDLEN len = strlen(carr);
0112     char tmp[1024];
0113     UBFH *p_tmp = (UBFH *)tmp;
0114     struct UBTESTVIEW2 v2;
0115     BVIEWFLD vf2;
0116     
0117     s = 212;
0118     l = 212;
0119     c = 'b';
0120     f = 12127;
0121     d = 1231232.1;
0122     carr[0] = 'X';
0123     assert_equal(Bchg(p_ub, T_SHORT_FLD, 0, (char *)&s, 0), EXSUCCEED);
0124     assert_equal(Bchg(p_ub, T_LONG_FLD, 0, (char *)&l, 0), EXSUCCEED);
0125     assert_equal(Bchg(p_ub, T_CHAR_FLD, 0, (char *)&c, 0), EXSUCCEED);
0126     assert_equal(Bchg(p_ub, T_FLOAT_FLD, 0, (char *)&f, 0), EXSUCCEED);
0127     assert_equal(Bchg(p_ub, T_DOUBLE_FLD, 0, (char *)&d, 0), EXSUCCEED);
0128     assert_equal(Bchg(p_ub, T_STRING_FLD, 0, (char *)"XEST STR VAL", 0), EXSUCCEED);
0129     assert_equal(Bchg(p_ub, T_CARRAY_FLD, 0, (char *)carr, len), EXSUCCEED);
0130     
0131     
0132     /* Load equal UBF occ 0*/
0133     assert_equal(Binit(p_tmp, sizeof(tmp)), EXSUCCEED);
0134     assert_equal(Bchg(p_tmp, T_STRING_10_FLD, 0, "EHLO", 0L), EXSUCCEED);
0135     assert_equal(Bchg(p_ub, T_UBF_FLD, 0, (char *)p_tmp, len), EXSUCCEED);
0136     /* Load equal PTR occ 0 */
0137     assert_equal(Bchg(p_ub, T_PTR_FLD, 0, (char *)&M_some_ptr2, len), EXSUCCEED);
0138     
0139     /* Load equal VIEW occ 0*/
0140     memset(&v2, 0, sizeof(v2));
0141     v2.tlong1=2000;
0142     vf2.data=(char *)&v2;
0143     vf2.vflags=0;
0144     NDRX_STRCPY_SAFE(vf2.vname, "UBTESTVIEW2");
0145     assert_equal(Bchg(p_ub, T_VIEW_FLD, 0, (char *)&vf2, len), EXSUCCEED);
0146 }
0147 
0148 
0149 /**
0150  * This simply reads all field and adds them to another buffer, then do compare
0151  */
0152 Ensure(test_Bcmp)
0153 {
0154     char fb[1024];
0155     char fb_2[2048];
0156     UBFH *p_ub = (UBFH *)fb;
0157     UBFH *p_ub_2 = (UBFH *)fb_2;
0158     
0159     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0160     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0161     
0162     load1(p_ub, 0);
0163     load1(p_ub_2, 0);
0164     
0165     assert_equal(Bcmp(p_ub, p_ub_2), 0);
0166     
0167     
0168     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0169     load1(p_ub_2, 1);
0170     
0171     /* ID of first is greater (due to missing occurrences) than second buffer */
0172     assert_equal(Bcmp(p_ub, p_ub_2), 1);
0173     
0174     /* now reverse check */
0175     assert_equal(Bcmp(p_ub_2, p_ub), -1);
0176     
0177     /* ok have some value differences */
0178     
0179     
0180     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0181     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0182     
0183     load3(p_ub);
0184     load1(p_ub_2, 0);
0185     
0186     /* load3 short is bigger than load1 */
0187     assert_equal(Bcmp(p_ub, p_ub_2), 1);
0188     
0189     /* reverse */
0190     assert_equal(Bcmp(p_ub_2, p_ub), -1);
0191     
0192     
0193     /* remove some fields from buffer, to make it look shorter... (last carray) */
0194     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0195     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0196     
0197     load1(p_ub, 0);
0198     load1(p_ub_2, 0);
0199     
0200     
0201     assert_equal(Bdel(p_ub, T_VIEW_FLD, 0), EXSUCCEED);
0202     
0203     /* buf2 have more fields */
0204     assert_equal(Bcmp(p_ub, p_ub_2), -1);
0205     
0206     /* reverse */
0207     assert_equal(Bcmp(p_ub_2, p_ub), 1);
0208     
0209     
0210     /* lets check some other data types too, so that we run through the new
0211      * comparator functions
0212      */
0213     
0214     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0215     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0216     
0217     load1(p_ub, 0);
0218     load3(p_ub_2);
0219 
0220     
0221     /* short we already tested, now start with long */
0222     
0223     assert_equal(Bdel(p_ub, T_SHORT_FLD, 0), EXSUCCEED);
0224     assert_equal(Bdel(p_ub_2, T_SHORT_FLD, 0), EXSUCCEED);
0225     
0226     /* -1021 < 212 */
0227     assert_equal(Bcmp(p_ub, p_ub_2), -1);
0228     assert_equal(Bcmp(p_ub_2, p_ub), 1);
0229     
0230     
0231     /* char test... */
0232     assert_equal(Bdel(p_ub, T_LONG_FLD, 0), EXSUCCEED);
0233     assert_equal(Bdel(p_ub_2, T_LONG_FLD, 0), EXSUCCEED);
0234     
0235     assert_equal(Bcmp(p_ub, p_ub_2), 1);
0236     assert_equal(Bcmp(p_ub_2, p_ub), -1);
0237     
0238     
0239     /* float test... */
0240     assert_equal(Bdel(p_ub, T_CHAR_FLD, 0), EXSUCCEED);
0241     assert_equal(Bdel(p_ub_2, T_CHAR_FLD, 0), EXSUCCEED);
0242     
0243     assert_equal(Bcmp(p_ub, p_ub_2), -1);
0244     assert_equal(Berror, 0);
0245     assert_equal(Bcmp(p_ub_2, p_ub), 1);
0246     
0247     /* double test... */
0248     assert_equal(Bdel(p_ub, T_FLOAT_FLD, 0), EXSUCCEED);
0249     assert_equal(Bdel(p_ub_2, T_FLOAT_FLD, 0), EXSUCCEED);
0250     
0251     assert_equal(Bcmp(p_ub, p_ub_2), -1);
0252     assert_equal(Bcmp(p_ub_2, p_ub), 1);
0253     
0254     /* string test... */
0255     assert_equal(Bdel(p_ub, T_DOUBLE_FLD, 0), EXSUCCEED);
0256     assert_equal(Bdel(p_ub_2, T_DOUBLE_FLD, 0), EXSUCCEED);
0257     
0258     assert_equal(Bcmp(p_ub, p_ub_2), -1);
0259     assert_equal(Bcmp(p_ub_2, p_ub), 1);
0260     
0261     /* carray test... */
0262     assert_equal(Bdel(p_ub, T_STRING_FLD, 0), EXSUCCEED);
0263     assert_equal(Bdel(p_ub_2, T_STRING_FLD, 0), EXSUCCEED);
0264     
0265     assert_equal(Bcmp(p_ub, p_ub_2), -1);
0266     assert_equal(Bcmp(p_ub_2, p_ub), 1);
0267     
0268     
0269     /* check the length of carray */
0270     assert_equal(CBchg(p_ub_2, T_CARRAY_FLD, 0, "HELLO", 0, BFLD_STRING), EXSUCCEED);
0271     
0272     assert_equal(Bcmp(p_ub, p_ub_2), 1);
0273     assert_equal(Bcmp(p_ub_2, p_ub), -1);
0274     
0275     /* test errors */
0276     
0277     assert_equal(Bcmp(NULL, p_ub_2), -2);
0278     assert_equal(Berror, BEINVAL);
0279     
0280     assert_equal(Bcmp(p_ub, NULL), -2);
0281     assert_equal(Berror, BEINVAL);
0282     
0283     
0284     memset(fb, 0, sizeof(fb));
0285     
0286     assert_equal(Bcmp(p_ub, p_ub_2), -2);
0287     assert_equal(Berror, BNOTFLD);
0288     
0289     assert_equal(Bcmp(p_ub_2, p_ub), -2);
0290     assert_equal(Berror, BNOTFLD);
0291     
0292     
0293 }
0294 
0295 /**
0296  * This simply reads all field and adds them to another buffer, then do compare
0297  */
0298 Ensure(test_Bsubset)
0299 {
0300     char fb[1024];
0301     char fb_2[2048];
0302     UBFH *p_ub = (UBFH *)fb;
0303     UBFH *p_ub_2 = (UBFH *)fb_2;
0304     
0305     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0306     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0307     
0308     load1(p_ub, 0);
0309     load1(p_ub_2, 0);
0310     
0311     assert_equal(Bsubset(p_ub, p_ub_2), EXTRUE);
0312     
0313     
0314     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0315     load1(p_ub_2, 1);
0316     
0317     /* ID of first is greater (due to missing occurrences) than second buffer */
0318     assert_equal(Bsubset(p_ub, p_ub_2), EXFALSE);
0319     
0320     /* now reverse check */
0321     assert_equal(Bsubset(p_ub_2, p_ub), EXFALSE);
0322     
0323     
0324     /* have a real subset */
0325     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0326     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0327     
0328     load1(p_ub, 0);
0329     load1(p_ub_2, 0);
0330     
0331     assert_equal(Bdel(p_ub_2, T_CHAR_FLD, 0), EXSUCCEED);
0332     assert_equal(Bdel(p_ub_2, T_FLOAT_FLD, 0), EXSUCCEED);
0333     
0334     
0335     assert_equal(Bsubset(p_ub, p_ub_2), EXTRUE);
0336     assert_equal(Bsubset(p_ub_2, p_ub), EXFALSE);
0337     assert_equal(Berror, 0);
0338     
0339     /* test some errors */
0340     
0341     assert_equal(Bsubset(NULL, p_ub_2), EXFAIL);
0342     assert_equal(Berror, BEINVAL);
0343     
0344     assert_equal(Bsubset(p_ub, NULL), EXFAIL);
0345     assert_equal(Berror, BEINVAL);
0346     
0347     memset(fb, 0, sizeof(fb));
0348     
0349     assert_equal(Bsubset(p_ub, p_ub_2), EXFAIL);
0350     assert_equal(Berror, BNOTFLD);
0351     
0352     assert_equal(Bsubset(p_ub_2, p_ub), EXFAIL);
0353     assert_equal(Berror, BNOTFLD);
0354     
0355     
0356 }
0357 
0358 /**
0359  * Compare ptrs values
0360  */
0361 Ensure(test_Bcmp_ptr)
0362 {
0363     char fb[1024];
0364     char fb_2[2048];
0365     long ptr1;
0366     long ptr2;
0367     UBFH *p_ub = (UBFH *)fb;
0368     UBFH *p_ub_2 = (UBFH *)fb_2;
0369     
0370     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0371     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0372     
0373     ptr1=1;
0374     ptr2=2;
0375     
0376     assert_equal(CBchg(p_ub, T_PTR_FLD, 0, (char *)&ptr1, 0L, BFLD_LONG), EXSUCCEED);
0377     assert_equal(CBchg(p_ub_2, T_PTR_FLD, 0, (char *)&ptr2, 0L, BFLD_LONG), EXSUCCEED);
0378     
0379     assert_equal(Bcmp(p_ub, p_ub_2), -1);
0380     assert_equal(Bcmp(p_ub_2, p_ub), 1);
0381     assert_equal(Bcmp(p_ub, p_ub), 0);
0382     
0383 }
0384 
0385 /**
0386  * Compare view in UBF values
0387  */
0388 Ensure(test_Bcmp_view)
0389 {
0390     char fb[2048];
0391     char fb_2[2048];
0392     struct UBTESTVIEW1 v1;
0393     BVIEWFLD vf1;
0394     
0395     struct UBTESTVIEW1 v2;
0396     BVIEWFLD vf2;
0397     
0398     UBFH *p_ub = (UBFH *)fb;
0399     UBFH *p_ub_2 = (UBFH *)fb_2;
0400     
0401     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0402     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0403     
0404     memset(&v1, 0, sizeof(v1));
0405     memset(&v2, 0, sizeof(v2));
0406     assert_equal(Bvsinit((char *)&v1, "UBTESTVIEW1"), EXSUCCEED);
0407     assert_equal(Bvsinit((char *)&v2, "UBTESTVIEW1"), EXSUCCEED);
0408     
0409     vf1.data=(char *)&v1;
0410     vf1.vflags=0;
0411     NDRX_STRCPY_SAFE(vf1.vname, "UBTESTVIEW1");
0412     assert_equal(Bchg(p_ub, T_VIEW_3_FLD, 0, (char *)&vf1, 0L), EXSUCCEED);
0413     
0414     vf2.data=(char *)&v2;
0415     vf2.vflags=0;
0416     NDRX_STRCPY_SAFE(vf2.vname, "UBTESTVIEW1");
0417     assert_equal(Bchg(p_ub_2, T_VIEW_3_FLD, 0, (char *)&vf2, 0L), EXSUCCEED);
0418     
0419     /* must match */
0420     assert_equal(Bcmp(p_ub, p_ub_2), 0);
0421     
0422     /* change some view values... in the view, lets say null value 
0423      * as count is 0, this shall not be checked and still we shall match...
0424      */
0425     NDRX_STRCPY_SAFE(v1.tcarray3[4], "HELLO");
0426     assert_equal(Bchg(p_ub, T_VIEW_3_FLD, 0, (char *)&vf1, 0L), EXSUCCEED);
0427     assert_equal(Bcmp(p_ub, p_ub_2), 0);
0428     
0429     /* no change some non counted field... */
0430     NDRX_STRCPY_SAFE(v1.tcarray1, "AAAA");
0431     NDRX_STRCPY_SAFE(v2.tcarray1, "BBBB");
0432     
0433     assert_equal(Bchg(p_ub, T_VIEW_3_FLD, 0, (char *)&vf1, 0L), EXSUCCEED);
0434     assert_equal(Bchg(p_ub_2, T_VIEW_3_FLD, 0, (char *)&vf2, 0L), EXSUCCEED);
0435     
0436     assert_equal(Bcmp(p_ub, p_ub_2), -1);
0437     assert_equal(Bcmp(p_ub_2, p_ub), 1);
0438     
0439 }
0440 
0441 /**
0442  * Compare sub-ubf buffers.
0443  */
0444 Ensure(test_Bcmp_ubf)
0445 {
0446     char fb[1024];
0447     char fb_2[2048];
0448     char fb_tmp[2048];
0449     
0450     
0451     UBFH *p_ub = (UBFH *)fb;
0452     UBFH *p_ub_2 = (UBFH *)fb_2;
0453     UBFH *p_ub_tmp = (UBFH *)fb_tmp;
0454     
0455     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0456     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0457     assert_equal(Binit(p_ub_tmp, sizeof(fb_tmp)), EXSUCCEED);
0458     
0459     /* setup the temp buffer.. */
0460     
0461     load1(p_ub_tmp, 0);
0462     
0463     /* match test: */
0464     assert_equal(Bchg(p_ub, T_UBF_3_FLD, 0, (char *)p_ub_tmp, 0L), EXSUCCEED);
0465     assert_equal(Bchg(p_ub_2, T_UBF_3_FLD, 0, (char *)p_ub_tmp, 0L), EXSUCCEED);
0466     
0467     assert_equal(Bcmp(p_ub_2, p_ub), 0);
0468     
0469     /* change something in sub-ubf... */
0470     assert_equal(Binit(p_ub_tmp, sizeof(fb_tmp)), EXSUCCEED);
0471     load3(p_ub_tmp);
0472     assert_equal(Bchg(p_ub_2, T_UBF_3_FLD, 0, (char *)p_ub_tmp, 0L), EXSUCCEED);
0473     
0474     assert_equal(Bcmp(p_ub_2, p_ub), 1);
0475     
0476 }
0477 
0478 /**
0479  * Test UBF subset function at second level
0480  */
0481 Ensure(test_Bsubset_ubf)
0482 {
0483     char fb[2048];
0484     char fb_2[2048];
0485     char fb_tmp[2048];
0486     char fb_tmp2[2048];
0487     
0488     UBFH *p_ub = (UBFH *)fb;
0489     UBFH *p_ub_2 = (UBFH *)fb_2;
0490     UBFH *p_ub_tmp = (UBFH *)fb_tmp;
0491     UBFH *p_ub_tmp2 = (UBFH *)fb_tmp2;
0492     
0493     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0494     assert_equal(Binit(p_ub_2, sizeof(fb_2)), EXSUCCEED);
0495     assert_equal(Binit(p_ub_tmp, sizeof(fb_tmp)), EXSUCCEED);
0496     assert_equal(Binit(p_ub_tmp2, sizeof(fb_tmp2)), EXSUCCEED);
0497     
0498     /* setup the temp buffer.. */
0499     
0500     load1(p_ub_tmp, 0);
0501     load1(p_ub_tmp, 1);
0502     load1(p_ub_tmp, 2);
0503     
0504     /* that path is  T_UBF_FLD.T_UBF_2_FLD.<fields> */
0505     
0506     assert_equal(Bchg(p_ub_tmp2, T_UBF_2_FLD, 0, (char *)p_ub_tmp, 0L), EXSUCCEED);
0507     assert_equal(Bchg(p_ub, T_UBF_FLD, 0, (char *)p_ub_tmp2, 0L), EXSUCCEED);
0508     
0509     /* for p_ub_2 there is two levels less */
0510     assert_equal(Binit(p_ub_tmp, sizeof(fb_tmp)), EXSUCCEED);
0511     assert_equal(Binit(p_ub_tmp2, sizeof(fb_tmp2)), EXSUCCEED);
0512     
0513     load1(p_ub_tmp, 0);
0514     load1(p_ub_tmp, 1);
0515     
0516     assert_equal(Bchg(p_ub_tmp2, T_UBF_2_FLD, 0, (char *)p_ub_tmp, 0L), EXSUCCEED);
0517     assert_equal(Bchg(p_ub_2, T_UBF_FLD, 0, (char *)p_ub_tmp2, 0L), EXSUCCEED);
0518     
0519     
0520     UBF_LOG(log_debug, "****Starting Bsubset ****");
0521     assert_equal(Bsubset(p_ub, p_ub_2), EXTRUE);
0522     UBF_LOG(log_debug, "****ENDING Bsubset ****");
0523     
0524     fprintf(stderr, "p_ub:\n");
0525     Bfprint(p_ub, stderr);
0526     
0527     fprintf(stderr, "p_ub2:\n");
0528     Bfprint(p_ub_2, stderr);
0529     
0530     assert_equal(Bsubset(p_ub_2, p_ub), EXFALSE);
0531     
0532 }
0533 
0534 TestSuite *ubf_bcmp_tests(void)
0535 {
0536     TestSuite *suite = create_test_suite();
0537 
0538     set_setup(suite, cmp_basic_setup1);
0539     add_test(suite, test_Bcmp);
0540     add_test(suite, test_Bcmp_ptr);
0541     add_test(suite, test_Bcmp_view);   
0542     add_test(suite, test_Bcmp_ubf);
0543     
0544     add_test(suite, test_Bsubset);
0545     add_test(suite, test_Bsubset_ubf);
0546     
0547     return suite;
0548 }
0549 /* vim: set ts=4 sw=4 et smartindent: */