本文整理汇总了C++中do_test函数的典型用法代码示例。如果您正苦于以下问题:C++ do_test函数的具体用法?C++ do_test怎么用?C++ do_test使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_test函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_tmplayer_do_test
static void
test_tmplayer_do_test (SubParseInputChunk * input, guint num)
{
do_test (input, num, "utf8");
}
开发者ID:lubing521,项目名称:gst-embedded-builder,代码行数:5,代码来源:subparse.c
示例2: main
int main() {
start_regex_engine();
do_test();
cleanup_regex_engine();
return 0;
}
开发者ID:jtibbertsma,项目名称:regex-engine,代码行数:6,代码来源:main.c
示例3: main
int main(int argc, char** argv)
{
(void)argc;
(void)argv;
#if 1
const char* testFiles[] = {
"ocremix_tests/7th Saga - Seven Songs for Seventh Saga/FLAC/01 Seven Songs for Seventh Saga - I. Wind.flac",
"ocremix_tests/7th Saga - Seven Songs for Seventh Saga/FLAC/02 Seven Songs for Seventh Saga - II. Water.flac",
"ocremix_tests/7th Saga - Seven Songs for Seventh Saga/FLAC/03 Seven Songs for Seventh Saga - III. Star.flac",
"ocremix_tests/7th Saga - Seven Songs for Seventh Saga/FLAC/04 Seven Songs for Seventh Saga - IV. Sky.flac",
"ocremix_tests/7th Saga - Seven Songs for Seventh Saga/FLAC/05 Seven Songs for Seventh Saga - V. Moon.flac",
"ocremix_tests/7th Saga - Seven Songs for Seventh Saga/FLAC/06 Seven Songs for Seventh Saga - VI. Light.flac",
"ocremix_tests/7th Saga - Seven Songs for Seventh Saga/FLAC/07 Seven Songs for Seventh Saga - VII. Wizard.flac",
"ocremix_tests/Apex 2015 - This Is the Moment/FLAC/01 John Ryan - This Is the Moment [Main Theme of Apex 2015].flac",
"ocremix_tests/Apex 2015 - This Is the Moment/FLAC/02 DusK - A Day Like No Other [Ultimate Marvel vs. Capcom 3].flac",
"ocremix_tests/Apex 2015 - This Is the Moment/FLAC/03 DarkeSword - Got My Mind on My Money Match [Super Smash Bros. for Wii U].flac",
"ocremix_tests/Apex 2015 - This Is the Moment/FLAC/04 CJthemusicdude - Smashed Fridge Bits [Super Smash Bros. Melee].flac",
"ocremix_tests/Apex 2015 - This Is the Moment/FLAC/05 Amphibious - Forest Fire [Pokemon X and Y].flac",
"ocremix_tests/Apex 2015 - This Is the Moment/FLAC/06 DjjD - Bull in a China Shop [Super Smash Bros. Melee].flac",
"ocremix_tests/Apex 2015 - This Is the Moment/FLAC/07 Sixto Sounds - Falcon DREAM!! [Super Smash Bros. Brawl].flac",
"ocremix_tests/Apex 2015 - This Is the Moment/FLAC/08 WillRock - Filler Instinct [Killer Instinct].flac",
"ocremix_tests/Apex 2015 - This Is the Moment/FLAC/09 Neblix - Girl from Another World [Ultra Street Fighter IV].flac",
"ocremix_tests/Apex 2015 - This Is the Moment/FLAC/10 Ivan Hakstok - May the Stars Light Your Way [Guilty Gear Xrd].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/01 O_Super x Mag.Lo - CEO Champion [Main Theme of CEO 2015].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/02 Jeff Matthews - The Last Kill [Killer Instinct].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/03 DarkeSword - Kuro Yuki [Persona 4 Arena].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/04 DjjD - Prodigious Blitz [Tekken Tag Tournament 2].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/05 Richie Branson - Iron Fist [Tekken Theme of CEO 2015].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/06 Flexstyle - It's Okay, I Still Made Money [Divekick].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/07 zykO - #unanimous #undisputed [Super Smash Bros. for Wii U].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/08 Benjamin Briggs - FALCON PUNCH [Super Smash Bros. Theme of CEO 2015].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/09 Neblix - Together, We Fly [Super Smash Bros. Melee].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/10 DarkeSword - Fatalistic [Mortal Kombat].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/11 Richie Branson - Finish Him [Mortal Kombat Theme of CEO 2015].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/12 DarkeSword - U JELLY! [Guilty Gear X].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/13 Nutritious - Dash Cancel [Ultra Street Fighter IV].flac",
"ocremix_tests/CEO 2015 - Champion/FLAC/14 Ivan Hakstok, Sixto Sounds - What's Your Poison [Ultimate Marvel vs. Capcom 3].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-01 Preluematsude (Prelude) [Jeff Ball].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-02 The Last March (The Imperial Army) [Dr. Manhattan].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-03 Rebirth (Revival) [Brandon Strader].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-04 Rebel Dream [Main Theme (FF1), The Rebel Army, Find Your Way (FF8), Main Theme] (BONKERS).flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-05 Leon Is a Fucking Dick (Battle Theme 1) [Kidd Cabbage].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-06 garLACTUS Win [Victory, Fanfare (FF7)] (Darkmoocher).flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-07 Deuces (Ancient Castle) [mellogear].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-08 Firion N Maria (Will Take You to the Rebels) [The Rebel Army] (PrototypeRaptor).flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-09 Analog Freedom (Town, The Rebel Army) [BONKERS].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-10 the final WON (Battle Theme A, Victory) [W!SE the all.E].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/1-11 Rebellion (Dead Music, The Rebel Army) [Brandon Strader, Chernabogue, Detective Tuesday].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/2-01 Heroes of Dawn [Chaos Temple (FF1), Reunion, The Rebel Army, Deep Under the Water (FF3), Dead Music (FF1)] (PacificPoem).flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/2-02 Snakeyes (Battle Theme B) [zykO].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/2-03 Grind My Crank (Tower of the Magi) [XPRTNovice].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/2-04 Personification of Evil (The Emperor's Rebirth, Escape!) [Tuberz McGee].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/2-05 A Kingdom Fallen (Main Theme) [Sixto Sounds].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/2-06 Torchlit (Dungeon) [Viking Guitar].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/2-07 GG but ___ Solos Win [Victory, The Winner (FF8)] (Sir Jordanius feat. Brandon Strader).flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/2-08 Castellum Infernum (Castle Pandemonium) [Brandon Strader].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/2-09 Imperial Rapture (Battle Theme 2) [IanFitC].flac",
"ocremix_tests/Final Fantasy II - Rebellion/FLAC/2-10 Finally (Finale) [Hat].flac",
"ocremix_tests/01 The Orichalcon - megAsfear (Title).flac",
"ocremix_tests/02 Evil Horde - Running from Evil Horde (MAP01 - Running from Evil).flac",
"ocremix_tests/03 analoq - Adrian's Sleep (MAP25 - Adrian's Asleep).flac",
"ocremix_tests/04 Mazedude - Westside Archvile (MAP20 - Message for the Archvile).flac",
"ocremix_tests/05 Jovette Rivera - The Countdown (MAP03 - Countdown to Death).flac",
"ocremix_tests/06 The Orichalcon - Crushing Headache (MAP06 - In the Dark).flac",
"ocremix_tests/07 Mazedude - Silent Healer (MAP02 - The Healer Stalks).flac",
"ocremix_tests/08 Big Giant Circles, Flik - Icon of Sinwave (MAP30 - Opening to Hell).flac",
"ocremix_tests/09 John Revoredo - 31 Seconds (MAP09 - Into Sandy's City).flac",
"ocremix_tests/10 Mazedude, Ailsean - The End of Hell (Endgame).flac",
"ocremix_tests/11 phoenixdk - No Smoking Area (MAP23 - Bye Bye American Pie).flac",
"ocremix_tests/12 Evil Horde - The Duel (MAP08 - The Dave D. Taylor Blues).flac",
"ocremix_tests/13 djpretzel - Red Waltz (Intermission).flac",
"ocremix_tests/Bonus phoenixdk - Ablaze (MAP10 - The Demon's Dead).flac",
"Hallelujah.flac",
"1 Sullivan The Lost Chord, Seated one day at the organ.FLAC",
"1 Vaet Videns Dominus.FLAC",
"3 Schubert String Quartet No 14 in D minor Death and the Maiden, D810 - Movement 3 Scherzo Allegro molto.FLAC",
"14 Clementi Piano Sonata in D major, Op 25 No 6 - Movement 2 Un poco andante.FLAC",
"E+questa+vita+un+lampo+Studio+Master.flac",
"recit24bit.flac",
"recit16bit.flac",
"recit8bit.flac",
"song1.flac",
"BIS1536-001-flac_24.flac",
"BIS1447-002-flac_24.flac",
};
unsigned int testCount = sizeof(testFiles) / sizeof(testFiles[0]);
for (unsigned int i = 0; i < testCount; ++i)
{
const char* filename = testFiles[i];
if (do_test(filename)) {
printf("TEST PASSED: %s\n", filename);
}
//.........这里部分代码省略.........
开发者ID:alzwded,项目名称:dr_libs,代码行数:101,代码来源:dr_flac_test1.c
示例4: fptest1
void fptest1( CYG_ADDRWORD id )
{
while(1)
do_test( fpt1_values, FP1_COUNT, 2000000000, id, "fptest1" );
}
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:5,代码来源:fptest.c
示例5: fptest3
void fptest3( CYG_ADDRWORD id )
{
while(1)
do_test( fpt3_values, FP3_COUNT, 2000000000, id, "fptest3" );
}
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:5,代码来源:fptest.c
示例6: __test__bpf
static int __test__bpf(int idx)
{
int ret;
void *obj_buf;
size_t obj_buf_sz;
struct bpf_object *obj;
ret = test_llvm__fetch_bpf_obj(&obj_buf, &obj_buf_sz,
bpf_testcase_table[idx].prog_id,
true, NULL);
if (ret != TEST_OK || !obj_buf || !obj_buf_sz) {
pr_debug("Unable to get BPF object, %s\n",
bpf_testcase_table[idx].msg_compile_fail);
if (idx == 0)
return TEST_SKIP;
else
return TEST_FAIL;
}
obj = prepare_bpf(obj_buf, obj_buf_sz,
bpf_testcase_table[idx].name);
if ((!!bpf_testcase_table[idx].target_func) != (!!obj)) {
if (!obj)
pr_debug("Fail to load BPF object: %s\n",
bpf_testcase_table[idx].msg_load_fail);
else
pr_debug("Success unexpectedly: %s\n",
bpf_testcase_table[idx].msg_load_fail);
ret = TEST_FAIL;
goto out;
}
if (obj) {
ret = do_test(obj,
bpf_testcase_table[idx].target_func,
bpf_testcase_table[idx].expect_result);
if (ret != TEST_OK)
goto out;
if (bpf_testcase_table[idx].pin) {
int err;
if (!bpf_fs__mount()) {
pr_debug("BPF filesystem not mounted\n");
ret = TEST_FAIL;
goto out;
}
err = mkdir(PERF_TEST_BPF_PATH, 0777);
if (err && errno != EEXIST) {
pr_debug("Failed to make perf_test dir: %s\n",
strerror(errno));
ret = TEST_FAIL;
goto out;
}
if (bpf_object__pin(obj, PERF_TEST_BPF_PATH))
ret = TEST_FAIL;
if (rm_rf(PERF_TEST_BPF_PATH))
ret = TEST_FAIL;
}
}
out:
bpf__clear();
return ret;
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:64,代码来源:bpf.c
示例7: main
/*ARGSUSED*/
int
main(int argc, char *argv[])
{
char *brk_max_addr, *hole_addr, *brk_start, *hole_start;
size_t pagesize = (size_t)sysconf(_SC_PAGE_SIZE);
time_t t;
progname = argv[0];
(void)time(&t);
// (void)printf("%s: Started %s", argv[0], ctime(&t));
if ((brk_start = sbrk(0)) == NEG1) {
ERROR("initial sbrk failed");
anyfail();
}
if ((u_long)brk_start % (u_long)pagesize) {
if (sbrk(pagesize - ((u_long)brk_start % (u_long)pagesize))
== NEG1)
{
ERROR("couldn't round up brk to a page boundary");
anyfail();
}
}
/* The brk is now at the beginning of a page. */
if ((hole_addr = hole_start = sbrk(NUM_SEGS * 2 * pagesize)) == NEG1) {
ERROR("couldn't brk large space for segments");
anyfail();
}
if ((brk_max_addr = sbrk(0)) == NEG1) {
ERROR("couldn't find top of brk");
anyfail();
}
do_test((caddr_t)brk_max_addr, pagesize);
/* now make holes and repeat test */
while (hole_addr + pagesize < brk_max_addr) {
if (munmap(hole_addr, pagesize) == -1) {
ERROR("failed to munmap odd hole in brk segment");
anyfail();
}
hole_addr += 2 * pagesize;
}
if (brk_max_addr != sbrk(0)) {
ERROR("do_test should leave the top of brk where it began");
anyfail();
}
do_test((caddr_t)brk_max_addr, pagesize);
/* Shrink brk */
if (sbrk(-NUM_SEGS * pagesize) == NEG1) {
ERROR("couldn't brk back over holes");
anyfail();
}
if ((brk_max_addr = sbrk(0)) == NEG1) {
ERROR("couldn't find top of break again");
anyfail();
}
/* sbrked over about half the holes */
hole_addr = hole_start + pagesize; /* munmap the other pages */
while (hole_addr + pagesize < brk_max_addr) {
if (munmap(hole_addr, pagesize) == -1) {
ERROR("failed to munmap even hole in brk segment");
anyfail();
}
hole_addr += 2 * pagesize;
}
/* munmaped the rest of the brk except a little at the beginning */
if (brk(brk_start) == -1) {
ERROR("failed to completely remove brk");
anyfail();
}
if (sbrk(pagesize) == NEG1 || sbrk(-pagesize) == NEG1) {
ERROR("failed to fiddle with brk at the end");
anyfail();
}
/* Ask for a ridiculously large mmap region at a high address */
if (mmap((caddr_t)(1UL << (POINTER_SIZE - 1)) - pagesize,
(size_t)((1UL << (POINTER_SIZE - 1)) - pagesize),
PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_FIXED|MAP_SHARED, 0, 0)
!= (caddr_t)-1)
{
ERROR("really large mmap didn't fail");
anyfail();
}
if (errno != ENOMEM && errno != EINVAL) {
ERROR("really large mmap didn't set errno = ENOMEM nor EINVAL");
anyfail();
}
(void)time(&t);
// (void)printf("%s: Finished %s", argv[0], ctime(&t));
ok_exit();
tst_exit();
}
开发者ID:joyforu,项目名称:android-ltp-ndk,代码行数:98,代码来源:mmapstress03.c
示例8: check_add_subtract_overflow
static void
check_add_subtract_overflow (void)
{
int i;
for (i = 0; i < NREPS; i++)
{
/* Div to avoid addition overflows; we're looking for lcd conversion overflows here. */
int exp_a = rand () % 1000;
int exp_b = rand () % 1000;
gint64 bin_deno_a = (exp_a == 0 ? 1 : exp_a);
gint64 bin_deno_b = (exp_b == 0 ? 1 : exp_b);
/*
int exp_a = rand () % 11;
int exp_b = rand () % 11;
gint64 bin_deno_a = (1 << exp_a);
gint64 bin_deno_b = (1 << exp_a);
*/
gint64 dec_deno_a = powten (exp_a % 7);
gint64 dec_deno_b = powten (exp_b % 7);
gint64 na = get_random_gint64 () % (1000000 * dec_deno_a);
gint64 nb = get_random_gint64 () % (1000000 * dec_deno_b);
gnc_numeric result;
GNCNumericErrorCode err;
gchar *errmsg;
gnc_numeric ba = gnc_numeric_create(na, bin_deno_a);
gnc_numeric bb = gnc_numeric_create(nb, bin_deno_b);
gnc_numeric da = gnc_numeric_create(na, dec_deno_a);
gnc_numeric db = gnc_numeric_create(nb, dec_deno_b);
gchar *ba_str = gnc_numeric_to_string (ba);
gchar *bb_str = gnc_numeric_to_string (bb);
gchar *da_str = gnc_numeric_to_string (da);
gchar *db_str = gnc_numeric_to_string (db);
/* Add */
result = gnc_numeric_add(ba, bb, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
err = gnc_numeric_check (result);
errmsg = g_strdup_printf ("%s + %s raised %s", ba_str, bb_str,
gnc_numeric_errorCode_to_string (err));
do_test (err == 0, errmsg);
g_free (errmsg);
result = gnc_numeric_add(da, bb, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
err = gnc_numeric_check (result);
errmsg = g_strdup_printf ("%s + %s raised %s", da_str, bb_str,
gnc_numeric_errorCode_to_string (err));
do_test (err == 0, errmsg);
g_free (errmsg);
result = gnc_numeric_add(ba, db, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
err = gnc_numeric_check (result);
errmsg = g_strdup_printf ("%s + %s raised %s", ba_str, db_str,
gnc_numeric_errorCode_to_string (err));
do_test (err == 0, errmsg);
g_free (errmsg);
result = gnc_numeric_add(da, db, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
err = gnc_numeric_check (result);
errmsg = g_strdup_printf ("%s + %s raised %s", da_str, db_str,
gnc_numeric_errorCode_to_string (err));
do_test (err == 0, errmsg);
g_free (errmsg);
/* Subtract */
result = gnc_numeric_sub(ba, bb, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
err = gnc_numeric_check (result);
errmsg = g_strdup_printf ("%s + %s raised %s", ba_str, bb_str,
gnc_numeric_errorCode_to_string (err));
do_test (err == 0, errmsg);
g_free (errmsg);
result = gnc_numeric_sub(da, bb, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
err = gnc_numeric_check (result);
errmsg = g_strdup_printf ("%s + %s raised %s", da_str, bb_str,
gnc_numeric_errorCode_to_string (err));
do_test (err == 0, errmsg);
g_free (errmsg);
result = gnc_numeric_sub(ba, db, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
err = gnc_numeric_check (result);
errmsg = g_strdup_printf ("%s + %s raised %s", ba_str, db_str,
gnc_numeric_errorCode_to_string (err));
do_test (err == 0, errmsg);
g_free (errmsg);
result = gnc_numeric_sub(da, db, GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);
err = gnc_numeric_check (result);
errmsg = g_strdup_printf ("%s + %s raised %s", da_str, db_str,
gnc_numeric_errorCode_to_string (err));
do_test (err == 0, errmsg);
g_free (errmsg);
g_free (ba_str);
g_free (bb_str);
g_free (da_str);
g_free (db_str);
}
//.........这里部分代码省略.........
开发者ID:c-holtermann,项目名称:gnucash,代码行数:101,代码来源:test-numeric.cpp
示例9: TestFunc
TestWindow* TestWindow::TestFunc(const char* param, int val)
{
if( this ) do_test(param,val);
return this;
}
开发者ID:HaikuArchives,项目名称:Sequitur,代码行数:5,代码来源:Profile.cpp
示例10: check_equality_operator
static void
check_equality_operator (void)
{
int i, m;
gint mult;
gint64 f, deno, numer;
gnc_numeric big, rbig;
gnc_numeric val, mval;
gnc_numeric bval, rval;
/* Check equality operator for some large numer/denom values */
numer = 1 << 30;
numer <<= 30; /* we don't trust cpp to compute 1<<60 correctly */
deno = 1 << 30;
deno <<= 20;
rbig = gnc_numeric_create (numer, deno);
big = gnc_numeric_create (1 << 10, 1);
do_test (gnc_numeric_equal(big, rbig), "equal to billion");
big = gnc_numeric_create (1 << 20, 1 << 10);
do_test (gnc_numeric_equal(big, rbig), "equal to 1<<20/1<<10");
big = gnc_numeric_create (1 << 30, 1 << 20);
do_test (gnc_numeric_equal(big, rbig), "equal to 1<<30/1<<20");
numer = 1 << 30;
numer <<= 30; /* we don't trust cpp to compute 1<<60 correctly */
deno = 1 << 30;
rbig = gnc_numeric_create (numer, deno);
big = gnc_numeric_create (1 << 30, 1);
do_test (gnc_numeric_equal(big, rbig), "equal to 1<<30");
numer = 1 << 30;
numer <<= 10;
big = gnc_numeric_create (numer, 1 << 10);
do_test (gnc_numeric_equal(big, rbig), "equal to 1<<40/1<<10");
numer <<= 10;
big = gnc_numeric_create (numer, 1 << 20);
do_test (gnc_numeric_equal(big, rbig), "equal to 1<<50/1<<20");
/* We assume RAND_MAX is less that 1<<32 */
for (i = 0; i < NREPS; i++)
{
deno = rand() / 2;
mult = rand() / 2;
numer = rand() / 2;
/* avoid 0 */
if (deno == 0 || mult == 0)
{
i--;
continue;
}
val = gnc_numeric_create (numer, deno);
mval = gnc_numeric_create (numer * mult, deno * mult);
/* The reduced version should be equivalent */
bval = gnc_numeric_reduce (val);
rval = gnc_numeric_reduce (mval);
check_unary_op (gnc_numeric_eq,
bval, rval, mval, "expected %s got %s = reduce(%s)");
/* The unreduced versions should be equal */
check_unary_op (gnc_numeric_equal,
val, mval, mval, "expected %s = %s");
/* Certain modulo's should be very cleary un-equal; this
* helps stop funky modulo-64 aliasing in compares that
* might creep in. */
mval.denom >>= 1;
mval.num >>= 1;
m = 0;
f = mval.denom;
while (f % 2 == 0)
{
f >>= 1;
m++;
}
if (1 < m)
{
gint64 nn = 1 << (32 - m);
nn <<= 32;
nn += mval.num;
val = gnc_numeric_create (2 * nn, 2 * mval.denom);
check_unary_op (gnc_numeric_unequal,
val, mval, mval, "expected unequality %s != %s");
}
}
}
开发者ID:c-holtermann,项目名称:gnucash,代码行数:93,代码来源:test-numeric.cpp
示例11: test_employee
static void
test_employee (void)
{
QofBackend *be;
QofBook *book;
QofSession *session;
GncEmployee *employee;
session = qof_session_new();
qof_session_begin(session, QOF_STDOUT, FALSE, FALSE);
book = qof_session_get_book(session);
/* The book *must* have a backend to pass the test of the 'dirty' flag */
/* See the README file for details */
be = qof_book_get_backend (book);
/* Test creation/destruction */
{
do_test (gncEmployeeCreate (NULL) == NULL, "employee create NULL");
employee = gncEmployeeCreate (book);
do_test (employee != NULL, "employee create");
do_test (qof_instance_get_book(QOF_INSTANCE(employee)) == book,
"getbook");
gncEmployeeBeginEdit (employee);
gncEmployeeDestroy (employee);
success ("create/destroy");
}
/* Test setting/getting routines; does the active flag get set right? */
{
GncGUID guid;
test_string_fcn (book, "Id", gncEmployeeSetID, gncEmployeeGetID);
test_string_fcn (book, "Username", gncEmployeeSetUsername, gncEmployeeGetUsername);
test_string_fcn (book, "Language", gncEmployeeSetLanguage, gncEmployeeGetLanguage);
test_string_fcn (book, "Acl", gncEmployeeSetAcl, gncEmployeeGetAcl);
test_numeric_fcn (book, "Workday", gncEmployeeSetWorkday, gncEmployeeGetWorkday);
test_numeric_fcn (book, "Rate", gncEmployeeSetRate, gncEmployeeGetRate);
test_bool_fcn (book, "Active", gncEmployeeSetActive, gncEmployeeGetActive);
do_test (gncEmployeeGetAddr (employee) != NULL, "Addr");
guid_new (&guid);
employee = gncEmployeeCreate (book);
count++;
gncEmployeeSetGUID (employee, &guid);
do_test (guid_equal (&guid, qof_instance_get_guid(QOF_INSTANCE(employee))), "guid compare");
}
#if 0
{
GList *list;
list = gncBusinessGetList (book, GNC_EMPLOYEE_MODULE_NAME, TRUE);
do_test (list != NULL, "getList all");
do_test (g_list_length (list) == count, "correct length: all");
g_list_free (list);
list = gncBusinessGetList (book, GNC_EMPLOYEE_MODULE_NAME, FALSE);
do_test (list != NULL, "getList active");
do_test (g_list_length (list) == 1, "correct length: active");
g_list_free (list);
}
#endif
{
const char *str = get_random_string();
const char *res;
GncAddress *addr;
addr = gncEmployeeGetAddr (employee);
gncAddressSetName (addr, str);
res = qof_object_printable (GNC_ID_EMPLOYEE, employee);
do_test (res != NULL, "Printable NULL?");
do_test (safe_strcmp (str, res) == 0, "Printable equals");
}
}
开发者ID:cstim,项目名称:gnucash-svn,代码行数:78,代码来源:test-employee.c
示例12: create_data
static void
create_data (QofSession *original, guint counter)
{
QofCollection *coll;
QofBook *start;
mygrand *grand1;
myparent *parent1;
mychild *child1;
start = qof_session_get_book(original);
grand1 = (mygrand*)qof_object_new_instance(GRAND_MODULE_NAME, start);
do_test ((NULL != &grand1->inst), "instance init");
switch (counter)
{
case 0 : /* NULL tree */
{
do_test((grand1 != NULL), "empty tree check");
coll = qof_book_get_collection(start, GRAND_MODULE_NAME);
do_test((qof_collection_count(coll) == 1),
"Too many grandparents found - should be 1");
coll = qof_book_get_collection(start, CHILD_MODULE_NAME);
do_test((qof_collection_count(coll) == 0),
"child found, should be empty");
coll = qof_book_get_collection(start, PARENT_MODULE_NAME);
do_test((qof_collection_count(coll) == 0),
"tree not empty: parent found");
break;
}
case 1 : /* one parent, no child */
{
parent1 = (myparent*)qof_object_new_instance(PARENT_MODULE_NAME, start);
grand_setChild(grand1, parent1);
do_test((parent1 != NULL), "single parent check");
do_test((grand_getChild(grand1) == parent1), "set child in grandparent");
coll = qof_book_get_collection(start, GRAND_MODULE_NAME);
do_test((qof_collection_count(coll) == 1),
"Wrong number of grandparents, should be 1");
coll = qof_book_get_collection(start, CHILD_MODULE_NAME);
do_test((qof_collection_count(coll) == 0),
"Should be no child entities this iteration.");
coll = qof_book_get_collection(start, PARENT_MODULE_NAME);
do_test((qof_collection_count(coll) == 1),
"Wrong number of parents found, should be 1");
break;
}
case 2 : /* one parent, one child */
{
parent1 = (myparent*)qof_object_new_instance(PARENT_MODULE_NAME, start);
grand_setChild(grand1, parent1);
child1 = (mychild*)qof_object_new_instance(CHILD_MODULE_NAME, start);
parent1 = grand_getChild(grand1);
parent_setChild(parent1, child1);
do_test((child1 != NULL), "one parent with one related child");
do_test((child1 == parent_getChild(parent1)), "child of single parent");
coll = qof_book_get_collection(start, GRAND_MODULE_NAME);
do_test((qof_collection_count(coll) == 1),
"Wrong number of grandparents. Should be 1");
coll = qof_book_get_collection(start, CHILD_MODULE_NAME);
do_test((qof_collection_count(coll) == 1),
"Wrong number of child entities, should be 1");
coll = qof_book_get_collection(start, PARENT_MODULE_NAME);
do_test((qof_collection_count(coll) == 1),
"Wrong number of parents. Should be 1");
break;
}
case 3 : /* same grand, new parent, same child */
{
child1 = (mychild*)qof_object_new_instance(CHILD_MODULE_NAME, start);
parent1 = (myparent*)qof_object_new_instance(PARENT_MODULE_NAME, start);
grand_setChild(grand1, parent1);
parent_setChild(parent1, child1);
do_test((parent1 == grand_getChild(grand1)), "same grandparent, new parent");
do_test((child1 == parent_getChild(parent1)), "new parent, same child");
coll = qof_book_get_collection(start, GRAND_MODULE_NAME);
do_test((qof_collection_count(coll) == 1),
"Wrong number of grandparents. Should be 1, Iteration 3.");
coll = qof_book_get_collection(start, CHILD_MODULE_NAME);
do_test((qof_collection_count(coll) == 1),
"Wrong number of child entities, should be 1. Iteration 3.");
coll = qof_book_get_collection(start, PARENT_MODULE_NAME);
do_test((qof_collection_count(coll) == 1),
"Wrong number of parents. Should be 1. Iteration 3.");
break;
}
case 4 : /* new grand, unrelated parent, child unrelated to grand */
{
grand1 = (mygrand*)qof_object_new_instance(GRAND_MODULE_NAME, start);
parent1 = (myparent*)qof_object_new_instance(PARENT_MODULE_NAME, start);
child1 = (mychild*)qof_object_new_instance(CHILD_MODULE_NAME, start);
parent_setChild(parent1, child1);
do_test((NULL == grand_getChild(grand1)), "new grand, unrelated parent");
do_test((child1 == parent_getChild(parent1)), "child unrelated to grand");
coll = grand_getDescend(grand1);
do_test((coll != NULL), "grandparent not valid");
if (coll)
{
QofInstance *ent;
ent = QOF_INSTANCE(child1);
qof_collection_add_entity(coll, ent);
//.........这里部分代码省略.........
开发者ID:kleopatra999,项目名称:gnucash-2,代码行数:101,代码来源:test-recursive.c
示例13: test_microdvd_do_test
static void
test_microdvd_do_test (SubParseInputChunk * input, guint num)
{
do_test (input, num, "pango-markup");
}
开发者ID:lubing521,项目名称:gst-embedded-builder,代码行数:5,代码来源:subparse.c
示例14: test_mpsl2
void test_mpsl2(void)
{
mpdm_t v;
mpdm_t w;
/* execution tests */
v = do_test_mpsl("666;");
mpdm_dump(v);
v = do_test_exec(v, NULL);
do_test("literal number", mpdm_ival(v) == 666);
v = do_test_mpsl("\"goodbye\";");
v = do_test_exec(v, NULL);
do_test("literal string", mpdm_cmp(v, MPDM_S(L"goodbye")) == 0);
v = do_test_mpsl("1 + 3 + 5;");
v = do_test_exec(v, NULL);
do_test("mpsl calculator 1", mpdm_rval(v) == 9.0);
v = do_test_mpsl("1 + ((3 - 5) * 8);");
v = do_test_exec(v, NULL);
do_test("mpsl calculator 2", mpdm_rval(v) == -15.0);
/* next value cannot be tested as an exact equality,
as rounding errors will manifest */
v = do_test_mpsl("1.5 + ((3.1 - 5.8) * 8.0);");
v = do_test_exec(v, NULL);
do_test("mpsl calculator 3", mpdm_rval(v) < -20.0 && mpdm_rval(v) > -21.0);
v = do_test_mpsl("2 + 3 * 4;");
v = do_test_exec(v, NULL);
do_test("mpsl calculator 4", mpdm_rval(v) == 14.0);
v = do_test_mpsl("2 * 3 + 4;");
v = do_test_exec(v, NULL);
do_test("mpsl calculator 5", mpdm_rval(v) == 10.0);
v = do_test_exec(do_test_mpsl("2 + 3 * 4;"), NULL);
mpdm_ref(v);
w = do_test_exec(do_test_mpsl("2 + (3 * 4);"), NULL);
do_test("mpsl calculator 6 (operator precedence)", mpdm_rval(v) == mpdm_rval(w));
mpdm_unref(v);
v = do_test_exec(do_test_mpsl("2 + 3 * 4;"), NULL);
mpdm_ref(v);
w = do_test_exec(do_test_mpsl("(2 + 3) * 4;"), NULL);
do_test("mpsl calculator 7 (operator precedence)", mpdm_rval(v) != mpdm_rval(w));
mpdm_unref(v);
v = do_test_mpsl("/* array */ [\"this\", \"one\", \"is\", 666, \"cool\"];");
v = do_test_exec(v, NULL);
mpdm_dump(v);
do_test("mpsl array", mpdm_ival(mpdm_get_i(v, 3)) == 666);
v = do_test_mpsl
("/* hash */ { \"enero\" => \"january\", \"febrero\" => \"february\" };");
v = do_test_exec(v, NULL);
mpdm_dump(v);
do_test("mpsl hash", mpdm_cmp(mpdm_get(v,
MPDM_S(L"febrero")),
MPDM_S(L"february")) == 0);
v = do_test_mpsl("! 1;");
v = do_test_exec(v, NULL);
do_test("boolean not 1", !mpdm_is_true(v));
v = do_test_mpsl("! 0;");
v = do_test_exec(v, NULL);
do_test("boolean not 2", v != NULL);
v = do_test_mpsl("1 && 3;");
v = do_test_exec(v, NULL);
do_test("boolean and 1", mpdm_ival(v) == 3);
v = do_test_mpsl("1 && 0;");
v = do_test_exec(v, NULL);
do_test("boolean and 2", !mpdm_is_true(v));
v = do_test_mpsl("0 && 1;");
v = do_test_exec(v, NULL);
do_test("boolean and 3", !mpdm_is_true(v));
v = do_test_mpsl("1 || 3;");
v = do_test_exec(v, NULL);
do_test("boolean or 1", mpdm_ival(v) == 1);
v = do_test_mpsl("2 || 0;");
v = do_test_exec(v, NULL);
do_test("boolean or 2", mpdm_ival(v) == 2);
v = do_test_mpsl("0 || 3;");
v = do_test_exec(v, NULL);
do_test("boolean or 3", mpdm_ival(v) == 3);
v = do_test_mpsl("6 == 6;");
v = do_test_exec(v, NULL);
do_test("numeric == 1", v != NULL);
v = do_test_mpsl("8.0 == 8.0;");
v = do_test_exec(v, NULL);
do_test("numeric == 2", v != NULL);
v = do_test_mpsl("6 == 8;");
v = do_test_exec(v, NULL);
do_test("numeric == 3", !mpdm_is_true(v));
v = do_test_mpsl("6 != 6;");
//.........这里部分代码省略.........
开发者ID:angelortega,项目名称:mpsl,代码行数:101,代码来源:stress.c
示例15: main
int main(int argc, char *argv[])
{
int n;
if (argc > 1 && strcmp(argv[1], "-v") == 0)
verbose = 1;
/* loop all tests */
for (n = 0; rx_tests[n].rx != NULL; n++) {
struct rx_test *r = &rx_tests[n];
_do_test(r->rx, r->rx, r->tx, r->r, r->src_line);
}
/* + */
do_test(L"+ 0 (really *)", L"one *world", L"oneworld is enough", L"oneworld");
do_test(L"+ 1", L"one +world", L"oneworld", L"");
do_test(L"+ 2", L"one +world", L"one world", L"one world");
do_test(L"+ 3", L"one +world", L"one world", L"one world");
do_test(L"+ 4", L"one +world", L"oneworld is enough", L"");
do_test(L"+ 5", L"one +world", L"one world is enough", L"one world");
do_test(L"+ 6", L"one +world", L"one world is enough", L"one world");
do_test(L"+ 7", L"one +world", L"I say oneworld is enough", L"");
do_test(L"+ 8", L"one +world", L"I say one world is enough", L"one world");
do_test(L"+ 9", L"one +world", L"I say one world is enough", L"one world");
/* escaped chars */
do_test(L"esc 0 (really ?)", L"ready?", L"ready!", L"ready");
do_test(L"esc 1", L"ready\\?", L"ready!", L"");
do_test(L"esc 2", L"ready\\?", L"ready?", L"ready?");
do_test(L"esc 3", L"triptico.com", L"tripticoxcom", L"tripticoxcom");
do_test(L"esc 4", L"triptico\\.com", L"tripticoxcom", L"");
do_test(L"esc 5", L"triptico\\.com", L"triptico.com", L"triptico.com");
do_test(L"esc 6", L"\n", L"string without newlines", L"");
do_test(L"esc 7", L"\n", L"I'm\nbroken", L"\n");
/* square bracket sets */
do_test(L"[] 0", L"[^a-c]", L"z", L"z");
do_test(L"[] 1", L"[^a-cdzx]", L"z", L"");
do_test(L"[] 2", L"[a-c]", L"z", L"");
do_test(L"[] 3", L"[a-cdzx]", L"z", L"z");
do_test(L"[] 4", L"[a-c]", L"b", L"b");
do_test(L"[] 5", L"[abc]", L"b", L"b");
do_test(L"[] 6", L"[abc]", L"d", L"");
do_test(L"[] and * 0", L"[a-z][a-z]*", L"1234 string 456", L"string");
do_test(L"[] and * 1", L"[a-z][a-z]*:", L"1234 string key: value 456", L"key:");
do_test(L"[] and * 2", L"[a-c]*de", L"abcde", L"abcde");
do_test(L"[] and + 0", L"[a-z]+", L"1234 string 456", L"string");
do_test(L"[] and + 1", L"[a-z]+:", L"1234 string key: value 456", L"key:");
/* alternate strings */
do_test(L"Alt strings 0", L"(abc|def)1", L"try abf1 now", L"");
do_test(L"Alt strings 1", L"(abc|def)1", L"try def1 now", L"def1");
do_test(L"Alt strings 2", L"(abc|def)1", L"try abc1 now", L"abc1");
/* substrings */
do_test(L"Substrs and * 0", L"Rem(ark)* comment", L"Rem comment", L"Rem comment");
do_test(L"Substrs and * 1", L"Rem(ark)* comment", L"Remarkark comment", L"Remarkark comment");
do_test(L"Substrs and * 2", L"Rem(ark)* comment", L"Remark comment", L"Remark comment");
do_test(L"Substrs and * 3", L"Rem(ark)* comment", L"<!-- Rem comment -->", L"Rem comment");
do_test(L"Substrs and ? 0", L"Rem(ark)? comment", L"Rem comment", L"Rem comment");
do_test(L"Substrs and ? 1", L"Rem(ark)? comment", L"Remark comment", L"Remark comment");
do_test(L"More sets 0", L"'[^']*'", L"I have here a 'string' between quotes", L"'string'");
do_test(L"More sets 1", L"'[^']*'", L"I have here a '' between quotes", L"''");
do_test(L"More sets 2", L"[a-z][a-z]* *: *[1-9][0-9]*", L"key:15 # comment", L"key:15");
do_test(L"More sets 3", L"[a-z][a-z]* *: *[1-9][0-9]*", L"key : 123456 # comment", L"key : 123456");
do_test(L"More sets 4", L"[a-z][a-z]* *: *[1-9][0-9]*", L"k: 6000", L"k: 6000");
do_test(L"More sets 5", L"[a-z][a-z]* *: *[1-9][0-9]*", L"key: 1", L"key: 1");
do_test(L"More sets 6", L"[1-9][0-9]*", L"6000", L"6000");
do_test(L"Brace matches 1 (like ?)", L"https{0,1}://", L"http://triptico.com", L"http://");
do_test(L"Brace matches 2 (like ?)", L"https{0,1}://", L"https://triptico.com", L"https://");
do_test(L"Brace matches 3 (like *)", L"a{0,}bc", L"aaabc", L"aaabc");
do_test(L"Brace matches 4 (like +)", L"one {1,}world", L"oneworld", L"");
do_test(L"Brace matches 5 (like +)", L"one {1,}world", L"one world", L"one world");
do_test(L"Brace matches 6 (like +)", L"one {1,}world", L"one world", L"one world");
do_test(L"Brace matches 11", L"a.{0,5}c", L"abc", L"abc");
do_test(L"Brace matches 12", L"a.{0,5}c", L"abcdec", L"abc");
do_test(L"Brace matches 13", L"a.{0,5}c", L"abcdecfghic", L"abc");
do_test(L"Brace matches 20", L".{5}", L"abcdefghijklmnopqrs", L"abcde");
do_test(L"More * at the end", L"a*", L"", L"");
return test_summary();
}
开发者ID:angelortega,项目名称:aov-rx,代码行数:90,代码来源:stress.c
示例16: test_mpsl3
void test_mpsl3(void)
{
mpdm_t v;
v = do_test_mpsl("v=[10,20]; w=v[0]; w;");
mpdm_dump(v);
v = do_test_exec(v, NULL);
mpdm_dump(v);
/* library functions tests */
v = do_test_mpsl("dump( [1, 2, 3, 4, 5] );");
do_test_exec(v, NULL);
v = do_test_mpsl("if(size([2, 3, 4]) == 3) { dump(\"YES\"); } else { dump(\"NO\"); }");
do_test_exec(v, NULL);
// v = do_test_mpsl("is_array(1);");
// do_test("is_array 1", !mpdm_is_true(do_test_exec(v, NULL)));
// v = do_test_mpsl("is_array([]);");
// do_test("is_array 2", do_test_exec(v, NULL) != NULL);
// v = do_test_mpsl("is_array({});");
// do_test("is_array 3", do_test_exec(v, NULL) != NULL);
// v = do_test_mpsl("is_hash(1);");
// do_test("is_hash 1", !mpdm_is_true(do_test_exec(v, NULL)));
// v = do_test_mpsl("is_hash([]);");
// do_test("is_hash 2", !mpdm_is_true(do_test_exec(v, NULL)));
// v = do_test_mpsl("is_hash({});");
// do_test("is_hash 3", do_test_exec(v, NULL) != NULL);
/* v = do_test_mpsl("v=splice(\"inventions of life\", NULL, 0, 10); v[1];");
v = do_test_exec(v, NULL);
do_test("splice 1", mpdm_cmp(v, MPDM_S(L"inventions")) == 0);
v = do_test_mpsl("v[0];");
v = do_test_exec(v, NULL);
do_test("splice 2", mpdm_cmp(v, MPDM_S(L" of life")) == 0);
*/
v = do_test_mpsl("sub func() { if(1 == 1) { return(6); 24; } 12; }");
v = do_test_exec(v, NULL);
v = do_test_mpsl("a=func();");
|
请发表评论