本文整理汇总了C++中TEST_DONE函数的典型用法代码示例。如果您正苦于以下问题:C++ TEST_DONE函数的具体用法?C++ TEST_DONE怎么用?C++ TEST_DONE使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TEST_DONE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testOperators
// ************************************************************
void
testOperators (void)
{
Value *result;
testName = "test value comparison and boolean operators";
MAKE_VALUE(result, DT_INT, 0);
// equality
OP_TRUE(stringToValue("i10"),stringToValue("i10"), valueEquals, "10 = 10");
OP_FALSE(stringToValue("i9"),stringToValue("i10"), valueEquals, "9 != 10");
OP_TRUE(stringToValue("sHello World"),stringToValue("sHello World"), valueEquals, "Hello World = Hello World");
OP_FALSE(stringToValue("sHello Worl"),stringToValue("sHello World"), valueEquals, "Hello Worl != Hello World");
OP_FALSE(stringToValue("sHello Worl"),stringToValue("sHello Wor"), valueEquals, "Hello Worl != Hello Wor");
// smaller
OP_TRUE(stringToValue("i3"),stringToValue("i10"), valueSmaller, "3 < 10");
OP_TRUE(stringToValue("f5.0"),stringToValue("f6.5"), valueSmaller, "5.0 < 6.5");
// boolean
OP_TRUE(stringToValue("bt"),stringToValue("bt"), boolAnd, "t AND t = t");
OP_FALSE(stringToValue("bt"),stringToValue("bf"), boolAnd, "t AND f = f");
OP_TRUE(stringToValue("bt"),stringToValue("bf"), boolOr, "t OR f = t");
OP_FALSE(stringToValue("bf"),stringToValue("bf"), boolOr, "f OR f = f");
TEST_CHECK(boolNot(stringToValue("bf"), result));
ASSERT_TRUE(result->v.boolV, "!f = t");
TEST_DONE();
}
示例2: testExpressions
// ************************************************************
void
testExpressions (void)
{
Expr *op, *l, *r;
Value *res;
testName = "test complex expressions";
MAKE_CONS(l, stringToValue("i10"));
evalExpr(NULL, NULL, l, &res);
OP_TRUE(stringToValue("i10"), res, valueEquals, "Const 10");
MAKE_CONS(r, stringToValue("i20"));
evalExpr(NULL, NULL, r, &res);
OP_TRUE(stringToValue("i20"), res, valueEquals, "Const 20");
MAKE_BINOP_EXPR(op, l, r, OP_COMP_SMALLER);
evalExpr(NULL, NULL, op, &res);
OP_TRUE(stringToValue("bt"), res, valueEquals, "Const 10 < Const 20");
MAKE_CONS(l, stringToValue("bt"));
evalExpr(NULL, NULL, l, &res);
OP_TRUE(stringToValue("bt"), res, valueEquals, "Const true");
r = op;
MAKE_BINOP_EXPR(op, r, l, OP_BOOL_AND);
evalExpr(NULL, NULL, op, &res);
OP_TRUE(stringToValue("bt"), res, valueEquals, "(Const 10 < Const 20) AND true");
TEST_DONE();
}
示例3: tests
void
tests(void)
{
char *loc;
TEST_START("utf8_setlocale");
loc = setlocale(LC_CTYPE, "en_US.UTF-8");
ASSERT_PTR_NE(loc, NULL);
TEST_DONE();
badarg();
one("null", NULL, 8, 6, 6, "(null)");
one("empty", "", 2, 0, 0, "");
one("ascii", "x", -2, -2, -2, "x");
one("newline", "a\nb", -2, -2, -2, "a\nb");
one("cr", "a\rb", -2, -2, -2, "a\rb");
one("tab", "a\tb", -2, -2, -2, "a\tb");
one("esc", "\033x", -2, -2, -2, "\\033x");
one("inv_badbyte", "\377x", -2, -2, -2, "\\377x");
one("inv_nocont", "\341x", -2, -2, -2, "\\341x");
one("inv_nolead", "a\200b", -2, -2, -2, "a\\200b");
one("sz_ascii", "1234567890123456", -2, -2, 16, "123456789012345");
one("sz_esc", "123456789012\033", -2, -2, 16, "123456789012");
one("width_ascii", "123", 2, 2, -1, "12");
one("width_double", "a\343\201\201", 2, 1, -1, "a");
one("double_fit", "a\343\201\201", 3, 3, 4, "a\343\201\201");
one("double_spc", "a\343\201\201", 4, 3, 4, "a\343\201\201");
}
示例4: testCreateTableAndInsert
// ************************************************************
void
testCreateTableAndInsert (void)
{
RM_TableData *table = (RM_TableData *) malloc(sizeof(RM_TableData));
TestRecord inserts[] = {
{1, "aaaa", 3},
{2, "bbbb", 2},
{3, "cccc", 1},
{4, "dddd", 3},
{5, "eeee", 5},
{6, "ffff", 1},
{7, "gggg", 3},
{8, "hhhh", 3},
{9, "iiii", 2}
};
int numInserts = 9, i;
Record *r;
RID *rids;
Schema *schema;
testName = "test creating a new table and inserting tuples";
schema = testSchema();
rids = (RID *) malloc(sizeof(RID) * numInserts);
TEST_CHECK(initRecordManager(NULL));
//printf("\n Testing create table");
TEST_CHECK(createTable("test_table_r.txt",schema));
//printf("\n Testing open Table");
TEST_CHECK(openTable(table, "test_table_r.txt"));
printf("\n Opened ");
// insert rows into table
for(i = 0; i < numInserts; i++)
{
printf("\n Inserting");
r = fromTestRecord(schema, inserts[i]);
TEST_CHECK(insertRecord(table,r));
rids[i] = r->id;
}
TEST_CHECK(closeTable(table));
TEST_CHECK(openTable(table, "test_table_r.txt"));
printf("\n Opened successsfully");
// randomly retrieve records from the table and compare to inserted ones
for(i = 0; i < 1000; i++)
{
int pos = rand() % numInserts;
RID rid = rids[pos];
printf("\n getting records");
TEST_CHECK(getRecord(table, rid, r));
ASSERT_EQUALS_RECORDS(fromTestRecord(schema, inserts[pos]), r, schema, "compare records");
}
TEST_CHECK(closeTable(table));
TEST_CHECK(deleteTable("test_table_r.txt"));
TEST_CHECK(shutdownRecordManager());
free(rids);
free(table);
TEST_DONE();
}
示例5: test_s2k
void
test_s2k(void)
{
TEST_START("s2k");
static unsigned char salt[S2K_SALT_BYTES] = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 };
const char * pphrase = "ImGumbyAndYouAreNot";
static unsigned char expected_key1[AES128_KEY_BYTES] = {
0x0e, 0xa5, 0x00, 0x1c, 0xce, 0xad, 0x7e, 0xa8, 0xa0, 0x81, 0x38, 0xae, 0xaf, 0x4e, 0x28, 0xd5
};
unsigned char s2k_key1[AES128_KEY_BYTES];
compute_gpg_s2k_key(pphrase, sizeof(s2k_key1), salt, S2K_ITER_BYTE_COUNT, s2k_key1);
ASSERT_INT_EQ(memcmp(s2k_key1, expected_key1, sizeof(s2k_key1)), 0);
// Second test to handle the case where we need to run multiple hashes to generate enough bits
// Note that the first 16 bytes are the same as the previous test - this is to be expected, since the
// salt and passphrase are the same, so the first hash is executed identically.
static unsigned char expected_key2[48] = {
0x0e, 0xa5, 0x00, 0x1c, 0xce, 0xad, 0x7e, 0xa8, 0xa0, 0x81, 0x38, 0xae, 0xaf, 0x4e, 0x28, 0xd5,
0x21, 0xf1, 0xee, 0x4b, 0x02, 0xc0, 0x0f, 0x63, 0x6a, 0x17, 0xbf, 0x62, 0x34, 0x10, 0x26, 0x48,
0x7b, 0xc6, 0x3f, 0x08, 0x9d, 0xb5, 0x6b, 0x34, 0x70, 0x3b, 0x71, 0xdb, 0x67, 0x92, 0x6f, 0x5f
};
unsigned char s2k_key2[48];
compute_gpg_s2k_key(pphrase, sizeof(s2k_key2), salt, S2K_ITER_BYTE_COUNT, s2k_key2);
ASSERT_INT_EQ(memcmp(s2k_key2, expected_key2, sizeof(s2k_key2)), 0);
TEST_DONE();
}
示例6: testReadPage
void
testReadPage ()
{
BM_BufferPool *bm = MAKE_POOL();
BM_PageHandle *h = MAKE_PAGE_HANDLE();
testName = "Reading a page";
CHECK(createPageFile("testbuffer.bin"));
CHECK(initBufferPool(bm, "testbuffer.bin", 3, RS_FIFO, NULL));
CHECK(pinPage(bm, h, 0));
CHECK(pinPage(bm, h, 0));
CHECK(markDirty(bm, h));
CHECK(unpinPage(bm,h));
CHECK(unpinPage(bm,h));
CHECK(forcePage(bm, h));
CHECK(shutdownBufferPool(bm));
CHECK(destroyPageFile("testbuffer.bin"));
free(bm);
free(h);
TEST_DONE();
}
示例7: TEST_INIT
int
Test::Main()
{
TEST_INIT("false_test");
EXPECT_TRUE(false);
TEST_DONE();
}
示例8: testCreatingAndRandomReadingDummyPages
// create pages 100 with content "Page X" and perform 10000 random reads of these pages and check that the correct pages are read
void
testCreatingAndRandomReadingDummyPages (void)
{
int i;
BM_BufferPool *bm = MAKE_POOL();
testName = "Creating and Dummy Pages and reading them in random order";
CHECK(createPageFile("testbuffer.bin"));
createDummyPages(bm, 100);
CHECK(initBufferPool(bm, "testbuffer.bin", 10, RS_FIFO, NULL));
srand(time(0));
for(i = 0; i < 10000; i++)
{
int page = rand() % NUM_DUMMY_PAGES;
readAndCheckDummyPage(bm, page);
}
CHECK(shutdownBufferPool(bm));
CHECK(destroyPageFile("testbuffer.bin"));
free(bm);
TEST_DONE();
}
示例9: main
void main()
{
Schema *temp;
char *s = (char *)malloc(100), **c = (char *)malloc(100 * 10);
temp = testSchema();
char *res = (char *)malloc(1000);
RM_TABLE_INFO *newTable = (RM_TABLE_INFO *)malloc(sizeof(RM_TABLE_INFO)), *outPutTable = (RM_TABLE_INFO *)malloc(sizeof(RM_TABLE_INFO));
RID *newRID = (RID *)malloc(sizeof(RID));
newRID->page = 1;
newRID->slot = 1;
newTable->s = temp;
newTable->firstFreeRec = newRID;
serializeTableInformation("testTable", newTable, res);
printf("%s\n", res);
deSerializeTableInformation(res, outPutTable);
if (checkEqual(newTable, outPutTable) == TRUE)
printf("successful serialization and deserialization\n");
else
printf("unsuccessful serialization and deserialization\n");
free(res);
free(newRID);
free(newTable);
if (testTombstone() == RC_OK) {
printf("successful implementation of tombstone\n");
}
TEST_DONE();
}
示例10: TEST_INIT
int
Test::Main()
{
TEST_INIT("printabletest");
testSimple();
testAsciiVariant();
TEST_DONE();
}
示例11: testClock
void
testClock(void)
{
// expected results
const char *poolContents[]= {
"[3x0],[-1 0],[-1 0],[-1 0]",
"[3x0],[2 0],[-1 0],[-1 0]",
"[3x0],[2 0],[0 0],[-1 0]",
"[3x0],[2 0],[0 0],[8 0]",
"[4 0],[2 0],[0 0],[8 0]",
"[4 0],[2 0],[0 0],[8 0]",
"[4 0],[2 0],[5 0],[8 0]",
"[4 0],[2 0],[5 0],[0 0]",
"[9 0],[2 0],[5 0],[0 0]",
"[9 0],[8 0],[5 0],[0 0]",
"[9 0],[8 0],[3x0],[0 0]",
"[9 0],[8 0],[3x0],[2 0]"
};
const int orderRequests[]= {3,2,0,8,4,2,5,0,9,8,3,2};
int i;
int snapshot = 0;
BM_BufferPool *bm = MAKE_POOL();
BM_PageHandle *h = MAKE_PAGE_HANDLE();
testName = "Testing CLOCK page replacement";
CHECK(createPageFile("testbuffer.bin"));
createDummyPages(bm, 100);
CHECK(initBufferPool(bm, "testbuffer.bin", 4, RS_CLOCK, NULL));
for (i=0;i<11;i++)
{
pinPage(bm,h,orderRequests[i]);
if(orderRequests[i] == 3)
markDirty(bm,h);
unpinPage(bm,h);
ASSERT_EQUALS_POOL(poolContents[snapshot++], bm, "check pool content using pages");
}
forceFlushPool(bm);
// check number of write IOs
ASSERT_EQUALS_INT(2, getNumWriteIO(bm), "check number of write I/Os");
ASSERT_EQUALS_INT(10, getNumReadIO(bm), "check number of read I/Os");
CHECK(shutdownBufferPool(bm));
CHECK(destroyPageFile("testbuffer.bin"));
free(bm);
free(h);
TEST_DONE();
}
示例12: TEST_INIT
int
Test::Main()
{
TEST_INIT("generationhandler_test");
TEST_DO(requireThatGenerationCanBeIncreased());
TEST_DO(requireThatReadersCanTakeGuards());
TEST_DO(requireThatGuardsCanBeCopied());
TEST_DO(requireThatTheFirstUsedGenerationIsCorrect());
TEST_DO(requireThatGenerationCanGrowLarge());
TEST_DONE();
}
示例13: testValueSerialize
// ************************************************************
void
testValueSerialize (void)
{
testName = "test value serialization and deserialization";
ASSERT_EQUALS_STRING(serializeValue(stringToValue("i10")), "10", "create Value 10");
ASSERT_EQUALS_STRING(serializeValue(stringToValue("f5.3")), "5.300000", "create Value 5.3");
ASSERT_EQUALS_STRING(serializeValue(stringToValue("sHello World")), "Hello World", "create Value Hello World");
ASSERT_EQUALS_STRING(serializeValue(stringToValue("bt")), "true", "create Value true");
ASSERT_EQUALS_STRING(serializeValue(stringToValue("btrue")), "true", "create Value true");
TEST_DONE();
}
示例14: testPrintTree
void
testPrintTree(void)
{
RID insert[] = {
{1,1},
{2,3},
{1,2},
{3,5},
{4,4},
{3,2},
};
int numInserts = 6;
Value **keys;
char *stringKeys[] = {
"i1",
"i11",
"i13",
"i17",
"i23",
"i52"
};
testName = "test b-tree print";
int i, testint;
BTreeHandle *tree = NULL;
keys = createValues(stringKeys, numInserts);
// init
TEST_CHECK(initIndexManager(NULL));
TEST_CHECK(createBtree("testidx", DT_INT, 2));
TEST_CHECK(openBtree(&tree, "testidx"));
printf("0"); // remove it later
// insert keys
for(i = 0; i < numInserts; i++)
TEST_CHECK(insertKey(tree, keys[i], insert[i]));
char * expected = "(0)[1,13,2,23,3]\n(1)[1.1,1,2.3,11,2]\n(2)[1.2,13,3.5,17,3]\n(3)[4.4,23,3.2,52]\n";
//test printTree function
ASSERT_EQUALS_STRING(expected,printTree(tree),"checking b-tree shape"); \
// cleanup
TEST_CHECK(closeBtree(tree));
TEST_CHECK(deleteBtree("testidx"));
TEST_CHECK(shutdownIndexManager());
freeValues(keys, numInserts);
TEST_DONE();
}
示例15: TEST_INIT
int
Test::Main()
{
TEST_INIT("programoptions_test");
srandom(1);
testSyntaxPage();
testNormalUsage();
testFailures();
testVectorArgument();
testAllHiddenOption();
// Currently not supported
// testOptionsAfterArguments();
TEST_DONE();
}