/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2003-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Phong Vo <kpv@research.att.com> *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#include "vctest.h"
#include <vcrdb.h>
/* Test the suite of functions for dealing with relational data
**
** Written by Kiem-Phong Vo
*/
/* dependency between two strings, ie, str1 and str2 always correspond */
typedef struct _depend_s
} Depend_t;
};
};
};
#ifdef DEBUG
#else
#endif
int main()
{
terror("rdb plugin not found");
/* generate a random set of records */
for(k = 0, r = 0; r < N_RECORDS; ++r)
{ /* fill in fields 0 and 1 */
n += 1;
/* fill in fields 2 and 3 */
n += 1;
/* fill in fields 4 and 5 */
n += 1;
}
/* see if vcrdsepar() computes the correct separators fsep and rsep */
terror("vcrdsepar(): Failed to compute separators rv=%d", r);
twarn("Unexpected separators found");
/* construct table */
terror("vcrdparse(): Can't construct table");
/* check different modes of extraction of field data */
terror("vcrdextract(): failed to get a field data1");
terror("vcrdattrs(): can't make fields full length");
terror("vcrdextract(): failed to get a field data2");
if(n == k)
twarn("vcrdextract(): unfilled=%d filled=%d", k, n);
terror("vcrdextract(): retrieved data size is wrong");
/* test table construction with filled data */
terror("vcrdparse(): Can't open test table");
terror("vcrdextract(): failed on field %d", k);
terror("vcrdfield(): failed on field %d rv=%d", k, n);
}
/* extract padded data to see if the right size */
if(r != n)
terror("vcrdextract(): failed to extract data dtsz=%d rv=%d", n, r);
/* extract variable-sized data, should be the same as Data[] */
if(r != dtsz )
terror("vcrdextract(): extracted data were bad");
/* test transformation plan making */
terror("vcrdmakeplan() failed");
terror("vcrdmakeplan(): fields 0 did not predict field 1.");
terror("vcrdmakeplan(): fields 2 did not predict field 3.");
terror("vcrdmakeplan(): fields 4 did not predict field 5.");
/* test transformation plan execution */
terror("vcrdexecplan() encoding failed");
if(r != dtsz)
terror("vcrdextract(): failed after plan transformation");
terror("vcrdexecplan() decoding failed");
if(r != dtsz)
terror("vcrdextract(): failed after plan transformation");
terror("vcrdextract(): extracted data were bad after transformation");
/* test internal field transformation */
terror("Cannot extract field 1");
terror("Couldn't get tranformed data for field 1");
terror("Got the wrong size of transformed data");
terror("Couldn't decode tranformed data for field 1");
terror("Got the wrong size of untransformed data");
terror("Cannot extract field 1 after decoding");
terror("Wrong data");
}
/* open secondary coders for the transform Vcrdb */
terror("vcopen(): can't open Vchuffgroup handles");
terror("vcopen(): can't open Vcrle handles");
terror("vcopen(): can't open Vcmtf handles");
terror("vcopen(): can't open Vctable handles");
terror("vcopen(): can't open Vcbwt handles");
/* test compression by field only - no transformation */
terror("vcopen(): can't open Vcrdb handles");
terror("vcapply(): fail to encode");
terror("vcapply(): fail to decode");
terror("Data do not match");
twarn("\tSorted field: Raw size=%d Compressed size=%d", n, e);
/* test compression by field only - no transformation */
terror("vcopen(): can't open Vcrdb handles");
terror("vcapply(): fail to encode");
terror("vcapply(): fail to decode");
terror("Data do not match");
twarn("\tPlain+bwt: Raw size=%d Compressed size=%d", n, e);
/* test compression by field with transformation */
terror("vcopen(): can't open Vcrdb handles");
terror("vcapply(): fail to encode");
terror("vcapply(): fail to decode");
terror("Data do not match");
twarn("\tTransform+bwt: Raw size=%d Compressed size=%d", n, e);
/* test compression by padded field */
terror("vcopen(): can't open Vcrdb handles");
terror("vcapply(): fail to encode");
terror("vcapply(): fail to decode");
terror("Data do not match");
twarn("\tTransform+Padded fields+bwt: Raw size=%d Compressed size=%d", n, e);
/* test compression by padded field plus the table compressor */
terror("vcopen(): can't open Vcrdb handles");
terror("vcapply(): fail to encode");
terror("vcapply(): fail to decode");
terror("Data do not match");
twarn("\tTransform+Padded fields+Vctable: Raw size=%d Compressed size=%d", n, e);
/* test compression by padded field plus the table compressor for whole table */
terror("vcopen(): can't open Vcrdb handles");
terror("vcapply(): fail to encode");
terror("vcapply(): fail to decode");
terror("Data do not match");
twarn("\tTransform+Padded fields+Vctable on whole table: Raw size=%d Compressed size=%d", n, e);
/* test transformation of records with missing fields */
terror("vcopen(): can't open Vcrdb handles");
terror("vcapply(): fail to encode");
terror("vcapply(): fail to decode");
terror("Data do not match");
terror("vcopen(): can't open Vcrdb handles");
terror("vcapply(): fail to encode");
terror("vcapply(): fail to decode");
terror("Data do not match");
return 0;
}