当前位置: 首页>>代码示例>>C++>>正文


C++ BOOST_REQUIRE_EQUAL函数代码示例

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


在下文中一共展示了BOOST_REQUIRE_EQUAL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BOOST_FIXTURE_TEST_CASE

BOOST_FIXTURE_TEST_CASE(UnregisterWithoutConnection, RemoteRegistratorFixture)
{
  connectToHub();

  disconnectToHub();

  Name indentity("/remote/register");
  remoteRegistrator->m_regEntries.insert(
            nfd::rib::RemoteRegistrator::RegisteredEntry(indentity, scheduler::EventId()));

  eraseEntryWithIdentity(indentity);

  BOOST_REQUIRE_EQUAL(face->sentInterests.size(), 0);
}
开发者ID:AaronTien,项目名称:NFD,代码行数:14,代码来源:remote-registrator.t.cpp

示例2: BOOST_FIXTURE_TEST_CASE

BOOST_FIXTURE_TEST_CASE( previous, previous_fixture )
{
    it_u8 = enc_u8_end;

    for (size_t i = dec.size( ); i > 0; --i)
    {
        std::string::const_iterator last = it_u8;
        BOOST_TEST_CHECKPOINT( "i=" << i << " cp=U+" << std::hex << (uint32_t)dec[i - 1] );

        char32_t cp = lib::previous( it_u8 );
        BOOST_REQUIRE_EQUAL( cp, dec[i - 1] );
        BOOST_REQUIRE( it_u8 == last - enc_u8_cp_size[i - 1] );
    }
}
开发者ID:BurningEnlightenment,项目名称:UTF8XX,代码行数:14,代码来源:unchecked_tests.cpp

示例3: BOOST_FIXTURE_TEST_CASE

BOOST_FIXTURE_TEST_CASE(BlockedPaths, WorldFixtureEmpty0P)
{
    MapPoint startPt(10, 10);
    // Create a circle of stones so the path is completely blocked
    std::vector<MapPoint> surroundingPts = world.GetPointsInRadius(startPt, 1);
    BOOST_FOREACH(const MapPoint& pt, surroundingPts)
        world.SetNO(pt, new noGranite(GT_1, 1));
    std::vector<MapPoint> surroundingPts2;
    for(unsigned i=0; i<12; i++)
        surroundingPts2.push_back(world.GetNeighbour2(startPt, i));
    BOOST_FOREACH(const MapPoint& pt, surroundingPts2)
        BOOST_REQUIRE_EQUAL(world.FindHumanPath(startPt, pt), INVALID_DIR);
    // Allow left exit
    world.DestroyNO(surroundingPts[0]);
    BOOST_REQUIRE_EQUAL(world.FindHumanPath(startPt, surroundingPts2[0]), 0);
    BOOST_REQUIRE(checkWalkOnTerrain(world, startPt, surroundingPts2[0], Direction::WEST, TT_WATER, true));
    BOOST_REQUIRE(checkWalkOnTerrain(world, startPt, surroundingPts2[0], Direction::WEST, TT_SWAMPLAND, true));
    BOOST_REQUIRE(checkWalkOnTerrain(world, startPt, surroundingPts2[0], Direction::WEST, TT_LAVA, false));
    BOOST_REQUIRE(checkWalkOnTerrain(world, startPt, surroundingPts2[0], Direction::WEST, TT_SNOW, false));

    BOOST_REQUIRE(checkWalkOnPoint(world, startPt, surroundingPts2[0], Direction::WEST, TT_WATER));
    BOOST_REQUIRE(checkWalkOnPoint(world, startPt, surroundingPts2[0], Direction::WEST, TT_SWAMPLAND));
}
开发者ID:vader1986,项目名称:s25client,代码行数:23,代码来源:testPaths.cpp

示例4: BOOST_FIXTURE_TEST_CASE

BOOST_FIXTURE_TEST_CASE(read_by_two_bits, Fixture)
{
    v_t shift_results = {0x0, 0x0, 0x3, 0x3, 0x3, 0x3, 0x0, 0x0, 0x3, 0x3, 0x3, 0x3};
    v_t deref_results = {0xf0, 0xf3, 0xff, 0xcf, 0x0f, 0x0f, 0x0f, 0x3f, 0xff, 0xfc, 0xf0, 0xc0};
    for (size_t i = 0; i < shift_results.size(); ++i)
    {
        BOOST_TEST_CHECKPOINT("Shifted " << i << " times so far");
        BOOST_CHECK_EQUAL(*bit, deref_results[i]);
        unsigned char shifted = bit.shift(2);
        BOOST_REQUIRE_EQUAL(bit.shift(), ((i+1)*2)%8);
        BOOST_REQUIRE_LT(shifted, 4);
        BOOST_CHECK_EQUAL(shifted, shift_results[i]);
    }
}
开发者ID:JMSerruya,项目名称:sc2pp,代码行数:14,代码来源:bitshift_iterator.cpp

示例5: checkGet

void checkGet(const openfluid::utils::RESTClient& Client)
{
  openfluid::utils::RESTClient::Reply Reply;

  Reply = Client.getResource("/users");
  std::cout << "GET /users : " << Reply.getStatusCode() << std::endl;
  BOOST_REQUIRE(Reply.isOK());
  BOOST_REQUIRE_EQUAL(Reply.getStatusCode(),200);
  BOOST_REQUIRE_NE(Reply.getContent().indexOf("\"username\": \"Bret\""),-1);

  Reply = Client.getResource("/users/23");
  std::cout << "GET /users/23 : " << Reply.getStatusCode() << std::endl;
  std::cout << "  - " << Reply.getNetworkErrorCode() << ": " <<
               Reply.getNetworkErrorString().toStdString() << std::endl;
  BOOST_REQUIRE(!Reply.isOK());
  BOOST_REQUIRE_EQUAL(Reply.getStatusCode(),404);

  Reply = Client.getResource("/users/2");
  std::cout << "GET /users/2 : " << Reply.getStatusCode() << std::endl;
  BOOST_REQUIRE(Reply.isOK());
  BOOST_REQUIRE_EQUAL(Reply.getStatusCode(),200);
  BOOST_REQUIRE_NE(Reply.getContent().indexOf("\"username\": \"Antonette\""),-1);
}
开发者ID:fabrejc,项目名称:travis-test,代码行数:23,代码来源:RESTClient_TEST.cpp

示例6: msg_alloc3

void * msg_alloc3(size_t msg_i ,size_t total_msg, size_t total_p, size_t i, size_t ri, void * ptr)
{
	openfpm::vector<openfpm::vector<unsigned char>> * v = static_cast<openfpm::vector<openfpm::vector<unsigned char>> *>(ptr);

	v->add();

	prc_recv.add();

	BOOST_REQUIRE_EQUAL(msg_i, global_step);

	v->last().resize(msg_i);
	prc_recv.last() = i;
	return &(v->last().get(0));
}
开发者ID:incardon,项目名称:openfpm_vcluster,代码行数:14,代码来源:VCluster_unit_test_util.hpp

示例7: test_set_backend_ids_for_enabled

static void test_set_backend_ids_for_enabled(session &sess)
{
	server_node &node = global_data->nodes.back();

	auto ids = generate_ids(16);

	ELLIPTICS_REQUIRE(async_set_result, sess.set_backend_ids(node.remote(), 4, ids));

	backend_status_result_entry result = async_set_result.get_one();
	BOOST_REQUIRE(result.is_valid());
	BOOST_REQUIRE_EQUAL(result.count(), 1);

	dnet_backend_status *status = result.backend(0);
	BOOST_REQUIRE_EQUAL(status->backend_id, 4);
	BOOST_REQUIRE_EQUAL(status->state, DNET_BACKEND_ENABLED);

	// Wait 0.1 secs to ensure that route list was changed
	usleep(100 * 1000);

	auto route_ids = backend_ids(sess, node.remote(), 4);
	BOOST_REQUIRE_EQUAL(ids.size(), route_ids.size());
	BOOST_REQUIRE(compare_ids(ids, route_ids));
}
开发者ID:ProgDevel,项目名称:elliptics,代码行数:23,代码来源:backends_test.cpp

示例8: msg_alloc2

void * msg_alloc2(size_t msg_i ,size_t total_msg, size_t total_p, size_t i, size_t ri, void * ptr)
{
	openfpm::vector<openfpm::vector<unsigned char>> * v = static_cast<openfpm::vector<openfpm::vector<unsigned char>> *>(ptr);

	v->resize(total_p);
	prc_recv.resize(total_p);

	BOOST_REQUIRE_EQUAL(msg_i, global_step);

	id++;
	v->get(id-1).resize(msg_i);
	prc_recv.get(id-1) = i;
	return &(v->get(id-1).get(0));
}
开发者ID:incardon,项目名称:openfpm_vcluster,代码行数:14,代码来源:VCluster_unit_test_util.hpp

示例9: test_backend_status

static void test_backend_status(session &sess)
{
	server_node &node = global_data->nodes[0];

	ELLIPTICS_REQUIRE(async_status_result, sess.request_backends_status(node.remote()));
	sync_backend_status_result result = async_status_result;

	BOOST_REQUIRE_EQUAL(result.size(), 1);

	backend_status_result_entry entry = result.front();

	BOOST_REQUIRE_EQUAL(entry.count(), backends_count);

	for (size_t i = 0; i < backends_count; ++i) {
		dnet_backend_status *status = entry.backend(i);
		BOOST_REQUIRE_EQUAL(status->backend_id, i);
		if (i < 2 || i == 3) {
			BOOST_REQUIRE_EQUAL(status->state, DNET_BACKEND_ENABLED);
		} else {
			BOOST_REQUIRE_EQUAL(status->state, DNET_BACKEND_DISABLED);
		}
	}
}
开发者ID:ProgDevel,项目名称:elliptics,代码行数:23,代码来源:backends_test.cpp

示例10: test_make_backend_readonly

static void test_make_backend_readonly(session &sess)
{
	server_node &node = global_data->nodes.back();
	const key id = std::string("read_only_key");
	const std::string data = "read_only_data";

	ELLIPTICS_REQUIRE(async_readonly_result, sess.make_readonly(node.remote(), 4));

	backend_status_result_entry result = async_readonly_result.get_one();
	BOOST_REQUIRE(result.is_valid());
	BOOST_REQUIRE_EQUAL(result.count(), 1);

	dnet_backend_status *status = result.backend(0);
	BOOST_REQUIRE_EQUAL(status->backend_id, 4);
	BOOST_REQUIRE_EQUAL(status->read_only, true);

	session new_sess = sess.clone();
	new_sess.set_direct_id(node.remote(), 4);

	ELLIPTICS_REQUIRE_ERROR(write_result, new_sess.write_data(id, data, 0), -EROFS);

	ELLIPTICS_REQUIRE_ERROR(second_async_readonly_result, sess.make_readonly(node.remote(), 4), -EALREADY);
}
开发者ID:ProgDevel,项目名称:elliptics,代码行数:23,代码来源:backends_test.cpp

示例11: test_check_initial_config

static void test_check_initial_config(session &sess) {
	auto &node = get_setup()->nodes.back();
	static const uint32_t backend_id = 4;

	ELLIPTICS_REQUIRE(result, sess.monitor_stat(node.remote(), DNET_MONITOR_BACKEND));
	BOOST_REQUIRE_EQUAL(result.get().size(), 1);

	auto monitor_initial_config = [&] () {
		std::istringstream stream(result.get().front().statistics());
		auto monitor_statistics = kora::dynamic::read_json(stream);
		return monitor_statistics.as_object()["backends"]
			.as_object()[std::to_string(backend_id)]
			.as_object()["backend"]
			.as_object()["initial_config"];
	} ();

	auto config_initial_config = [&] () {
		std::ifstream stream(node.config_path());
		auto config = kora::dynamic::read_json(stream);
		return config.as_object()["backends"].as_array()[backend_id];
	} ();
	BOOST_REQUIRE_EQUAL(monitor_initial_config, config_initial_config);
}
开发者ID:interiorem,项目名称:elliptics,代码行数:23,代码来源:backends_test.cpp

示例12: assert_output_equals

void assert_output_equals(const std::string& file, const std::string& output, const std::string& param1, const std::string& param2, const std::string& param3){
    auto configuration = parse_options("test/cases/" + file, param1, param2, param3);

    eddic::Compiler compiler;
    int code = compiler.compile("test/cases/" + file, configuration);

    BOOST_REQUIRE_EQUAL (code, 0);

    std::string out = eddic::execCommand("./" + param3); 
    
    BOOST_CHECK_EQUAL (output, out);
    
    remove("./" + param3);
}
开发者ID:shenyanjun,项目名称:eddic,代码行数:14,代码来源:IntegrationTests.cpp

示例13: prepared_check_column_count_after_alter

  /**
   * Check the column count of a bound statement before and after adding a
   * column to a table.
   *
   * @param expected_column_count_after_update
   */
  void prepared_check_column_count_after_alter(size_t expected_column_count_after_update) {
    test_utils::CassSessionPtr session(test_utils::create_session(cluster));

    test_utils::execute_query(session.get(), str(boost::format("USE %s") % keyspace));

    test_utils::CassFuturePtr future(cass_session_prepare(session.get(), "SELECT * FROM test WHERE k = 'key1'"));
    BOOST_REQUIRE_EQUAL(cass_future_error_code(future.get()), CASS_OK);

    test_utils::CassPreparedPtr prepared(cass_future_get_prepared(future.get()));
    BOOST_REQUIRE(prepared);

    test_utils::CassStatementPtr bound_statement(cass_prepared_bind(prepared.get()));
    BOOST_REQUIRE(bound_statement);

    // Verify that the table has two columns in the metadata
    {
      test_utils::CassFuturePtr result_future(cass_session_execute(session.get(), bound_statement.get()));
      BOOST_REQUIRE_EQUAL(cass_future_error_code(result_future.get()), CASS_OK);

      test_utils::CassResultPtr result(cass_future_get_result(result_future.get()));

      BOOST_CHECK_EQUAL(cass_result_column_count(result.get()), 2u);
    }

    // Add a column to the table
    test_utils::execute_query(session.get(), "ALTER TABLE test ADD v2 int");

    // The column count shouldn't have changed
    {
      test_utils::CassFuturePtr result_future(cass_session_execute(session.get(), bound_statement.get()));
      BOOST_REQUIRE_EQUAL(cass_future_error_code(result_future.get()), CASS_OK);

      test_utils::CassResultPtr result(cass_future_get_result(result_future.get()));

      BOOST_CHECK_EQUAL(cass_result_column_count(result.get()), expected_column_count_after_update);
    }
  }
开发者ID:cybergarage,项目名称:cpp-driver,代码行数:43,代码来源:test_prepared_metadata.cpp

示例14: run_test_6

void run_test_6(void)
{
    typedef nova::dsp_thread_queue_item<dummy_runnable, Alloc> dsp_thread_queue_item;
    typedef nova::dsp_thread_queue<dummy_runnable, Alloc> dsp_thread_queue;
    typedef nova::dsp_threads<dummy_runnable, nova::nop_thread_init, Alloc> dsp_threads;

    typedef std::auto_ptr<dsp_thread_queue> dsp_thread_queue_ptr;

    dsp_threads t(2);
    t.start_threads();

    dsp_thread_queue_ptr q (new dsp_thread_queue(20));

    std::vector<dsp_thread_queue_item*> items;

    for (int i = 0; i != 20; ++i)
    {
        items.push_back(q->allocate_queue_item(dummy, typename dsp_thread_queue_item::successor_list(), 0));
        q->add_initially_runnable(items.back());
    }

    t.reset_queue(MOVE(q));

    const int iterations = 10000;

    for (int i = 0; i != iterations; ++i)
    {
        for (int item = 0; item != 20; ++item)
            BOOST_REQUIRE_EQUAL(items[item]->get_job().i, i);
        t.run();
    }

    t.terminate_threads();

    for (int i = 0; i != 20; ++i)
        BOOST_REQUIRE_EQUAL(items[i]->get_job().i, iterations);
}
开发者ID:mrotondo,项目名称:SuperCollider,代码行数:37,代码来源:server_dsp_thread_test.cpp

示例15: runDoubleRing

/* Run two small non-overlapping rings with different delays */
void
runDoubleRing(backend_t backend)
{
	/* Make sure we go around the ring at least a couple of times */
	const unsigned ncount = 512;
	const unsigned duration = ncount * 5 / 2;

	nemo::Configuration conf = configuration(false, 1024);
	setBackend(backend, conf);

	boost::scoped_ptr<nemo::Network> net(new nemo::Network);

	createRing(net.get(), ncount, 0, false, 1, 1);
	createRing(net.get(), ncount, ncount, false, 1, 2);

	boost::scoped_ptr<nemo::Simulation> sim(nemo::simulation(*net, conf));

	/* Stimulate a single neuron in each ring to get them going */
	std::vector<unsigned> fstim;
	fstim.push_back(0);
	fstim.push_back(ncount);

	sim->step(fstim);

	for(unsigned ms=1; ms < duration; ++ms) {
		const std::vector<unsigned>& fired = sim->step();
		if(ms % 2 == 0) {
			BOOST_CHECK_EQUAL(fired.size(), 2U);
			BOOST_REQUIRE_EQUAL(fired[0], ms % ncount);
			BOOST_REQUIRE_EQUAL(fired[1], ncount + (ms / 2) % ncount);
		} else {
			BOOST_CHECK_EQUAL(fired.size(), 1U);
			BOOST_REQUIRE_EQUAL(fired.front(), ms % ncount);
		}
	}
}
开发者ID:MogeiWang,项目名称:nemosim,代码行数:37,代码来源:test.cpp


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