本文整理匯總了C++中BOOST_CHECK_MESSAGE函數的典型用法代碼示例。如果您正苦於以下問題:C++ BOOST_CHECK_MESSAGE函數的具體用法?C++ BOOST_CHECK_MESSAGE怎麽用?C++ BOOST_CHECK_MESSAGE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BOOST_CHECK_MESSAGE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: load_exported
// save exported polymorphic class
void load_exported(const char *testfile)
{
test_istream is(testfile, TEST_STREAM_FLAGS);
test_iarchive ia(is, TEST_ARCHIVE_FLAGS);
polymorphic_base *rb1 = NULL;
polymorphic_base *rb2 = NULL;
polymorphic_derived2 *rd21 = NULL;
// export will permit correct serialization
// through a pointer to a base class
ia >> BOOST_SERIALIZATION_NVP(rb1);
BOOST_CHECK_MESSAGE(
boost::serialization::type_info_implementation<polymorphic_derived1>
::type::get_const_instance()
==
* boost::serialization::type_info_implementation<polymorphic_base>
::type::get_const_instance().get_derived_extended_type_info(*rb1),
"restored pointer b1 not of correct type"
);
ia >> BOOST_SERIALIZATION_NVP(rb2);
BOOST_CHECK_MESSAGE(
boost::serialization::type_info_implementation<polymorphic_derived2>
::type::get_const_instance()
==
* boost::serialization::type_info_implementation<polymorphic_base>
::type::get_const_instance().get_derived_extended_type_info(*rb2),
"restored pointer b2 not of correct type"
);
ia >> BOOST_SERIALIZATION_NVP(rd21);
BOOST_CHECK_MESSAGE(
boost::serialization::type_info_implementation<polymorphic_derived2>
::type::get_const_instance()
==
* boost::serialization::type_info_implementation<polymorphic_derived2>
::type::get_const_instance().get_derived_extended_type_info(*rd21),
"restored pointer d2 not of correct type"
);
delete rb1;
delete rb2;
delete rd21;
}
示例2: test_empty_input
void test_empty_input()
{
Geometry geometry;
bg::model::polygon
<
typename bg::point_type<Geometry>::type
> hull;
bg::convex_hull(geometry, hull);
BOOST_CHECK_MESSAGE(bg::num_points(hull) == 0, "Output convex hull should be empty" );
}
示例3: check_invalid_params
static void check_invalid_params(const cJSON *response)
{
const cJSON *error = cJSON_GetObjectItem(response, "error");
cJSON *code = cJSON_GetObjectItem(error, "code");
if (code != NULL) {
BOOST_CHECK_MESSAGE(code->type == cJSON_Number, "error code is not a number!");
BOOST_CHECK_MESSAGE(code->valueint == INVALID_PARAMS_ERROR, "error code does not correspond to invalid params");
} else {
BOOST_FAIL("No code object!");
}
cJSON *message = cJSON_GetObjectItem(error, "message");
if (message != NULL) {
BOOST_CHECK_MESSAGE(message->type == cJSON_String, "message is not a string!");
BOOST_CHECK_MESSAGE(strcmp(message->valuestring, "Invalid params") == 0, "message is not set to \"Invalid params\"!");
} else {
BOOST_FAIL("No message object!");
}
}
示例4: check_self_touches
void check_self_touches(Geometry const& geometry,
std::string const& wkt,
bool expected)
{
bool detected = bg::touches(geometry);
BOOST_CHECK_MESSAGE(detected == expected,
"touches: " << wkt
<< " -> Expected: " << expected
<< " detected: " << detected);
}
示例5: check_disjoint
void check_disjoint(std::string const& id,
G1 const& g1,
G2 const& g2,
bool expected)
{
bool detected = bg::disjoint(g1, g2);
BOOST_CHECK_MESSAGE(detected == expected,
"disjoint: " << id
<< " -> Expected: " << expected
<< " detected: " << detected);
}
示例6: BOOST_FIXTURE_TEST_CASE
BOOST_FIXTURE_TEST_CASE(delete_nonexisting_method, F)
{
const char path[] = "/foo/bar/";
cJSON *request = create_add(path);
cJSON *response = remove_element_from_peer(&owner_peer, request);
BOOST_REQUIRE_MESSAGE(response != NULL, "remove_element_from_peer() had no response!");
BOOST_CHECK_MESSAGE(response_is_error(response), "remove_element_from_peer() failed!");
cJSON_Delete(request);
cJSON_Delete(response);
}
示例7: apply
static inline bool apply(Geometry const& geometry,
bool expected_result)
{
bool valid = ValidityTester::apply(geometry);
BOOST_CHECK_MESSAGE( valid == expected_result,
"Expected: " << expected_result
<< " detected: " << valid
<< " wkt: " << bg::wkt(geometry) );
return valid;
}
示例8: testDefaultValue
void testDefaultValue(database* db, bool timestampNull)
{
try
{
short tableid = 1;
table_ptr tb = openTable(db, tableid, TD_OPEN_NORMAL+TD_OPEN_MASK_MYSQL_NULL);
tb->setKeyNum(0);
tb->clearBuffer(table::defaultNull);
fields& fds = tb->fields();
if (timestampNull)
{
for (short i = 0 ;i < (short)fds.size(); ++i)
{
bool v = true;
int dv = 0;
if (i == 0 || i == 5 || i == 6) v = false;
BOOST_CHECK_MESSAGE(fds[i].isNull() == v, "testDefaultValue isNull field num = " << i);
if (i == 5) dv = -1;
if (i == 6) dv = -123456;
BOOST_CHECK_MESSAGE(fds[i].i() == dv, "testDefaultValue defaultValue field num = "
<< i << " " << fds[i].i());
}
}else
{
int dfs[13] = {0, 0, 0, 0, 0, -1, -123456, 0, 3, 0, 0, 1, 0};
for (short i = 1 ;i < (short)fds.size(); ++i)
{
BOOST_CHECK_MESSAGE(fds[i].isNull() == (dfs[i] == 0), "testDefaultValue isNull field num = " << i);
if ((dfs[i] < 0) || i == 12)
BOOST_CHECK_MESSAGE(fds[i].i() == dfs[i], "testDefaultValue i() field num = " << i);
else if ((dfs[i] < 3))
BOOST_CHECK_MESSAGE(fds[i].i64() == 0, "testDefaultValue i64() field num = " << i);
}
}
}
catch (bzs::rtl::exception& e)
{
_tprintf(_T("Error ! %s\n"), (*getMsg(e)).c_str());
}
}
示例9: test_circle
void test_circle(Geometry const& geometry, std::string const& wkt_geometry, bool expected)
{
circle_type circle(point_type(1.0, 1.0), 3.0);
bool detected = bg::disjoint(geometry, circle);
BOOST_CHECK_MESSAGE(detected == expected,
"disjoint: " << wkt_geometry
<< " in circle (1,1) with radius 3"
<< " -> Expected: " << expected
<< " detected: " << detected);
}
示例10: BOOST_CHECK_MESSAGE
VersionBitsTester &TestStateSinceHeight(int height) {
for (int i = 0; i < CHECKERS; i++) {
if ((insecure_rand() & ((1 << i) - 1)) == 0) {
BOOST_CHECK_MESSAGE(
checker[i].GetStateSinceHeightFor(
vpblock.empty() ? nullptr : vpblock.back()) == height,
strprintf("Test %i for StateSinceHeight", num));
}
}
num++;
return *this;
}
示例11: test_one
void test_one(std::string const& case_id, std::string const& wkt, bool expected)
{
Geometry geometry;
bg::read_wkt(wkt, geometry);
bg::correct(geometry);
bool detected = bg::is_convex(geometry);
BOOST_CHECK_MESSAGE(detected == expected,
"Not as expected, case: " << case_id
<< " / expected: " << expected
<< " / detected: " << detected);
}
示例12: test_empty_input
void test_empty_input(Geometry1 const& geometry1, Geometry2 const& geometry2)
{
try
{
bg::distance(geometry1, geometry2);
}
catch(bg::empty_input_exception const& )
{
return;
}
BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown" );
}
示例13: check_geometry
void check_geometry(Geometry& geometry, std::string const& wkt, std::string const& expected)
{
bg::reverse(geometry);
std::ostringstream out;
out << bg::wkt(geometry);
BOOST_CHECK_MESSAGE(out.str() == expected,
"reverse: " << wkt
<< " expected " << expected
<< " got " << out.str());
}
示例14: checkClose
void checkClose (const Distance_t& other)
{
BOOST_CHECK_MESSAGE (fabs (d_ - other.d_ ) < 1e-5, "values d are " << d_ << " and " << other.d_);
BOOST_CHECK_MESSAGE (fabs (x0_ - other.x0_ ) < 1e-5, "values x0 are " << x0_ << " and " << other.x0_);
BOOST_CHECK_MESSAGE (fabs (y0_ - other.y0_ ) < 1e-5, "values y0 are " << y0_ << " and " << other.y0_);
BOOST_CHECK_MESSAGE (fabs (z0_ - other.z0_ ) < 1e-5, "values z0 are " << z0_ << " and " << other.z0_);
BOOST_CHECK_MESSAGE (fabs (x1_ - other.x1_ ) < 1e-5, "values x1 are " << x1_ << " and " << other.x1_);
BOOST_CHECK_MESSAGE (fabs (y1_ - other.y1_ ) < 1e-5, "values y1 are " << y1_ << " and " << other.y1_);
BOOST_CHECK_MESSAGE (fabs (z1_ - other.z1_ ) < 1e-5, "values z1 are " << z1_ << " and " << other.z1_);
}
示例15: test_empty_input
void test_empty_input(Geometry const& geometry)
{
try
{
bg::length(geometry);
}
catch(bg::empty_input_exception const& )
{
return;
}
BOOST_CHECK_MESSAGE(false, "A empty_input_exception should have been thrown" );
}