本文整理汇总了C++中TEST_EXIT函数的典型用法代码示例。如果您正苦于以下问题:C++ TEST_EXIT函数的具体用法?C++ TEST_EXIT怎么用?C++ TEST_EXIT使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TEST_EXIT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void)
{
struct sigaction act;
struct sigevent sevp;
struct itimerspec val;
timer_t timerid = {0};
act.sa_sigaction = event;
act.sa_flags = SA_SIGINFO;
sigaction(SIGUSR1, &act, NULL);
sevp.sigev_notify = SIGEV_SIGNAL;
sevp.sigev_signo = SIGUSR1;
val.it_value.tv_sec = 1;
timer_create(1, &sevp, &timerid);
timer_settime(timerid, 0, &val, NULL);
if (pause() != -EINTR)
TEST_EXIT(1);
if (!i)
TEST_EXIT(1);
TEST_EXIT(0);
}
示例2: parMetisMesh
ParMetisGraph::ParMetisGraph(ParMetisMesh* parMesh,
MPI::Intracomm* comm,
int ncommonnodes)
: parMetisMesh(parMesh)
{
FUNCNAME("ParMetisGraph::ParMetisGraph()");
TEST_EXIT(parMesh)("No ParMetisMesh defined!\n");
TEST_EXIT(comm)("No MPI communicator defined!\n");
int numflag = 0;
if (ncommonnodes == -1)
ncommonnodes = parMetisMesh->getDim();
MPI_Comm tmpComm = MPI_Comm(*comm);
ParMETIS_V3_Mesh2Dual(parMetisMesh->getElementDist(),
parMetisMesh->getElementPtr(),
parMetisMesh->getElementInd(),
&numflag,
&ncommonnodes,
&xadj,
&adjncy,
&tmpComm);
}
示例3: FUNCNAME
void RosenbrockStationary::addJacobianOperator(Operator& op, int row, int col,
double* factor, double* estFactor)
{
FUNCNAME("RosenbrockStationary::addJacobianOperator()");
TEST_EXIT(factor == NULL)("Not yet implemented!\n");
TEST_EXIT(estFactor == NULL)("Not yet implemented!\n");
ProblemStat::addMatrixOperator(op, row, col, &minusOne, &minusOne);
}
示例4: gettid
static void *fn(void *arg)
{
struct timespec rem, req = {
.tv_sec = 1,
.tv_nsec = 0
};
other_tid = gettid();
// The syscall will be interrupted by the main thread
if (nanosleep(&req, &rem) != -1)
TEST_EXIT(1);
if (errno != EINTR)
TEST_EXIT(1);
// The handler for the signal must have run after the nanosleep()
// syscall was interrupted
if (!signal_serviced)
TEST_EXIT(1);
// Test is interrupted before timer has expired, there must
// be some time remaining
if (!rem.tv_sec && !rem.tv_nsec)
TEST_EXIT(1);
return 0;
}
int main(void)
{
struct sigaction act = {
.sa_handler = handler,
.sa_flags = 0,
};
if (sigaction(SIGUSR1, &act, NULL))
TEST_EXIT(1);
pthread_t thread;
if (pthread_create(&thread, NULL, fn, NULL))
TEST_EXIT(1);
// The other thread startup might be delayed depending on the
// scheduler's prolicy
while (other_tid == -1)
sched_yield();
// Interrupt the other thread which is blocking in a sleep operation
if (tgkill(getpid(), other_tid, SIGUSR1))
TEST_EXIT(1);
// Join to make sure there other thread was interrupted with
// some time remaining
if (pthread_join(thread, NULL))
TEST_EXIT(1);
TEST_EXIT(0);
}
示例5: main
int main()
{
TEST_SET_START("20060918101000NM","NM", "llrintf4");
// unsigned long i11 = 0x5efffffful; // 9223371487098961920
// unsigned long i12 = 0xdefffffful; //-9223371487098961920
// unsigned long i11 = 0x49fffffful; //2097151.875000
// unsigned long i12 = 0x4a7ffffful; //4194303.750000
// float x0 = hide_float(-FLT_MAX); // -Inf
// float x1 = hide_float(FLT_MAX); // Inf
float x2 = hide_float(0.0); // +0
float x3 = hide_float(-0.0); // -0
// float x4 = hide_float(NANF); // NaN -> NaN
float x5 = hide_float( 0.5);
float x6 = hide_float(-0.5);
float x7 = hide_float(-0.499999);
float x8 = hide_float( 0.499999);
float x9 = hide_float(-999999.5);
float x10 = hide_float( 999999.5);
// float x11 = hide_float(make_float(i11));
// float x12 = hide_float(make_float(i12));
float x11 = hide_float( 9223371487098961920.);
float x12 = hide_float(-9223371487098961920.);
float x13 = (0.0 - FLT_MIN);
float x14 = FLT_MIN;
float x15 = hide_float(-2097151.875000);
float x16 = hide_float(-4194303.750000);
float x17 = hide_float( 4194303.750000);
float x18 = hide_float( 2097151.875000);
vec_float4 x0_v = ((vec_float4){ x2, x3, x5, x6});
llroundf4_t r0_v = set_llrintf4_t(0, 0, 0, 0);
vec_float4 x1_v = ((vec_float4){ x7, x8, x9, x10});
llroundf4_t r1_v = set_llrintf4_t(0, 0, -999999, 999999);
vec_float4 x2_v = ((vec_float4){ x11, x12, x13, x14});
llroundf4_t r2_v = set_llrintf4_t(9223371487098961920ll, -9223371487098961920ll, 0, 0);
vec_float4 x3_v = ((vec_float4){ x15, x16, x17, x18});
llroundf4_t r3_v = set_llrintf4_t(-2097151, -4194303, 4194303, 2097151);
llroundf4_t res_v;
TEST_START("llrintf4");
res_v = llrintf4 (x0_v);
TEST_CHECK("20060918101001NM", allequal_llroundf4( res_v, r0_v ), 0);
res_v = llrintf4 (x1_v);
TEST_CHECK("20060918101002NM", allequal_llroundf4( res_v, r1_v ), 0);
res_v = llrintf4 (x2_v);
TEST_CHECK("20060918101003NM", allequal_llroundf4( res_v, r2_v ), 0);
res_v = llrintf4 (x3_v);
TEST_CHECK("20060918101004NM", allequal_llroundf4( res_v, r3_v ), 0);
TEST_SET_DONE();
TEST_EXIT();
}
示例6: TEST_EXIT
ElInfo* ParametricFirstOrder::addParametricInfo(ElInfo* elInfo)
{
elInfo->setParametric(true);
const int dow = Global::getGeo(WORLD);
Element* element = elInfo->getElement();
const DegreeOfFreedom** dof = element->getDof();
for (int i = 0; i < elInfo->getElement()->getGeo(VERTEX); i++)
{
if (elInfo->getFillFlag().isSet(Mesh::FILL_COORDS))
for (int j = 0; j < dow; j++)
elInfo->getCoord(i)[j] = (*(*dofCoords_)[j])[dof[i][0]];
if (elInfo->getFillFlag().isSet(Mesh::FILL_OPP_COORDS))
{
TEST_EXIT(elInfo->getFillFlag().isSet(Mesh::FILL_NEIGH))
("FILL_NEIGH not set\n");
if (elInfo->getNeighbour(i))
{
const DegreeOfFreedom** neighDof = elInfo->getNeighbour(i)->getDof();
for (int j = 0; j < dow; j++)
elInfo->getOppCoord(i)[j] =
(*(*dofCoords_)[j])[neighDof[elInfo->getOppVertex(i)][0]];
}
}
}
return elInfo;
}
示例7: FUNCNAME
double
CFE_NormAndErrorFcts::H1Err(
AbstractFunction<WorldVector<double>, WorldVector<double>>* u,
DOFVector<double>* uh,
ElementLevelSet* elLS,
int domainFlag,
int relErr,
int deg,
Quadrature* q)
{
FUNCNAME("CFE_NormAndErrorFcts::H1Err()");
int dim = elLS->getDim();
ElementH1Err* elNorm = new ElementH1Err(q, u, uh, relErr, dim);
TEST_EXIT(dim == Global::getGeo(WORLD))
("doesn't work for dimension of problem != dimension of world!\n");
Flag fillFlag = Mesh::CALL_LEAF_EL |
Mesh::FILL_COORDS |
Mesh::FILL_DET |
Mesh::FILL_GRD_LAMBDA;
double err = 0.0;
switch(domainFlag)
{
case -3:
err = Norm_IntNoBound(elNorm, elLS, fillFlag, deg, q);
break;
case -2:
err = Norm_IntBound(elNorm, elLS, fillFlag, deg, q);
break;
case -1:
err = Norm_Int(elNorm, elLS, fillFlag, deg, q);
break;
case 0:
err = Norm_Bound(elNorm, elLS, fillFlag, deg, q);
break;
case 1:
err = Norm_Complete(elNorm, elLS, fillFlag, deg, q);
break;
default:
ERROR_EXIT("illegal flag !\n");
break;
}
H1_err_abs = sqrt(err);
H1_u_norm = sqrt(elNorm->getNormGrdU());
if (relErr)
err = H1_err_abs / (H1_u_norm + 1.e-15);
else
err = H1_err_abs;
delete elNorm;
return err;
}
示例8: main
int main()
{
TEST_SET_START("20040916145017EJL","EJL", "floorf");
unsigned int i3 = 0x4affffff; // 2^23 - 0.5, largest truncatable value.
unsigned int i3i = 0x4afffffe;
unsigned int i4 = 0x4b000000; // 2^23, no fractional part.
unsigned int i5 = 0xcf000001; // -2^31, one more large, and negative, value.
float x0 = hide_float(0.91825f);
float x0i = hide_float(0.0f);
float x1 = hide_float(-0.12958f);
float x1i = hide_float(-1.0f);
float x2 = hide_float(-79615.1875f);
float x2i = hide_float(-79616.0f);
float x3 = hide_float(make_float(i3));
float x3i = hide_float(make_float(i3i));
float x4 = hide_float(make_float(i4));
float x4i = hide_float(make_float(i4));
float x5 = hide_float(make_float(i5));
float x5i = hide_float(make_float(i5));
vec_float4 x0_v = vec_splat_float(x0);
vec_float4 x0i_v = vec_splat_float(x0i);
vec_float4 x1_v = vec_splat_float(x1);
vec_float4 x1i_v = vec_splat_float(x1i);
vec_float4 x2_v = vec_splat_float(x2);
vec_float4 x2i_v = vec_splat_float(x2i);
vec_float4 x3_v = vec_splat_float(x3);
vec_float4 x3i_v = vec_splat_float(x3i);
vec_float4 x4_v = vec_splat_float(x4);
vec_float4 x4i_v = vec_splat_float(x4i);
vec_float4 x5_v = vec_splat_float(x5);
vec_float4 x5i_v = vec_splat_float(x5i);
vec_float4 res_v;
TEST_START("floorf4");
res_v = floorf4(x0_v);
TEST_CHECK("20040916145022EJL", allequal_float4( res_v, x0i_v ), 0);
res_v = floorf4(x1_v);
TEST_CHECK("20040916145024EJL", allequal_float4( res_v, x1i_v ), 0);
res_v = floorf4(x2_v);
TEST_CHECK("20040916145027EJL", allequal_float4( res_v, x2i_v ), 0);
res_v = floorf4(x3_v);
TEST_CHECK("20040916145029EJL", allequal_float4( res_v, x3i_v ), 0);
res_v = floorf4(x4_v);
TEST_CHECK("20040916145032EJL", allequal_float4( res_v, x4i_v ), 0);
res_v = floorf4(x5_v);
TEST_CHECK("20040916145034EJL", allequal_float4( res_v, x5i_v ), 0);
TEST_SET_DONE();
TEST_EXIT();
}
示例9: main
int main()
{
TEST_SET_START("20040928182349EJL","EJL", "rsqrtf4");
unsigned int i3 = 0x742c4455;
unsigned int i3r = 0x251c099a;
unsigned int i4 = 0x75e7753f;
unsigned int i4r = 0x243e5fe2;
unsigned int i5 = 0x4baa9e3c;
unsigned int i5r = 0x395dbbeb;
unsigned int i6 = 0x39344296;
unsigned int i6r = 0x429889eb;
unsigned int i7 = 0x68a586b0;
unsigned int i7r = 0x2ae11e67;
float x3 = hide_float(make_float(i3));
float x3r = hide_float(make_float(i3r));
float x4 = hide_float(make_float(i4));
float x4r = hide_float(make_float(i4r));
float x5 = hide_float(make_float(i5));
float x5r = hide_float(make_float(i5r));
float x6 = hide_float(make_float(i6));
float x6r = hide_float(make_float(i6r));
float x7 = hide_float(make_float(i7));
float x7r = hide_float(make_float(i7r));
vec_float4 x3_v = spu_splats(x3);
vec_float4 x3r_v = spu_splats(x3r);
vec_float4 x4_v = spu_splats(x4);
vec_float4 x4r_v = spu_splats(x4r);
vec_float4 x5_v = spu_splats(x5);
vec_float4 x5r_v = spu_splats(x5r);
vec_float4 x6_v = spu_splats(x6);
vec_float4 x6r_v = spu_splats(x6r);
vec_float4 x7_v = spu_splats(x7);
vec_float4 x7r_v = spu_splats(x7r);
vec_float4 res_v;
TEST_START("rsqrtf4");
res_v = rsqrtf4(x3_v);
TEST_CHECK("20040928182352EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
res_v = rsqrtf4(x4_v);
TEST_CHECK("20040928182355EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
res_v = rsqrtf4(x5_v);
TEST_CHECK("20040928182357EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
res_v = rsqrtf4(x6_v);
TEST_CHECK("20040928182358EJL", allequal_ulps_float4( res_v, x6r_v, 2 ), 0);
res_v = rsqrtf4(x7_v);
TEST_CHECK("20040928182401EJL", allequal_ulps_float4( res_v, x7r_v, 2 ), 0);
TEST_SET_DONE();
TEST_EXIT();
}
示例10: main
int main()
{
TEST_SET_START("20040928182549EJL","EJL", "sqrtf4");
unsigned int i3 = 0x742c4455;
unsigned int i3r = 0x59d20034;
unsigned int i4 = 0x75e7753f;
unsigned int i4r = 0x5aac1fb5;
unsigned int i5 = 0x4baa9e3c;
unsigned int i5r = 0x4593c7d8;
unsigned int i6 = 0x39344296;
unsigned int i6r = 0x3c56d14c;
unsigned int i7 = 0x68a586b0;
unsigned int i7r = 0x54118f09;
float x3 = hide_float(make_float(i3));
float x3r = hide_float(make_float(i3r));
float x4 = hide_float(make_float(i4));
float x4r = hide_float(make_float(i4r));
float x5 = hide_float(make_float(i5));
float x5r = hide_float(make_float(i5r));
float x6 = hide_float(make_float(i6));
float x6r = hide_float(make_float(i6r));
float x7 = hide_float(make_float(i7));
float x7r = hide_float(make_float(i7r));
vec_float4 x3_v = spu_splats(x3);
vec_float4 x3r_v = spu_splats(x3r);
vec_float4 x4_v = spu_splats(x4);
vec_float4 x4r_v = spu_splats(x4r);
vec_float4 x5_v = spu_splats(x5);
vec_float4 x5r_v = spu_splats(x5r);
vec_float4 x6_v = spu_splats(x6);
vec_float4 x6r_v = spu_splats(x6r);
vec_float4 x7_v = spu_splats(x7);
vec_float4 x7r_v = spu_splats(x7r);
vec_float4 res_v;
TEST_START("sqrtf4");
res_v = sqrtf4(x3_v);
TEST_CHECK("20040928182552EJL", allequal_ulps_float4( res_v, x3r_v, 2 ), 0);
res_v = sqrtf4(x4_v);
TEST_CHECK("20040928182554EJL", allequal_ulps_float4( res_v, x4r_v, 2 ), 0);
res_v = sqrtf4(x5_v);
TEST_CHECK("20040928182556EJL", allequal_ulps_float4( res_v, x5r_v, 2 ), 0);
res_v = sqrtf4(x6_v);
TEST_CHECK("20040928182557EJL", allequal_ulps_float4( res_v, x6r_v, 2 ), 0);
res_v = sqrtf4(x7_v);
TEST_CHECK("20040928182559EJL", allequal_ulps_float4( res_v, x7r_v, 2 ), 0);
TEST_SET_DONE();
TEST_EXIT();
}
示例11: test_crash_runner
int test_crash_runner()
{
int status;
switch(test_crash_pid = fork())
{
case -1: /* error */
TEST_EXIT(1);
case 0: /* child */
test_crash_do();
return 0;
default: /* parent */
if(waitpid(test_crash_pid, &status, 0) < 0) TEST_EXIT(1);
if(0 != test_crash_check(status)) TEST_EXIT(1);
fclose(stdin);
fclose(stdout);
fclose(stderr);
return 0;
}
}
示例12: test_crash_do
int test_crash_do()
{
test_crash_extra_msg_len = strlen(TEST_CRASH_EXTRA_MSG);
/* we need not core dump file */
struct rlimit rlim = {.rlim_cur = 0, .rlim_max = 0};
if(setrlimit(RLIMIT_CORE, &rlim)) TEST_EXIT(2);
if(svx_crash_set_callback(cb, NULL)) TEST_EXIT(2);
if(svx_crash_set_head_msg(TEST_CRASH_HEAD_MSG)) TEST_EXIT(2);
if(svx_crash_set_timezone_mode(SVX_CRASH_TIMEZONE_MODE_LOCAL)) TEST_EXIT(2);
if(svx_crash_set_dirname("./")) TEST_EXIT(2);
if(svx_crash_set_prefix("test_crash")) TEST_EXIT(2);
if(svx_crash_set_suffix("log")) TEST_EXIT(2);
if(svx_crash_set_max_dumps(1)) TEST_EXIT(2);
if(svx_crash_register_signal_handler()) TEST_EXIT(2);
fclose(stdin);
fclose(stdout);
/* let the gcc's ThreadSanitizer print messages to stderr */
/* fclose(stderr); */
pthread_setname_np(pthread_self(), "test_thd_name");
return aa();
}
static int test_crash_filter(const struct dirent *entry)
{
char buf[1024];
snprintf(buf, sizeof(buf), "test_crash.*.%d.log", test_crash_pid);
switch(fnmatch(buf , entry->d_name, 0))
{
case 0 : return 1;
case FNM_NOMATCH : return 0;
default : TEST_EXIT(1);
}
}
示例13: readMetaData
int readMetaData(string filename,
map<int, int>& elInRank,
map<int, int>& elCodeSize,
string& arhPrefix)
{
ifstream file;
file.open(filename.c_str());
TEST_EXIT(file.is_open())
("Cannot open arh meta file \"%s\"\n", filename.c_str());
string readStr = "";
file >> readStr;
arhPrefix = "";
file >> arhPrefix;
int nProc;
file >> nProc;
// Maps to each macro element index the arh file index it is stored in.
for (int i = 0; i < nProc; i++)
{
int tmp;
file >> tmp;
TEST_EXIT(tmp == i)("Should not happen!\n");
int nMacroEl;
file >> nMacroEl;
for (int j = 0; j < nMacroEl; j++)
{
int elIndex, codeSize;
file >> elIndex;
file >> codeSize;
elInRank[elIndex] = i;
elCodeSize[elIndex] = codeSize;
}
}
file.close();
return nProc;
}
示例14: flash_init
void flash_init(void)
{
struct dentry dentry = { .d_name = "mtd1" };
printk("Creating MTD device %s\n", dentry.d_name);
if (mtdram_init_device(&mtd1, &_binary_sda1_start, 4096,
dentry.d_name))
printk("error: mtdram init device failed\n");
add_mtd_device(&mtd1, dentry.d_name);
}
int main()
{
flash_init();
mount("/dev/mtd1", "/dev/flash", "romfs", 0, 0);
/* execve does not return in POSIX standard */
if (execve("/dev/flash/a.out", 0, 0))
TEST_EXIT(1);
sched_yield();
TEST_EXIT(0);
}
示例15: main
int main() {
TEST_STRT(2);
TEST_DIAG("This test may fail due to an unavoidable race condition");
int f = fork();
if (f < 0) {
TEST_EXIT("Fork failed");
} else if (f == 0) {
TEST_FINI("child"); /* success 1 */
} else {
sleep(20);
TEST_FINI("parent"); /* success 2 */
}
exit();
}