當前位置: 首頁>>代碼示例>>C++>>正文


C++ BOOST_CHECK_MESSAGE函數代碼示例

本文整理匯總了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;
}
開發者ID:Alexander--,項目名稱:Wesnoth-1.8-for-Android,代碼行數:43,代碼來源:test_dll_exported.cpp

示例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" );
}
開發者ID:MarcelRaad,項目名稱:geometry,代碼行數:11,代碼來源:test_convex_hull.hpp

示例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!");
	}
}
開發者ID:gatzka,項目名稱:cjet,代碼行數:20,代碼來源:method_test.cpp

示例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);
}
開發者ID:OggYiu,項目名稱:rag-engine,代碼行數:11,代碼來源:test_touches.hpp

示例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);
}
開發者ID:Adikteev,項目名稱:rtbkit-deps,代碼行數:11,代碼來源:test_disjoint.hpp

示例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);
}
開發者ID:gatzka,項目名稱:cjet,代碼行數:11,代碼來源:method_test.cpp

示例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;
    }
開發者ID:Adikteev,項目名稱:rtbkit-deps,代碼行數:11,代碼來源:test_is_valid.hpp

示例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());
    }
}
開發者ID:bizstation,項目名稱:transactd,代碼行數:41,代碼來源:test_tdclcpp_v3.cpp

示例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);
}
開發者ID:AlexMioMio,項目名稱:boost,代碼行數:12,代碼來源:disjoint.cpp

示例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;
 }
開發者ID:CommerciumBlockchain,項目名稱:Commercium_Deprecated,代碼行數:12,代碼來源:versionbits_tests.cpp

示例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);
}
開發者ID:LancelotGHX,項目名稱:Simula,代碼行數:12,代碼來源:is_convex.cpp

示例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" );
}
開發者ID:OggYiu,項目名稱:rag-engine,代碼行數:12,代碼來源:test_distance_common.hpp

示例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());
}
開發者ID:Adikteev,項目名稱:rtbkit-deps,代碼行數:12,代碼來源:test_reverse.hpp

示例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_);
 }
開發者ID:MaximilienNaveau,項目名稱:pinocchio,代碼行數:10,代碼來源:geom.cpp

示例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" );
}
開發者ID:LocutusOfBorg,項目名稱:poedit,代碼行數:12,代碼來源:test_length.hpp


注:本文中的BOOST_CHECK_MESSAGE函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。