• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ BOOST_CHECK_MESSAGE函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中BOOST_CHECK_MESSAGE函数的典型用法代码示例。如果您正苦于以下问题:C++ BOOST_CHECK_MESSAGE函数的具体用法?C++ BOOST_CHECK_MESSAGE怎么用?C++ BOOST_CHECK_MESSAGE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了BOOST_CHECK_MESSAGE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: test_main

int test_main(int, char *[])
{
	boost::posix_time::time_duration reciprocal_lambda;
	
	double avg_race_time = estimate_avg_race_time();
	
	/* 5.298 = 0.995 quantile of exponential distribution */
	const boost::posix_time::time_duration timeout = boost::posix_time::microseconds((long)(5.298 * avg_race_time));
	
	{
		boost::atomic<unsigned int> value(0);
		
		/* testing two different operations in this loop, therefore
		enlarge timeout */
		boost::posix_time::time_duration tmp(timeout * 2);
		
		bool success = concurrent_runner::execute(
			boost::bind(test_arithmetic<unsigned int, 0>, boost::ref(value), _1),
			tmp
		);
		
		BOOST_CHECK_MESSAGE(success, "concurrent arithmetic");
	}
	
	{
		boost::atomic<unsigned int> value(0);
		
		/* testing three different operations in this loop, therefore
		enlarge timeout */
		boost::posix_time::time_duration tmp(timeout * 3);
		
		bool success = concurrent_runner::execute(
			boost::bind(test_bitops<unsigned int, 0>, boost::ref(value), _1),
			tmp
		);
		
		BOOST_CHECK_MESSAGE(success, "concurrent bitops");
	}
	return 0;
}
开发者ID:Ravenwater,项目名称:dfv-prototype,代码行数:40,代码来源:atomicity.cpp


示例17: TestAES256CBC

void TestAES256CBC(const std::string &hexkey, const std::string &hexiv, bool pad, const std::string &hexin, const std::string &hexout)
{
    std::vector<unsigned char> key = ParseHex(hexkey);
    std::vector<unsigned char> iv = ParseHex(hexiv);
    std::vector<unsigned char> in = ParseHex(hexin);
    std::vector<unsigned char> correctout = ParseHex(hexout);
    std::vector<unsigned char> realout(in.size() + AES_BLOCKSIZE);

    // Encrypt the plaintext and verify that it equals the cipher
    AES256CBCEncrypt enc(&key[0], &iv[0], pad);
    int size = enc.Encrypt(&in[0], in.size(), &realout[0]);
    realout.resize(size);
    BOOST_CHECK(realout.size() == correctout.size());
    BOOST_CHECK_MESSAGE(realout == correctout, HexStr(realout) + std::string(" != ") + hexout);

    // Decrypt the cipher and verify that it equals the plaintext
    std::vector<unsigned char> decrypted(correctout.size());
    AES256CBCDecrypt dec(&key[0], &iv[0], pad);
    size = dec.Decrypt(&correctout[0], correctout.size(), &decrypted[0]);
    decrypted.resize(size);
    BOOST_CHECK(decrypted.size() == in.size());
    BOOST_CHECK_MESSAGE(decrypted == in, HexStr(decrypted) + std::string(" != ") + hexin);

    // Encrypt and re-decrypt substrings of the plaintext and verify that they equal each-other
    for(std::vector<unsigned char>::iterator i(in.begin()); i != in.end(); ++i)
    {
        std::vector<unsigned char> sub(i, in.end());
        std::vector<unsigned char> subout(sub.size() + AES_BLOCKSIZE);
        int size = enc.Encrypt(&sub[0], sub.size(), &subout[0]);
        if (size != 0)
        {
            subout.resize(size);
            std::vector<unsigned char> subdecrypted(subout.size());
            size = dec.Decrypt(&subout[0], subout.size(), &subdecrypted[0]);
            subdecrypted.resize(size);
            BOOST_CHECK(decrypted.size() == in.size());
            BOOST_CHECK_MESSAGE(subdecrypted == sub, HexStr(subdecrypted) + std::string(" != ") + HexStr(sub));
        }
    }
}
开发者ID:thelonecrouton,项目名称:uniqredit,代码行数:40,代码来源:crypto_tests.cpp


示例18: check_touches

void check_touches(Geometry1 const& geometry1,
                   Geometry2 const& geometry2,
                   std::string const& wkt1,
                   std::string const& wkt2,
                   bool expected)
{
    bool detected = bg::touches(geometry1, geometry2);

    BOOST_CHECK_MESSAGE(detected == expected,
        "touches: " << wkt1
        << " with " << wkt2
        << " -> Expected: " << expected
        << " detected: " << detected);

    detected = bg::touches(geometry2, geometry1);

    BOOST_CHECK_MESSAGE(detected == expected,
        "touches: " << wkt2
        << " with " << wkt1
        << " -> Expected: " << expected
        << " detected: " << detected);
}
开发者ID:OggYiu,项目名称:rag-engine,代码行数:22,代码来源:test_touches.hpp


示例19: test_self_intersects

void test_self_intersects(std::string const& wkt, bool expected)
{
    Geometry geometry;

    bg::read_wkt(wkt, geometry);

    bool detected = bg::intersects(geometry);

    BOOST_CHECK_MESSAGE(detected == expected,
        "intersects: " << wkt
        << " -> Expected: " << expected
        << " detected: " << detected);
}
开发者ID:peplopez,项目名称:El-Rayo-de-Zeus,代码行数:13,代码来源:test_intersects.hpp


示例20: testWRDefaultValue

void testWRDefaultValue(database* db, bool timestampNull)
{
    try
    {
        activeTable tb(db, _T("nulltest"));
        writableRecord& wr = tb.getWritableRecord();
        wr.clear();
        if (timestampNull)
        {
            for (short i = 0 ;i < (short)wr.size(); ++i)
            {
                bool v = true;
                int dv = 0;
                if (i == 0 || i == 5 || i == 6) v = false;
                BOOST_CHECK_MESSAGE(wr[i].isNull() == v, "testWRDefaultValue isNull field num = " << i);
                if (i == 5) dv = -1;
                    
                if (i == 6) dv = -123456;
                BOOST_CHECK_MESSAGE(wr[i].i() == dv, "testWRDefaultValue defaultValue field num = " 
                        << i << " " << wr[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)wr.size(); ++i)
            {
                BOOST_CHECK_MESSAGE(wr[i].isNull() == (dfs[i] == 0), "testWRDefaultValue isNull field num = " << i);
                if ((dfs[i] < 0))
                    BOOST_CHECK_MESSAGE(wr[i].i() == dfs[i], "testWRDefaultValue isNull field num = " << i);
                else if ((dfs[i]  < 3))
                    BOOST_CHECK_MESSAGE(wr[i].i64() == 0, "testWRDefaultValue isNull field num = " << i);
            }
        }
    }
    catch (bzs::rtl::exception& e)
    {
        _tprintf(_T("Error ! %s\n"), (*getMsg(e)).c_str());
    }
}
开发者ID:bizstation,项目名称:transactd,代码行数:39,代码来源:test_tdclcpp_v3.cpp



注:本文中的BOOST_CHECK_MESSAGE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ BOOST_CHECK_THROW函数代码示例发布时间:2022-05-30
下一篇:
C++ BOOST_CHECK_CLOSE函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap