Back to home page

Enduro/X

 
 

    


0001 /* 
0002 **
0003 ** @file test_bproj.c
0004 ** 
0005 ** -----------------------------------------------------------------------------
0006 ** Enduro/X Middleware Platform for Distributed Transaction Processing
0007 ** Copyright (C) 2015, Mavimax, Ltd. All Rights Reserved.
0008 ** This software is released under one of the following licenses:
0009 ** GPL or Mavimax's license for commercial use.
0010 ** -----------------------------------------------------------------------------
0011 ** GPL license:
0012 ** 
0013 ** This program is free software; you can redistribute it and/or modify it under
0014 ** the terms of the GNU General Public License as published by the Free Software
0015 ** Foundation; either version 2 of the License, or (at your option) any later
0016 ** version.
0017 **
0018 ** This program is distributed in the hope that it will be useful, but WITHOUT ANY
0019 ** WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0020 ** PARTICULAR PURPOSE. See the GNU General Public License for more details.
0021 **
0022 ** You should have received a copy of the GNU General Public License along with
0023 ** this program; if not, write to the Free Software Foundation, Inc., 59 Temple
0024 ** Place, Suite 330, Boston, MA 02111-1307 USA
0025 **
0026 ** -----------------------------------------------------------------------------
0027 ** A commercial use license is available from Mavimax, Ltd
0028 ** contact@mavimax.com
0029 ** -----------------------------------------------------------------------------
0030 */
0031 
0032 #include <stdio.h>
0033 #include <stdlib.h>
0034 #include <cgreen/cgreen.h>
0035 #include <ubf.h>
0036 #include <ndrstandard.h>
0037 #include <string.h>
0038 #include "test.fd.h"
0039 #include "ubfunit1.h"
0040 #include "ndebug.h"
0041 #include <fdatatype.h>
0042 
0043 void test_proj_data_1(UBFH *p_ub)
0044 {
0045     short s;
0046     long l;
0047     char c;
0048     float f;
0049     double d;
0050     char buf[100];
0051     BFLDLEN len;
0052     char carr[] = "CARRAY1 TEST STRING DATA";
0053 
0054     /* OCC 0 */
0055     assert_equal(Bget(p_ub, T_SHORT_FLD, 0, (char *)&s, 0), EXSUCCEED);
0056     assert_equal(s, 88);
0057     assert_equal(Bget(p_ub, T_LONG_FLD, 0, (char *)&l, 0), EXSUCCEED);
0058     assert_equal(l, -1021);
0059     assert_equal(Bget(p_ub, T_CHAR_FLD, 0, (char *)&c, 0), EXSUCCEED);
0060     assert_equal(c, 'c');
0061     assert_equal(Bget(p_ub, T_FLOAT_FLD, 0, (char *)&f, 0), EXSUCCEED);
0062     assert_double_equal(f, 17.31);
0063     assert_equal(Bget(p_ub, T_DOUBLE_FLD, 0, (char *)&d, 0), EXSUCCEED);
0064     assert_double_equal(d, 12312.1111);
0065     assert_equal(Bget(p_ub, T_STRING_FLD, 0, (char *)buf, 0), EXSUCCEED);
0066     assert_string_equal(buf, "TEST STR VAL");
0067     
0068     len = sizeof(buf);
0069     assert_equal(Bget(p_ub, T_CARRAY_FLD, 0, (char *)buf, &len), EXSUCCEED);
0070     assert_equal(strncmp(buf, carr, strlen(carr)), 0);
0071     
0072     /* OCC 1 */
0073     assert_equal(Bget(p_ub, T_SHORT_FLD, 1, (char *)&s, 0), EXSUCCEED);
0074     assert_equal(s, 8);
0075     assert_equal(Bget(p_ub, T_LONG_FLD, 1, (char *)&l, 0), EXSUCCEED);
0076     assert_equal(l, -21);
0077     assert_equal(Bget(p_ub, T_CHAR_FLD, 1, (char *)&c, 0), EXSUCCEED);
0078     assert_equal(c, '.');
0079     assert_equal(Bget(p_ub, T_FLOAT_FLD, 1, (char *)&f, 0), EXSUCCEED);
0080     assert_double_equal(f, 1.31);
0081     assert_equal(Bget(p_ub, T_DOUBLE_FLD, 1, (char *)&d, 0), EXSUCCEED);
0082     assert_double_equal(d, 1231.1111);
0083     assert_equal(Bget(p_ub, T_STRING_FLD, 1, (char *)buf, 0), EXSUCCEED);
0084     assert_string_equal(buf, "TEST STRING ARRAY2");
0085 
0086     len = sizeof(buf);
0087     carr[0] = 'Y';
0088     assert_equal(Bget(p_ub, T_CARRAY_FLD, 1, (char *)buf, &len), EXSUCCEED);
0089     assert_equal(strncmp(buf, carr, strlen(carr)), 0);
0090 }
0091 
0092 void load_proj_test_data(UBFH *p_ub)
0093 {
0094     short s = 88;
0095     long l = -1021;
0096     char c = 'c';
0097     float f = 17.31;
0098     double d = 12312.1111;
0099     char carr[] = "CARRAY1 TEST STRING DATA";
0100     BFLDLEN len = strlen(carr);
0101 
0102     assert_equal(Bchg(p_ub, T_SHORT_FLD, 0, (char *)&s, 0), EXSUCCEED);
0103     assert_equal(Bchg(p_ub, T_LONG_FLD, 0, (char *)&l, 0), EXSUCCEED);
0104     assert_equal(Bchg(p_ub, T_CHAR_FLD, 0, (char *)&c, 0), EXSUCCEED);
0105     assert_equal(Bchg(p_ub, T_FLOAT_FLD, 0, (char *)&f, 0), EXSUCCEED);
0106     assert_equal(Bchg(p_ub, T_DOUBLE_FLD, 0, (char *)&d, 0), EXSUCCEED);
0107     assert_equal(Bchg(p_ub, T_STRING_FLD, 0, (char *)"TEST STR VAL", 0), EXSUCCEED);
0108     assert_equal(Bchg(p_ub, T_CARRAY_FLD, 0, (char *)carr, len), EXSUCCEED);
0109 
0110     /* Make second copy of field data (another for not equal test)*/
0111     s = 8;
0112     l = -21;
0113     c = '.';
0114     f = 1.31;
0115     d = 1231.1111;
0116     carr[0] = 'Y';
0117     len = strlen(carr);
0118 
0119     assert_equal(Bchg(p_ub, T_SHORT_FLD, 1, (char *)&s, 0), EXSUCCEED);
0120     assert_equal(Bchg(p_ub, T_LONG_FLD, 1, (char *)&l, 0), EXSUCCEED);
0121     assert_equal(Bchg(p_ub, T_CHAR_FLD, 1, (char *)&c, 0), EXSUCCEED);
0122     assert_equal(Bchg(p_ub, T_FLOAT_FLD, 1, (char *)&f, 0), EXSUCCEED);
0123     assert_equal(Bchg(p_ub, T_DOUBLE_FLD, 1, (char *)&d, 0), EXSUCCEED);
0124     assert_equal(Bchg(p_ub, T_STRING_FLD, 1, (char *)"TEST STRING ARRAY2", 0), EXSUCCEED);
0125     assert_equal(Bchg(p_ub, T_CARRAY_FLD, 1, (char *)carr, len), EXSUCCEED);
0126 
0127     s = 212;
0128     l = 212;
0129     c = 'b';
0130     f = 12127;
0131     d = 1231232.1;
0132     carr[0] = 'X';
0133     assert_equal(Bchg(p_ub, T_SHORT_2_FLD, 0, (char *)&s, 0), EXSUCCEED);
0134     assert_equal(Bchg(p_ub, T_LONG_2_FLD, 0, (char *)&l, 0), EXSUCCEED);
0135     assert_equal(Bchg(p_ub, T_CHAR_2_FLD, 0, (char *)&c, 0), EXSUCCEED);
0136     assert_equal(Bchg(p_ub, T_FLOAT_2_FLD, 0, (char *)&f, 0), EXSUCCEED);
0137     assert_equal(Bchg(p_ub, T_DOUBLE_2_FLD, 0, (char *)&d, 0), EXSUCCEED);
0138     assert_equal(Bchg(p_ub, T_STRING_2_FLD, 0, (char *)"XTEST STR VAL", 0), EXSUCCEED);
0139     assert_equal(Bchg(p_ub, T_CARRAY_2_FLD, 0, (char *)carr, len), EXSUCCEED);
0140 }
0141 
0142 /**
0143  * This simply reads all field and adds them to another buffer, then do compare
0144  */
0145 Ensure(test_proj_simple)
0146 {
0147     char fb[400];
0148     UBFH *p_ub = (UBFH *)fb;
0149     char data_buf[100];
0150     BFLDLEN  len;
0151 
0152     BFLDID proj[] = {
0153         T_SHORT_FLD,
0154         T_LONG_FLD,
0155         T_CHAR_FLD,
0156         T_FLOAT_FLD,
0157         T_DOUBLE_FLD,
0158         T_STRING_FLD,
0159         T_CARRAY_FLD,
0160         BBADFLDID
0161     };
0162     /* Empty list - delete all */
0163     BFLDID proj_empty[] = {
0164         BBADFLDID
0165     };
0166 
0167     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0168 
0169     load_proj_test_data(p_ub);
0170 
0171     /* Projection delete */
0172     assert_equal(Bproj(p_ub, proj), EXSUCCEED);
0173 
0174     assert_equal(Bpres(p_ub, T_SHORT_FLD, 0), EXTRUE);
0175     assert_equal(Bpres(p_ub, T_LONG_FLD, 0), EXTRUE);
0176     assert_equal(Bpres(p_ub, T_CHAR_FLD, 0), EXTRUE);
0177     assert_equal(Bpres(p_ub, T_FLOAT_FLD, 0), EXTRUE);
0178     assert_equal(Bpres(p_ub, T_DOUBLE_FLD, 0), EXTRUE);
0179     assert_equal(Bpres(p_ub, T_STRING_FLD, 0), EXTRUE);
0180     assert_equal(Bpres(p_ub, T_CARRAY_FLD, 0), EXTRUE);
0181 
0182     assert_equal(Bpres(p_ub, T_SHORT_2_FLD, 0), EXFALSE);
0183     assert_equal(Bpres(p_ub, T_LONG_2_FLD, 0), EXFALSE);
0184     assert_equal(Bpres(p_ub, T_CHAR_2_FLD, 0), EXFALSE);
0185     assert_equal(Bpres(p_ub, T_FLOAT_2_FLD, 0), EXFALSE);
0186     assert_equal(Bpres(p_ub, T_DOUBLE_2_FLD, 0), EXFALSE);
0187     assert_equal(Bpres(p_ub, T_STRING_2_FLD, 0), EXFALSE);
0188     assert_equal(Bpres(p_ub, T_CARRAY_2_FLD, 0), EXFALSE);
0189 
0190     test_proj_data_1(p_ub);
0191 
0192     /* Now test complete delete */
0193 
0194     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0195     load_proj_test_data(p_ub);
0196     assert_equal(Bproj(p_ub, NULL), EXSUCCEED);
0197 
0198     assert_equal(Bpres(p_ub, T_SHORT_FLD, 0), EXFALSE);
0199     assert_equal(Bpres(p_ub, T_LONG_FLD, 0), EXFALSE);
0200     assert_equal(Bpres(p_ub, T_CHAR_FLD, 0), EXFALSE);
0201     assert_equal(Bpres(p_ub, T_FLOAT_FLD, 0), EXFALSE);
0202     assert_equal(Bpres(p_ub, T_DOUBLE_FLD, 0), EXFALSE);
0203     assert_equal(Bpres(p_ub, T_STRING_FLD, 0), EXFALSE);
0204     assert_equal(Bpres(p_ub, T_CARRAY_FLD, 0), EXFALSE);
0205 
0206     assert_equal(Bpres(p_ub, T_SHORT_2_FLD, 0), EXFALSE);
0207     assert_equal(Bpres(p_ub, T_LONG_2_FLD, 0), EXFALSE);
0208     assert_equal(Bpres(p_ub, T_CHAR_2_FLD, 0), EXFALSE);
0209     assert_equal(Bpres(p_ub, T_FLOAT_2_FLD, 0), EXFALSE);
0210     assert_equal(Bpres(p_ub, T_DOUBLE_2_FLD, 0), EXFALSE);
0211     assert_equal(Bpres(p_ub, T_STRING_2_FLD, 0), EXFALSE);
0212     assert_equal(Bpres(p_ub, T_CARRAY_2_FLD, 0), EXFALSE);
0213 
0214     /* Test the case when projection list is empty. */
0215     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0216     load_proj_test_data(p_ub);
0217     assert_equal(Bproj(p_ub, proj_empty), EXSUCCEED);
0218     assert_equal(Bpres(p_ub, T_SHORT_FLD, 0), EXFALSE);
0219     assert_equal(Bpres(p_ub, T_LONG_FLD, 0), EXFALSE);
0220     assert_equal(Bpres(p_ub, T_CHAR_FLD, 0), EXFALSE);
0221     assert_equal(Bpres(p_ub, T_FLOAT_FLD, 0), EXFALSE);
0222     assert_equal(Bpres(p_ub, T_DOUBLE_FLD, 0), EXFALSE);
0223     assert_equal(Bpres(p_ub, T_STRING_FLD, 0), EXFALSE);
0224     assert_equal(Bpres(p_ub, T_CARRAY_FLD, 0), EXFALSE);
0225 
0226     assert_equal(Bpres(p_ub, T_SHORT_2_FLD, 0), EXFALSE);
0227     assert_equal(Bpres(p_ub, T_LONG_2_FLD, 0), EXFALSE);
0228     assert_equal(Bpres(p_ub, T_CHAR_2_FLD, 0), EXFALSE);
0229     assert_equal(Bpres(p_ub, T_FLOAT_2_FLD, 0), EXFALSE);
0230     assert_equal(Bpres(p_ub, T_DOUBLE_2_FLD, 0), EXFALSE);
0231     assert_equal(Bpres(p_ub, T_STRING_2_FLD, 0), EXFALSE);
0232     assert_equal(Bpres(p_ub, T_CARRAY_2_FLD, 0), EXFALSE);
0233 
0234 
0235 }
0236 
0237 /**
0238  * This test projcpy function
0239  */
0240 Ensure(test_projcpy)
0241 {
0242     char fb_src[400];
0243     UBFH *p_ub_src = (UBFH *)fb_src;
0244     char fb_src2[2400];
0245     UBFH *p_ub_src2 = (UBFH *)fb_src2;
0246     
0247     char fb_dst[400];
0248     UBFH *p_ub_dst = (UBFH *)fb_dst;
0249     
0250     UBF_header_t *hsrc = (UBF_header_t *)p_ub_src;
0251     UBF_header_t *hdst = (UBF_header_t *)p_ub_dst;
0252 
0253     BFLDID proj[] = {
0254         T_SHORT_FLD,
0255         T_LONG_FLD,
0256         T_CHAR_FLD,
0257         T_FLOAT_FLD,
0258         T_DOUBLE_FLD,
0259         T_STRING_FLD,
0260         T_CARRAY_FLD,
0261         BBADFLDID
0262     };
0263     BFLDID proj_all[] = {
0264         T_SHORT_2_FLD,
0265         T_SHORT_2_FLD,
0266         T_LONG_2_FLD,
0267         T_CHAR_2_FLD,
0268         T_FLOAT_2_FLD,
0269         T_DOUBLE_2_FLD,
0270         T_STRING_2_FLD,
0271         T_CARRAY_2_FLD,
0272         T_SHORT_FLD,
0273         T_LONG_FLD,
0274         T_CHAR_FLD,
0275         T_FLOAT_FLD,
0276         T_DOUBLE_FLD,
0277         T_STRING_FLD,
0278         T_CARRAY_FLD,
0279         BBADFLDID
0280     };
0281 
0282     assert_equal(Binit(p_ub_src, sizeof(fb_src)), EXSUCCEED);
0283     assert_equal(Binit(p_ub_src2, sizeof(fb_src2)), EXSUCCEED);
0284     assert_equal(Binit(p_ub_dst, sizeof(fb_dst)), EXSUCCEED);
0285 
0286     load_proj_test_data(p_ub_src);
0287     /* Projcpy */
0288     assert_equal(Bprojcpy(p_ub_dst, p_ub_src, proj), EXSUCCEED);
0289     /* Projection */
0290     assert_equal(Bproj(p_ub_src, proj), EXSUCCEED);
0291     /* Compare the buffer to one what we get from proj */
0292     assert_equal(memcmp(p_ub_dst, p_ub_src, Bused(p_ub_dst)), EXSUCCEED);
0293     
0294     /* OK now test that all data have been copied! */
0295     load_proj_test_data(p_ub_src);
0296     assert_equal(Bprojcpy(p_ub_dst, p_ub_src, proj_all), EXSUCCEED);
0297     
0298     UBF_DUMP(log_debug, "Source buffer", p_ub_src, sizeof(fb_dst));
0299     
0300     UBF_LOG(log_debug, "hsrc dump short, 0: %ld", 0);
0301     UBF_LOG(log_debug, "hsrc dump long, 1: %ld", hsrc->cache_long_off);
0302     UBF_LOG(log_debug, "hsrc dump char, 2: %ld", hsrc->cache_char_off);
0303     UBF_LOG(log_debug, "hsrc dump float, 3: %ld", hsrc->cache_float_off);
0304     UBF_LOG(log_debug, "hsrc dump double, 4: %ld", hsrc->cache_double_off);
0305     UBF_LOG(log_debug, "hsrc dump string, 5: %ld", hsrc->cache_string_off);
0306     UBF_LOG(log_debug, "hsrc dump carray, 6: %ld", hsrc->cache_carray_off);
0307         
0308         
0309     assert_equal(memcmp(p_ub_dst, p_ub_src, Bused(p_ub_dst)), EXSUCCEED);
0310     UBF_DUMP(log_debug, "Dest buffer", p_ub_dst, sizeof(fb_dst));
0311     
0312         
0313     UBF_LOG(log_debug, "hdst dump short, 0: %ld", 0);
0314     UBF_LOG(log_debug, "hdst dump long, 1: %ld", hdst->cache_long_off);
0315     UBF_LOG(log_debug, "hdst dump char, 2: %ld", hdst->cache_char_off);
0316     UBF_LOG(log_debug, "hdst dump float, 3: %ld", hdst->cache_float_off);
0317     UBF_LOG(log_debug, "hdst dump double, 4: %ld", hdst->cache_double_off);
0318     UBF_LOG(log_debug, "hdst dump string, 5: %ld", hdst->cache_string_off);
0319     UBF_LOG(log_debug, "hdst dump carray, 6: %ld", hdst->cache_carray_off);
0320     
0321 
0322     /* Now test the spacing. We will put big string in src buffer,
0323      * but dest buffer will be shorter, so we must get error, that we do not have
0324      * a space!
0325      */
0326     load_proj_test_data(p_ub_src2);
0327     assert_equal(Bchg(p_ub_src2, T_STRING_FLD, 0, BIG_TEST_STRING, 0), EXSUCCEED);
0328     assert_equal(Bprojcpy(p_ub_dst, p_ub_src2, proj_all), EXFAIL);
0329     assert_equal(Berror, BNOSPACE);
0330 
0331 }
0332 
0333 /**
0334  * Test Bdelall function
0335  */
0336 Ensure(test_Bdelall)
0337 {
0338     char fb[1024];
0339     char buf[64];
0340     UBFH *p_ub = (UBFH *)fb;
0341     int len;
0342     BFLDID bfldid;
0343     BFLDOCC occ;
0344     int flds = 0;
0345     
0346     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0347     load_proj_test_data(p_ub);
0348     set_up_dummy_data(p_ub);
0349 
0350     assert_equal(Badd(p_ub, T_STRING_2_FLD, "TEST 2 data", 0), EXSUCCEED);
0351     /* Delete all string occurrances... */
0352     assert_equal(Bdelall(p_ub, T_STRING_2_FLD), EXSUCCEED);
0353     assert_equal(Bpres(p_ub, T_STRING_2_FLD, 0), EXFALSE);
0354     assert_equal(Bpres(p_ub, T_STRING_FLD, 0), EXTRUE);
0355     do_dummy_data_test(p_ub);
0356 
0357     /*----------------------------------------------------------*/
0358     /* Now do another test, as we are going to delete last element of the array */
0359     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0360     load_proj_test_data(p_ub);
0361     assert_equal(Bdelall(p_ub, T_CARRAY_2_FLD), EXSUCCEED);
0362 
0363     /* validate the post previous field is present */
0364     len = sizeof(buf);
0365     assert_equal(Bget(p_ub, T_CARRAY_FLD, 1, (char *)buf, &len), EXSUCCEED);
0366     assert_equal(strncmp(buf, "YARRAY1 TEST STRING DATA", len), 0);
0367     /*----------------------------------------------------------*/
0368     /* Check if we delete nothing, then this is error condition */
0369     assert_equal(Bdelall(p_ub, T_CARRAY_2_FLD), EXFAIL);
0370     assert_equal(Berror, BNOTPRES);
0371     
0372     
0373     /* Bug #148 */
0374     
0375     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0376     
0377     assert_equal(CBadd(p_ub, T_CHAR_FLD, "2", 0, BFLD_STRING), EXSUCCEED);
0378     assert_equal(CBadd(p_ub, T_STRING_FLD, "631419304311", 0, BFLD_STRING), EXSUCCEED);
0379     assert_equal(CBchg(p_ub, T_CHAR_FLD, 0, "Y", 0L, BFLD_STRING), EXSUCCEED);
0380     
0381     Bfprint(p_ub, stderr);
0382     
0383     assert_equal(Bdelall(p_ub, T_STRING_FLD), EXSUCCEED);
0384     
0385     NDRX_LOG(log_debug, "After T_STRING_FLD delete...");
0386     Bfprint(p_ub, stderr);
0387     
0388     assert_equal(CBchg(p_ub, T_CHAR_FLD, 0, "X", 0L, BFLD_STRING), EXSUCCEED);
0389     
0390     NDRX_LOG(log_debug, "After changed T_CHAR_FLD => occ: [%d]", 
0391             Boccur(p_ub, T_CHAR_FLD));
0392     
0393     Bfprint(p_ub, stderr);
0394     
0395     bfldid = BFIRSTFLDID;
0396     
0397     /* Only 1 field must be here! */
0398     while(1==Bnext(p_ub, &bfldid, &occ, NULL, NULL))
0399     {
0400         flds++;
0401     }
0402     
0403     assert_equal(flds, 1);
0404 }
0405 /**
0406  * Delete all items from 
0407  */
0408 Ensure(test_Bdelete)
0409 {
0410     char fb[1024];
0411     UBFH *p_ub = (UBFH *)fb;
0412     char fb2[1024];
0413     UBFH *p_ub2 = (UBFH *)fb2;
0414 
0415     BFLDID delete_fld2[] = {
0416         T_SHORT_2_FLD,
0417         T_SHORT_2_FLD,
0418         T_LONG_2_FLD,
0419         T_CHAR_2_FLD,
0420         T_FLOAT_2_FLD,
0421         T_DOUBLE_2_FLD,
0422         T_STRING_2_FLD,
0423         T_CARRAY_2_FLD,
0424         BBADFLDID
0425     };
0426 
0427     BFLDID delete_all[] = {
0428         T_SHORT_FLD,
0429         T_LONG_FLD,
0430         T_CHAR_FLD,
0431         T_FLOAT_FLD,
0432         T_DOUBLE_FLD,
0433         T_STRING_FLD,
0434         T_CARRAY_FLD,
0435         T_SHORT_2_FLD,
0436         T_SHORT_2_FLD,
0437         T_LONG_2_FLD,
0438         T_CHAR_2_FLD,
0439         T_FLOAT_2_FLD,
0440         T_DOUBLE_2_FLD,
0441         T_STRING_2_FLD,
0442         T_CARRAY_2_FLD,
0443         BBADFLDID
0444     };
0445 
0446 
0447     assert_equal(Binit(p_ub, sizeof(fb)), EXSUCCEED);
0448     load_proj_test_data(p_ub);
0449     assert_equal(Bdelete(p_ub, delete_fld2), EXSUCCEED);
0450     test_proj_data_1(p_ub);
0451     /*----------------------------------------------------------*/
0452     /* Now check the error, that nothing have been deleted */
0453     assert_equal(Bdelete(p_ub, delete_fld2), EXFAIL);
0454     assert_equal(Berror, BNOTPRES);
0455     /*----------------------------------------------------------*/
0456     /* Ok now we are about to delete all items */
0457     assert_equal(Binit(p_ub2, sizeof(fb2)), EXSUCCEED);
0458     assert_equal(Bdelete(p_ub, delete_all), EXSUCCEED);
0459             
0460     assert_equal(memcmp(p_ub, p_ub2, Bused(p_ub)), EXSUCCEED);
0461     
0462 }
0463 
0464 TestSuite *ubf_fproj_tests(void)
0465 {
0466     TestSuite *suite = create_test_suite();
0467 
0468     add_test(suite, test_proj_simple);
0469     add_test(suite, test_projcpy);
0470     add_test(suite, test_Bdelall);
0471     add_test(suite, test_Bdelete);
0472     
0473     return suite;
0474 }
0475