本文整理汇总了C++中START_TEST函数的典型用法代码示例。如果您正苦于以下问题:C++ START_TEST函数的具体用法?C++ START_TEST怎么用?C++ START_TEST使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了START_TEST函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testBelugaLowLevelControlLaw
int testBelugaLowLevelControlLaw()
{
BelugaLowLevelControlLaw control_law;
std::string err_msg;
mt_dVector_t u_in, u_out, state;
u_in.resize(BELUGA_CONTROL_SIZE, 0.0);
state.resize(4, 0.0);
/* the output should have BELUGA_CONTROL_SIZE elements */
START_TEST("Checking output vector size");
u_out = control_law.doControl(state, u_in);
if (u_out.size() != BELUGA_CONTROL_SIZE)
RETURN_ERROR_ELSE_OK("Incorrect size " << u_out.size());
/* the vertical thrust should be zero when u_vert is zero */
START_TEST("Checking that the vertical thrust is zero if no vertical command is given");
u_in = randomVector(3);
state = randomVector(4);
u_in[BELUGA_CONTROL_VERT_SPEED] = 0.0;
state[BELUGA_STATE_Z] = z_off;
u_out = control_law.doControl(state, u_in);
if (u_out[BELUGA_CONTROL_VERT_SPEED] != 0.0)
RETURN_ERROR_ELSE_OK("Control was " << u_out[BELUGA_CONTROL_VERT_SPEED]);
return OK;
}
示例2: wrapped_calloc
memory_operation wrapped_calloc(size_t num, size_t size)
{
START_TEST(type_id, FunctionCalls::CALLOC)
data.ptr = memkind_calloc(kind, num, size);
data.error_code = errno;
END_TEST
}
示例3: test_aecp
bool test_aecp ( void )
{
bool r = false;
START_TEST();
END_TEST ( r );
return r;
}
示例4: test_netaddr_is_in_subnet
static void
test_netaddr_is_in_subnet(void) {
struct netaddr_str str1, str2;
size_t a, s;
START_TEST();
for (s = 0; s < sizeof(in_subnet_subnets) / sizeof(*in_subnet_subnets); s++) {
for (a = 0; a < sizeof(in_subnet_addrs) / sizeof(*in_subnet_addrs); a++) {
CHECK_TRUE(
in_subnet_results[a][s] == netaddr_binary_is_in_subnet(&in_subnet_subnets[s], &in_subnet_addrs[a],
netaddr_get_maxprefix(&in_subnet_addrs[a])/8, in_subnet_addrs[a]._type),
"%s should %sbe in %s",
netaddr_to_string(&str1, &in_subnet_addrs[a]),
in_subnet_results[a][s] ? "" : "not ",
netaddr_to_string(&str2, &in_subnet_subnets[s]));
CHECK_TRUE(
in_subnet_results[a][s] == netaddr_is_in_subnet(&in_subnet_subnets[s], &in_subnet_addrs[a]),
"%s should %sbe in %s",
netaddr_to_string(&str1, &in_subnet_addrs[a]),
in_subnet_results[a][s] ? "" : "not ",
netaddr_to_string(&str2, &in_subnet_subnets[s]));
}
}
END_TEST();
}
示例5: test_validate_fractional_miss
static void
test_validate_fractional_miss(void) {
START_TEST();
CHECK_TRUE(0 == cfg_schema_validate(db, false, false, &out),
"%s", abuf_getptr(&out));
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "fractional", "a");
CHECK_TRUE(0 != cfg_schema_validate(db, false, false, NULL),
"validation missed bad integer");
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "fractional", "3..4");
CHECK_TRUE(0 != cfg_schema_validate(db, false, false, NULL),
"validation missed bad integer");
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "fractional", "3.4.5");
CHECK_TRUE(0 != cfg_schema_validate(db, false, false, NULL),
"validation missed bad integer");
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "fractional", "0");
CHECK_TRUE(0 == cfg_schema_validate(db, false, false, NULL),
"validation had a false positive");
END_TEST();
}
示例6: test_validate_fractional_minmax_miss
static void
test_validate_fractional_minmax_miss(void) {
START_TEST();
CHECK_TRUE(0 == cfg_schema_validate(db, false, false, &out),
"%s", abuf_getptr(&out));
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "fractional_minmax", "10.0001");
CHECK_TRUE(0 != cfg_schema_validate(db, false, false, &out),
"validation missed int out of range");
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "fractional_minmax", "10.0000");
CHECK_TRUE(0 == cfg_schema_validate(db, false, false, &out),
"validation had false positive (border case)");
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "fractional_minmax", "9.9999");
CHECK_TRUE(0 == cfg_schema_validate(db, false, false, &out),
"validation had false positive inside valid interval");
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "fractional_minmax", "-10.0001");
CHECK_TRUE(0 != cfg_schema_validate(db, false, false, &out),
"validation missed int out of range");
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "fractional_minmax", "-10.0000");
CHECK_TRUE(0 == cfg_schema_validate(db, false, false, &out),
"validation had false positive (border case)");
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "fractional_minmax", "-9.9999");
CHECK_TRUE(0 == cfg_schema_validate(db, false, false, &out),
"validation had false positive inside valid interval");
END_TEST();
}
示例7: wrapped_realloc
memory_operation wrapped_realloc(void* ptr, size_t size)
{
START_TEST(type_id, FunctionCalls::REALLOC)
data.ptr = memkind_realloc(kind, ptr, size);
data.error_code = errno;
END_TEST
}
示例8: test_default_named_section_set
static void
test_default_named_section_set(void) {
const struct const_strarray *value;
START_TEST();
cfg_db_overwrite_entry(db, CFG_SECTION, CFG_SECTION_NAME, CFG_ENTRY_DEF, CFG_NAMED_VALUE);
cfg_db_overwrite_entry(db, CFG_SECTION, CFG_SECTION_NAME, CFG_ENTRY_NODEF, CFG_NAMED_VALUE);
value = cfg_db_get_entry_value(db, CFG_SECTION, CFG_SECTION_NAME, CFG_ENTRY_DEF);
CHECK_TRUE(value != NULL, "No value found for named section entry with default");
if (value) {
CHECK_TRUE(value->value != NULL && strcmp(value->value, CFG_NAMED_VALUE) == 0,
"Did not got the named_section value with default: %s", value->value);
}
value = cfg_db_get_entry_value(db, CFG_SECTION, CFG_SECTION_NAME, CFG_ENTRY_NODEF);
CHECK_TRUE(value != NULL, "No value found for named section entry without default");
if (value) {
CHECK_TRUE(value->value != NULL && strcmp(value->value, CFG_NAMED_VALUE) == 0,
"Did not got the named_section value without default: %s", value->value);
}
value = cfg_db_get_entry_value(db, CFG_SECTION, NULL, CFG_ENTRY_DEF);
CHECK_TRUE(value != NULL, "No value found for unnamed section entry with default");
if (value) {
CHECK_TRUE(value->value != NULL && strcmp(value->value, CFG_SCHEMA_DEFAULT) == 0,
"Did not got the named_section value with default: %s", value->value);
}
value = cfg_db_get_entry_value(db, CFG_SECTION, NULL, CFG_ENTRY_NODEF);
CHECK_TRUE(value == NULL, "value found for unnamed section entry without default: %s",
value == NULL ? "" : value->value);
END_TEST();
}
示例9: test_simple_list_fill
void test_simple_list_fill(struct test_list* _head) {
START_TEST();
CHECK_TRUE(_is_equal(_get_by_buffer(_head, bar), 42, bar), "%s", _print_result(_get_by_buffer(_head, bar)));
CHECK_TRUE(_is_equal(_get_by_value(_head, 23), 23, foo), "%s", _print_result(_get_by_value(_head, 23)));
END_TEST();
}
示例10: test_validate_success
static void
test_validate_success(void) {
START_TEST();
CHECK_TRUE(0 == cfg_schema_validate(db, false, false, &out),
"%s", abuf_getptr(&out));
END_TEST();
}
示例11: testBelugaWaypointControlLaw
int testBelugaWaypointControlLaw()
{
BelugaWaypointControlLaw control_law;
control_law.doActivate(true);
std::string err_msg;
mt_dVector_t u_in, u_out, state;
u_in.resize(BELUGA_WAYPOINT_SIZE, 0.0);
state.resize(BELUGA_NUM_STATES, 0.0);
/* the output should have BELUGA_CONTROL_SIZE elements */
START_TEST("Checking output vector size");
u_out = control_law.doControl(state, u_in);
if (u_out.size() != BELUGA_CONTROL_SIZE)
RETURN_ERROR_ELSE_OK("Incorrect size " << u_out.size());
/* forward speed should max out when robot is far from waypoint */
START_TEST("Checking that speed saturates for large distances");
u_in[BELUGA_WAYPOINT_X] = state[BELUGA_STATE_X];
u_in[BELUGA_WAYPOINT_Y] = state[BELUGA_STATE_Y] + 1.1*control_law.m_dDistThreshold;
u_out = control_law.doControl(state, u_in);
if (!eq_wf(u_out[BELUGA_CONTROL_FWD_SPEED], control_law.m_dMaxSpeed))
RETURN_ERROR_ELSE_OK("Control did not saturate, was " << u_out[BELUGA_CONTROL_FWD_SPEED]);
/* forward speed should decrease as robot approaches waypoint */
START_TEST("Checking that speed decreases as robot nears waypoint");
u_in[BELUGA_WAYPOINT_X] = state[BELUGA_STATE_X];
mt_dVector_t prevOut;
prevOut.resize(BELUGA_CONTROL_SIZE, 500.0);
double N = 1.1;
double step = 0.1;
while (N > 0.0)
{
u_in[BELUGA_WAYPOINT_Y] = state[BELUGA_STATE_Y] + N*control_law.m_dDistThreshold;
u_out = control_law.doControl(state, u_in);
if (u_out[BELUGA_CONTROL_FWD_SPEED] > prevOut[BELUGA_CONTROL_FWD_SPEED])
RETURN_ERROR_ELSE_OK("Speed did not decrease, was " << u_out[BELUGA_CONTROL_FWD_SPEED]);
prevOut = u_out;
N -= step;
}
return OK;
}
示例12: test_str_to_isonumber_s64_2
static void
test_str_to_isonumber_s64_2(void) {
struct isonumber_str buf;
START_TEST();
CHECK_TRUE(
isonumber_from_s64(&buf,
5185050545986994176ll, "bit/s", 0, true, false) != NULL, "test");
END_TEST();
}
示例13: START_TEST
void
FileOperationReadCacheTest::testOpenFile()
{
START_TEST(__func__);
CPPUNIT_ASSERT(pReadCacheManager!=NULL);
//CPPUNIT_ASSERT(pInterface!=NULL);
//CPPUNIT_ASSERT(pInterface->OpenFile(O_RDONLY));
END_TEST(__func__);
}
示例14: test_dot_product_enc
static void
test_dot_product_enc(int arry_size, bool reencrypt = true) {
mpz_t dp_cipher[2];
mpz_t dp, dp_cpu, dp_gpu, dp_cpu2;
init(dp_cipher, 2, EGGROUP_NBITS);
mpz_init_set_ui(dp, 0);
mpz_init_set_ui(dp_cpu, 0);
mpz_init_set_ui(dp_gpu, 0);
mpz_init_set_ui(dp_cpu2, 0);
dot_product_enc(c, dp, pi, pi, arry_size);
if (reencrypt)
{
#if FAST_INIT == 1
gpuc->elgamal_enc_vec(cipher, pi, arry_size);
#else
c->elgamal_enc_vec(cipher, pi, arry_size);
#endif
}
/*
START_TEST("CPU dot_product_enc");
c->dot_product_enc(arry_size, cipher, pi, dp_cipher[0], dp_cipher[1]);
c->elgamal_dec(dp_cpu, dp_cipher[0], dp_cipher[1]);
RUN_TEST(cmp(dp, dp_cpu));
*/
START_TEST("CPU2 dot_product_enc");
cpu2_c->dot_product_enc(arry_size, cipher, pi, dp_cipher[0], dp_cipher[1]);
cpu2_c->elgamal_dec(dp_cpu2, dp_cipher[0], dp_cipher[1]);
RUN_TEST(cmp(dp, dp_cpu2));
START_TEST("GPU dot_product_enc");
gpuc->dot_product_enc(arry_size, cipher, pi, dp_cipher[0], dp_cipher[1]);
gpuc->elgamal_dec(dp_gpu, dp_cipher[0], dp_cipher[1]);
RUN_TEST(cmp(dp, dp_gpu));
mpz_clear(dp);
clear(dp_cipher, 2);
}
示例15: test_validate_printable_miss
static void
test_validate_printable_miss(void) {
START_TEST();
CHECK_TRUE(0 == cfg_schema_validate(db, false, false, &out),
"%s", abuf_getptr(&out));
cfg_db_add_entry(db, CFG_SEC, CFG_SECNAME, "printable", "1234\n5678");
CHECK_TRUE(0 != cfg_schema_validate(db, false, false, NULL),
"validation missed non-printable character");
END_TEST();
}