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