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

C++ BOOST_CHECK函数代码示例

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

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



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

示例1: test_sequence_with_comparison

void test_sequence_with_comparison ( Container &v, Comp comp, typename Container::value_type minE, typename Container::value_type maxE ) {

	typedef std::pair <typename Container::iterator, typename Container::iterator> Pair;

	Pair res = ba::minmax_element ( v.begin (), v.end (), comp );
	BOOST_CHECK ( *res.first == minE );
	BOOST_CHECK ( *res.second == maxE );

	std::reverse ( v.begin (), v.end ());
	res = ba::minmax_element ( v.begin (), v.end (), comp );
	BOOST_CHECK ( *res.first == minE );
	BOOST_CHECK ( *res.second == maxE );
	
	std::random_shuffle ( v.begin (), v.end ());
	res = ba::minmax_element ( v.begin (), v.end (), comp );
	BOOST_CHECK ( *res.first == minE );
	BOOST_CHECK ( *res.second == maxE );
	
//	One element
	int v0 = v[0];
	res = ba::minmax_element ( v.begin (), v.begin () + 1, comp );
	BOOST_CHECK ( *res.first == v0 );
	BOOST_CHECK ( *res.second == v0 );
	
//	Two elements
	int v1 = v[1];
	res = ba::minmax_element ( v.begin (), v.begin () + 2, comp );
	if ( comp ( v0, v1 )) {
		BOOST_CHECK ( *res.first  == v0 );
		BOOST_CHECK ( *res.second == v1 );
		}
	else {
		BOOST_CHECK ( *res.first  == v1 );
		BOOST_CHECK ( *res.second == v0 );
		}
	
	}
开发者ID:ZaMaZaN4iK,项目名称:Boost.Algorithm,代码行数:37,代码来源:minmax_test1.cpp


示例2: test_threading_level_cmp

void
test_threading_level_cmp() {
  namespace mt = boost::mpi::threading;
  BOOST_CHECK(mt::single == mt::single);
  BOOST_CHECK(mt::funneled == mt::funneled);
  BOOST_CHECK(mt::serialized == mt::serialized);
  BOOST_CHECK(mt::multiple == mt::multiple);
  
  BOOST_CHECK(mt::single != mt::funneled);
  BOOST_CHECK(mt::single != mt::serialized);
  BOOST_CHECK(mt::single != mt::multiple);

  BOOST_CHECK(mt::funneled != mt::single);
  BOOST_CHECK(mt::funneled != mt::serialized);
  BOOST_CHECK(mt::funneled != mt::multiple);

  BOOST_CHECK(mt::serialized != mt::single);
  BOOST_CHECK(mt::serialized != mt::funneled);
  BOOST_CHECK(mt::serialized != mt::multiple);

  BOOST_CHECK(mt::multiple != mt::single);
  BOOST_CHECK(mt::multiple != mt::funneled);
  BOOST_CHECK(mt::multiple != mt::serialized);

  BOOST_CHECK(mt::single < mt::funneled);
  BOOST_CHECK(mt::funneled > mt::single);
  BOOST_CHECK(mt::single < mt::serialized);
  BOOST_CHECK(mt::serialized > mt::single);
  BOOST_CHECK(mt::single < mt::multiple);
  BOOST_CHECK(mt::multiple > mt::single);

  BOOST_CHECK(mt::funneled < mt::serialized);
  BOOST_CHECK(mt::serialized > mt::funneled);
  BOOST_CHECK(mt::funneled < mt::multiple);
  BOOST_CHECK(mt::multiple > mt::funneled);

  BOOST_CHECK(mt::serialized < mt::multiple);
  BOOST_CHECK(mt::multiple > mt::serialized);

  BOOST_CHECK(mt::single <= mt::single);
  BOOST_CHECK(mt::single <= mt::funneled);
  BOOST_CHECK(mt::funneled >= mt::single);
  BOOST_CHECK(mt::single <= mt::serialized);
  BOOST_CHECK(mt::serialized >= mt::single);
  BOOST_CHECK(mt::single <= mt::multiple);
  BOOST_CHECK(mt::multiple >= mt::single);

  BOOST_CHECK(mt::funneled <= mt::funneled);
  BOOST_CHECK(mt::funneled <= mt::serialized);
  BOOST_CHECK(mt::serialized >= mt::funneled);
  BOOST_CHECK(mt::funneled <= mt::multiple);
  BOOST_CHECK(mt::multiple >= mt::funneled);

  BOOST_CHECK(mt::serialized <= mt::serialized);
  BOOST_CHECK(mt::serialized <= mt::multiple);
  BOOST_CHECK(mt::multiple >= mt::serialized);

  BOOST_CHECK(mt::multiple <= mt::multiple);
}
开发者ID:Adikteev,项目名称:rtbkit-deps,代码行数:59,代码来源:mt_level_test.cpp


示例3: BOOST_FOREACH

 BOOST_FOREACH(const T& v, const_pre_vector) {
      BOOST_CHECK(v == real_vector[pos++]);
 }
开发者ID:1000000000001,项目名称:bitcoin,代码行数:3,代码来源:prevector_tests.cpp


示例4: test_contains

void test_contains() {
	RangeList16 rl;
	rl.merge(0, 5);
	rl.merge(6, 10);
	rl.merge(12, 15);
	rl.merge(21, 26);
	BOOST_CHECK(rl.size() == 3);
	BOOST_CHECK(rl.contains(Range16(0)));
	BOOST_CHECK(rl.contains(Range16(4)));
	BOOST_CHECK(rl.contains(Range16(6)));
	BOOST_CHECK(rl.contains(Range16(10)));
	BOOST_CHECK(!rl.contains(Range16(11)));
	BOOST_CHECK(rl.contains(Range16(12)));
	BOOST_CHECK(!rl.contains(Range16(16)));
	BOOST_CHECK(rl.contains(Range16(21)));
	BOOST_CHECK(rl.contains(Range16(26)));
	BOOST_CHECK(!rl.contains(Range16(27)));

	BOOST_CHECK(rl.getContains(0, 0) != rl.end());
	BOOST_CHECK(rl.getContains(5, 5) != rl.end());
	BOOST_CHECK(rl.getContains(12, 15) != rl.end());
	BOOST_CHECK(rl.getContains(0, 0)->begin() == 0);
	BOOST_CHECK(rl.getContains(0, 0)->end() == 10);
	BOOST_CHECK(rl.getContains(0, 5)->begin() == 0);
	BOOST_CHECK(rl.getContains(0, 5)->end() == 10);
	BOOST_CHECK(rl.getContains(12, 13)->begin() == 12);
	BOOST_CHECK(rl.getContains(12, 13)->end() == 15);
	BOOST_CHECK(rl.getContains(16, 16) == rl.end());
	BOOST_CHECK(rl.getContains(12, 20) != rl.end());
	BOOST_CHECK(rl.getContains(12, 20)->begin() == 12);
	BOOST_CHECK(rl.getContains(12, 20)->end() == 15);

	rl.push(0, 15);
	BOOST_CHECK(rl.contains(Range16(0)));
	BOOST_CHECK(rl.contains(Range16(5)));
	BOOST_CHECK(rl.contains(Range16(11)));
	BOOST_CHECK(rl.contains(Range16(12)));
	BOOST_CHECK(rl.contains(Range16(13)));

	rl.clear();
	rl.merge(0, 5);
	rl.merge(10, 15);
	rl.merge(20, 25);
	BOOST_CHECK(rl.contains(0, 2));
	BOOST_CHECK(rl.contains(3, 4));
	BOOST_CHECK(rl.contains(0, 5));
	BOOST_CHECK(rl.contains(5, 6));
	BOOST_CHECK(!rl.contains(6, 9));
	BOOST_CHECK(rl.contains(6, 10));
	BOOST_CHECK(rl.contains(Range16(10)));
	BOOST_CHECK(rl.contains(10, 10));
	BOOST_CHECK(rl.contains(10, 13));
	BOOST_CHECK(rl.contains(0, 20));
	BOOST_CHECK(!rl.contains(26, 28));
}
开发者ID:alosarv,项目名称:hydranode,代码行数:55,代码来源:test-range.cpp


示例5: test_merge

void test_merge() {
	RangeList16 rl;
	rl.push(0, 5);
	BOOST_CHECK(rl.size() == 1);
	// duplicates are allowed
	BOOST_CHECK(rl.push(0, 1));
	BOOST_CHECK(rl.push(5, 5));
	BOOST_CHECK(rl.push(0, 100));
	BOOST_CHECK(rl.size() == 4);
	rl.clear();
	rl.merge(0, 5);
	BOOST_CHECK(rl.size() == 1);
	rl.merge(5, 6);
	BOOST_CHECK(rl.size() == 1);
	rl.merge(7, 10);
	BOOST_CHECK(rl.size() == 1);
	rl.erase(5, 6);
	BOOST_CHECK(rl.size() == 2);
	rl.erase(3, 6);
	BOOST_CHECK(rl.size() == 2);
	rl.erase(0, 10);
	BOOST_CHECK(rl.size() == 0);
	rl.merge(0, 4);
	rl.merge(5, 10);
	rl.merge(4, 4);
	BOOST_CHECK(rl.size() == 1);
}
开发者ID:alosarv,项目名称:hydranode,代码行数:27,代码来源:test-range.cpp


示例6: BOOST_FIXTURE_TEST_CASE

BOOST_FIXTURE_TEST_CASE(is_a_receivable, F)
{
  logsvc::prot::Disconnect disconnect;
  BOOST_CHECK(dynamic_cast<logsvc::prot::Receivable*>(&disconnect));
}
开发者ID:erikalds,项目名称:logsvc,代码行数:5,代码来源:TestDisconnect.cpp


示例7: test_more

void test_more() {
	RangeList16 r;
	typedef Range16 RR;
	typedef RangeList16::CIter CIter;

	CIter i;

	/**************************** PART I: Adding *************************/
	BOOST_CHECK_NO_THROW(r.merge(RR(5, 10)));
	i = r.begin();
	BOOST_CHECK((*i).begin() == 5);
	BOOST_CHECK((*i).end() == 10);

	BOOST_CHECK_NO_THROW(r.merge(RR(20, 30)));
	i++;
	BOOST_CHECK((*i).begin() == 20);
	BOOST_CHECK((*i).end() == 30);
	BOOST_CHECK(r.size() == 2);

	// RC_CONTAINS_END
	BOOST_CHECK_NO_THROW(r.merge(RR(3, 6)));
	i = r.begin();
	BOOST_CHECK((*i).begin() == 3);
	BOOST_CHECK((*i).end() == 10);
	i++;
	BOOST_CHECK((*i).begin() == 20);
	BOOST_CHECK((*i).end() == 30);
	BOOST_CHECK(r.size() == 2);

	// RC_CONTAINS_FULL - list shouldn't be changed
	BOOST_CHECK_NO_THROW(r.merge(RR(4, 8)));
	BOOST_CHECK_NO_THROW(r.merge(RR(3, 4)));
	i = r.begin();
	BOOST_CHECK((*i).begin() == 3);
	BOOST_CHECK((*i).end() == 10);
	i++;
	BOOST_CHECK((*i).begin() == 20);
	BOOST_CHECK((*i).end() == 30);
	BOOST_CHECK(r.size() == 2);

	// RC_CONTAINS_BEGIN
	BOOST_CHECK_NO_THROW(r.merge(RR(8, 12)));
	i = r.begin();
	BOOST_CHECK((*i).begin() == 3);
	BOOST_CHECK((*i).end() == 12);
	i++;
	BOOST_CHECK((*i).begin() == 20);
	BOOST_CHECK((*i).end() == 30);
	BOOST_CHECK(r.size() == 2);

	// RC_BORDER_BEGIN
	BOOST_CHECK_NO_THROW(r.merge(RR(15, 19)));
	i = r.begin();
	BOOST_CHECK((*i).begin() == 3);
	BOOST_CHECK((*i).end() == 12);
	i++;
	BOOST_CHECK((*i).begin() == 15);
	BOOST_CHECK((*i).end() == 30);
	BOOST_CHECK(r.size() == 2);

	// RC_BORDER_END
	BOOST_CHECK_NO_THROW(r.merge(RR(31, 35)));
	i = r.begin();
	BOOST_CHECK((*i).begin() == 3);
	BOOST_CHECK((*i).end() == 12);
	i++;
	BOOST_CHECK((*i).begin() == 15);
	BOOST_CHECK((*i).end() == 35);
	BOOST_CHECK(r.size() == 2);

	// RC_BORDER_END
	BOOST_CHECK_NO_THROW(r.merge(RR(35, 37)));
	i = r.begin();
	BOOST_CHECK((*i).begin() == 3);
	BOOST_CHECK((*i).end() == 12);
	i++;
	BOOST_CHECK((*i).begin() == 15);
	BOOST_CHECK((*i).end() == 37);
	BOOST_CHECK(r.size() == 2);

	// Insert between the two existing ranges
	BOOST_CHECK_NO_THROW(r.merge(RR(13, 14)));
	i = r.begin();
	BOOST_CHECK((*i).begin() == 3);
	BOOST_CHECK((*i).end() == 37);
	BOOST_CHECK(r.size() == 1);

	/************************** PART II: Erasing *************************/
	// splitting existing range into two
	BOOST_CHECK_NO_THROW(r.erase(RR(10, 12)));

	i = r.begin();
	BOOST_CHECK((*i).begin() == 3);
	BOOST_CHECK((*i).end() == 9);
	i++;
	BOOST_CHECK((*i).begin() == 13);
	BOOST_CHECK((*i).end() == 37);
	BOOST_CHECK(r.size() == 2);

	// removing range that doesnt exist
//.........这里部分代码省略.........
开发者ID:alosarv,项目名称:hydranode,代码行数:101,代码来源:test-range.cpp


示例8: empty_set_types_variety_test

void empty_set_types_variety_test()
{
    BOOST_CHECK(!(has_key<Set, char>::value));
    BOOST_CHECK(!(has_key<Set, int>::value));
    BOOST_CHECK(!(has_key<Set, UDT>::value));
    BOOST_CHECK(!(has_key<Set, incomplete>::value));

    BOOST_CHECK(!(has_key<Set, char const>::value));
    BOOST_CHECK(!(has_key<Set, int const>::value));
    BOOST_CHECK(!(has_key<Set, UDT const>::value));
    BOOST_CHECK(!(has_key<Set, incomplete const>::value));

    BOOST_CHECK(!(has_key<Set, int *>::value));
    BOOST_CHECK(!(has_key<Set, UDT *>::value));
    BOOST_CHECK(!(has_key<Set, incomplete *>::value));

    BOOST_CHECK(!(has_key<Set, int &>::value));
    BOOST_CHECK(!(has_key<Set, UDT &>::value));
    BOOST_CHECK(!(has_key<Set, incomplete &>::value));
}
开发者ID:oakad,项目名称:ucpf,代码行数:20,代码来源:set.cpp


示例9: set_types_variety_test

void set_types_variety_test()
{
	BOOST_CHECK_EQUAL((size<Set>::value), 8);

	BOOST_CHECK((has_key<Set, char>::value));
	BOOST_CHECK((has_key<Set, int const>::value));
	BOOST_CHECK((has_key<Set, long *>::value));
	BOOST_CHECK((has_key<Set, UDT * const>::value));
	BOOST_CHECK((has_key<Set, incomplete>::value));
	BOOST_CHECK((has_key<Set, abstract>::value));
	BOOST_CHECK((has_key<Set, incomplete volatile &>::value));
	BOOST_CHECK((has_key<Set, abstract const &>::value));

	BOOST_CHECK(!(has_key<Set, char const>::value));
	BOOST_CHECK(!(has_key<Set, int>::value));
	BOOST_CHECK(!(has_key<Set, long * const>::value));
	BOOST_CHECK(!(has_key<Set, UDT *>::value));
	BOOST_CHECK(!(has_key<Set, incomplete const>::value));
	BOOST_CHECK(!(has_key<Set, abstract volatile>::value));
	BOOST_CHECK(!(has_key<Set, incomplete &>::value));
	BOOST_CHECK(!(has_key<Set, abstract &>::value));
}
开发者ID:oakad,项目名称:ucpf,代码行数:22,代码来源:set.cpp


示例10: test_one

void test_one ()
{
//  Note: The literal values here are tested against directly, careful if you change them:
    int some_numbers[] = { 1, 1, 2, 3, 5 };
    std::vector<int> vi(some_numbers, some_numbers + 5);
    std::list<int>   li(vi.begin(), vi.end ());
    
    int some_letters[] = { 'a', 'q', 'n', 'y', 'n' };
    std::vector<char> vc(some_letters, some_letters + 5);
    
    BOOST_CHECK (!ba::one_of_equal ( vi,                                  1 ));
    BOOST_CHECK (!ba::one_of       ( vi,                       is_<int> ( 1 )));
    BOOST_CHECK (!ba::one_of_equal ( vi.begin(),     vi.end(),            1 ));
    BOOST_CHECK (!ba::one_of       ( vi.begin(),     vi.end(), is_<int> ( 1 )));

    BOOST_CHECK (!ba::one_of_equal ( vi,                                  0 ));
    BOOST_CHECK (!ba::one_of       ( vi,                       is_<int> ( 0 )));
    BOOST_CHECK (!ba::one_of_equal ( vi.begin(),     vi.end(),            0 ));
    BOOST_CHECK (!ba::one_of       ( vi.begin(),     vi.end(), is_<int> ( 0 )));
    
    BOOST_CHECK ( ba::one_of_equal ( vi,                                  2 ));
    BOOST_CHECK ( ba::one_of       ( vi,                       is_<int> ( 2 )));
    BOOST_CHECK ( ba::one_of_equal ( vi.begin(),     vi.end(),            2 ));
    BOOST_CHECK ( ba::one_of       ( vi.begin(),     vi.end(), is_<int> ( 2 )));

//  Check for a match at the end
    BOOST_CHECK ( ba::one_of_equal ( vi,                                  5 ));
    BOOST_CHECK ( ba::one_of       ( vi,                       is_<int> ( 5 )));
    BOOST_CHECK ( ba::one_of_equal ( vi.begin(),     vi.end(),            5 ));
    BOOST_CHECK ( ba::one_of       ( vi.begin(),     vi.end(), is_<int> ( 5 )));

    BOOST_CHECK ( ba::one_of_equal ( vi.begin() + 1, vi.end(),            1 ));
    BOOST_CHECK ( ba::one_of       ( vi.begin() + 1, vi.end(), is_<int> ( 1 )));
    
    BOOST_CHECK ( ba::one_of_equal ( vc.begin() + 1, vc.begin() + 2,             'q' ));
    BOOST_CHECK ( ba::one_of       ( vc.begin() + 1, vc.begin() + 2, is_<char> ( 'q' )));

    BOOST_CHECK (!ba::one_of_equal ( vc, '!' ));
    BOOST_CHECK (!ba::one_of       ( vc, is_<char> ( '!' )));
    
    BOOST_CHECK (!ba::one_of_equal ( vc, 'n' ));
    BOOST_CHECK (!ba::one_of       ( vc, is_<char> ( 'n' )));

//  Empty range check
    BOOST_CHECK (!ba::one_of_equal ( vi.begin(), vi.begin(),   1 ));
    BOOST_CHECK (!ba::one_of_equal ( vc.begin(), vc.begin(), 'a' ));
    BOOST_CHECK (!ba::one_of       ( vi.begin(), vi.begin(), is_<int>  (   1 )));
    BOOST_CHECK (!ba::one_of       ( vc.begin(), vc.begin(), is_<char> ( 'a' )));
    
    BOOST_CHECK (!ba::one_of_equal ( li,                                  1 ));
    BOOST_CHECK (!ba::one_of       ( li,                       is_<int> ( 1 )));
    BOOST_CHECK (!ba::one_of_equal ( li.begin(),     li.end(),            1 ));
    BOOST_CHECK (!ba::one_of       ( li.begin(),     li.end(), is_<int> ( 1 )));
    
    std::list<int>::iterator l_iter = li.begin ();
    l_iter++; l_iter++; l_iter++;
    BOOST_CHECK (!ba::one_of_equal ( li.begin(), l_iter,            1 ));
    BOOST_CHECK (!ba::one_of       ( li.begin(), l_iter, is_<int> ( 1 )));
    BOOST_CHECK ( ba::one_of_equal ( li.begin(), l_iter,            2 ));
    BOOST_CHECK ( ba::one_of       ( li.begin(), l_iter, is_<int> ( 2 )));
    BOOST_CHECK (!ba::one_of_equal ( li.begin(), l_iter,            3 ));
    BOOST_CHECK (!ba::one_of       ( li.begin(), l_iter, is_<int> ( 3 )));

}
开发者ID:LancelotGHX,项目名称:Simula,代码行数:64,代码来源:one_of_test.cpp


示例11: test

void test()
{
    int *pi = 0;
    BOOST_CHECK(pi == NULLPTR);
}
开发者ID:fpelliccioni,项目名称:pstade,代码行数:5,代码来源:2006_03_25.cpp


示例12: TestBoolNotification

void TestBoolNotification(const i_property_write<bool> &,boost::optional<bool>,bool cnew)
  {
  BOOST_CHECK(cnew);
  TestBoolNotificationWorked = true;
  }
开发者ID:eldiener,项目名称:property,代码行数:5,代码来源:test_member_data_value.cpp


示例13: TestPointer

void TestPointer(p_member_data_value_class & tcl) 
  {
  
  /*
  
  Pointers can be assigned, incremented, decremented,
  and take part in simple arithmetic.
  
  */
  
  prop_member_data
    <
    int *,
    p_member_data_class,
    &p_member_data_class::p_pointer,
    notification_boost_function
    > 
  p_loc_pointer(pmd_gl_pointer,&p_gl_iarray[7]);
  
  prop_member_data
    <
    int *,
    p_member_data_class,
    &p_member_data_class::p_pointer_2
    > 
  p_loc_pointer2(pmd_gl_pointer,&p_gl_iarray[4]);
  
  BOOST_CHECK_EQUAL(*p_loc_pointer,7783);
  
  p_loc_pointer = &p_gl_iarray[6];
  
  BOOST_CHECK_EQUAL(*p_loc_pointer,230);
  BOOST_CHECK_EQUAL(p_loc_pointer - p_loc_pointer2,2);
  
  p_loc_pointer += 4;
  BOOST_CHECK_EQUAL(*p_loc_pointer,12);
  p_loc_pointer.fun = &TestPointerNotification;
  p_loc_pointer -= 2;
  BOOST_CHECK_EQUAL(*p_loc_pointer,22675);
  BOOST_CHECK(TestPointerNotificationWorked);
  
  p_gl_pointer_ntf = &gld_int;
  
  *p_gl_pointer_ntf = 489;
  BOOST_CHECK_EQUAL(*p_gl_pointer_ntf,489);
  
  p_member_data_value_class::p_st_pointer = &p_member_data_value_class::p_st_iarray[5];
  
  BOOST_CHECK_EQUAL(*p_member_data_value_class::p_st_pointer,53);
  ++p_member_data_value_class::p_st_pointer;
  BOOST_CHECK_EQUAL(*p_member_data_value_class::p_st_pointer,3456);
  BOOST_CHECK_EQUAL(*tcl.p_pointer,34);
  tcl.p_pointer -= 2;
  BOOST_CHECK_EQUAL(*tcl.p_pointer,13562);
  --tcl.p_pointer;
  BOOST_CHECK_EQUAL(*tcl.p_pointer,56);
  tcl.p_pointer += 11;
  BOOST_CHECK_EQUAL(*(tcl.p_pointer--),3452);
  BOOST_CHECK_EQUAL(*tcl.p_pointer,789);
  p_member_data_value_class::p_st_pointer -= 4;
  BOOST_CHECK_EQUAL(*(p_member_data_value_class::p_st_pointer++),5347);
  BOOST_CHECK_EQUAL(*p_member_data_value_class::p_st_pointer,369);
  
  }
开发者ID:eldiener,项目名称:property,代码行数:64,代码来源:test_member_data_value.cpp


示例14: TestInt

void TestInt(p_member_data_value_class & tcl) 
  {
  
  /*
  
  Integers can be tested with the full range of integer operations.
  
  */
  
  prop_member_data
    <
    int,
    p_member_data_class,
    &p_member_data_class::p_data_int,
    notification_boost_function
    > 
  p_loc_int(tcl.pmd_int,563);
  
  p_gl_int = 34662;
  
  BOOST_CHECK_EQUAL(p_gl_int,34662);
  
  p_member_data_value_class::p_st_int = 34;
  
  BOOST_CHECK_EQUAL(p_member_data_value_class::p_st_int,34);
  tcl.p_int = 44;
  tcl.p_int += 12;
  BOOST_CHECK_EQUAL(tcl.p_int,56);
  tcl.p_int -= 16;
  BOOST_CHECK_EQUAL(tcl.p_int,40);
  ++tcl.p_int;
  BOOST_CHECK_EQUAL(tcl.p_int,41);
  ++tcl.p_int;
  ++tcl.p_int;
  --tcl.p_int;
  BOOST_CHECK_EQUAL(tcl.p_int,42);
  tcl.p_int /= 3;
  BOOST_CHECK_EQUAL(tcl.p_int,14);
  tcl.p_int *= 5;
  BOOST_CHECK_EQUAL(tcl.p_int,70);
  
  int il1(p_loc_int++);
  BOOST_CHECK_EQUAL(il1,563);
  BOOST_CHECK_EQUAL(p_loc_int,564);
  p_loc_int >>= 2;
  BOOST_CHECK_EQUAL(p_loc_int,141);
  p_loc_int -= 81;
  p_loc_int <<= 3;
  BOOST_CHECK_EQUAL(p_loc_int,480);
  il1 = --p_loc_int;
  BOOST_CHECK_EQUAL(il1,479);
  p_loc_int -= 6;
  BOOST_CHECK_EQUAL(p_loc_int,473);
  p_loc_int |= 0x0da;
  BOOST_CHECK_EQUAL(p_loc_int,475);
  p_loc_int &= 0x076;
  BOOST_CHECK_EQUAL(p_loc_int,82);
  p_loc_int.fun = &TestIntegerNotification;
  p_loc_int = 23611;
  BOOST_CHECK(TestIntegerNotificationWorked);
  
  tcl.p_int ^= 57;
  
  }
开发者ID:eldiener,项目名称:property,代码行数:64,代码来源:test_member_data_value.cpp


示例15: CheckCompare

static void CheckCompare(const int64_t& num1, const int64_t& num2)
{
    const CBigNum bignum1(num1);
    const CBigNum bignum2(num2);
    const CScriptNum scriptnum1(num1);
    const CScriptNum scriptnum2(num2);

    BOOST_CHECK((bignum1 == bignum1) == (scriptnum1 == scriptnum1));
    BOOST_CHECK((bignum1 != bignum1) ==  (scriptnum1 != scriptnum1));
    BOOST_CHECK((bignum1 < bignum1) ==  (scriptnum1 < scriptnum1));
    BOOST_CHECK((bignum1 > bignum1) ==  (scriptnum1 > scriptnum1));
    BOOST_CHECK((bignum1 >= bignum1) ==  (scriptnum1 >= scriptnum1));
    BOOST_CHECK((bignum1 <= bignum1) ==  (scriptnum1 <= scriptnum1));

    BOOST_CHECK((bignum1 == bignum1) == (scriptnum1 == num1));
    BOOST_CHECK((bignum1 != bignum1) ==  (scriptnum1 != num1));
    BOOST_CHECK((bignum1 < bignum1) ==  (scriptnum1 < num1));
    BOOST_CHECK((bignum1 > bignum1) ==  (scriptnum1 > num1));
    BOOST_CHECK((bignum1 >= bignum1) ==  (scriptnum1 >= num1));
    BOOST_CHECK((bignum1 <= bignum1) ==  (scriptnum1 <= num1));

    BOOST_CHECK((bignum1 == bignum2) ==  (scriptnum1 == scriptnum2));
    BOOST_CHECK((bignum1 != bignum2) ==  (scriptnum1 != scriptnum2));
    BOOST_CHECK((bignum1 < bignum2) ==  (scriptnum1 < scriptnum2));
    BOOST_CHECK((bignum1 > bignum2) ==  (scriptnum1 > scriptnum2));
    BOOST_CHECK((bignum1 >= bignum2) ==  (scriptnum1 >= scriptnum2));
    BOOST_CHECK((bignum1 <= bignum2) ==  (scriptnum1 <= scriptnum2));

    BOOST_CHECK((bignum1 == bignum2) ==  (scriptnum1 == num2));
    BOOST_CHECK((bignum1 != bignum2) ==  (scriptnum1 != num2));
    BOOST_CHECK((bignum1 < bignum2) ==  (scriptnum1 < num2));
    BOOST_CHECK((bignum1 > bignum2) ==  (scriptnum1 > num2));
    BOOST_CHECK((bignum1 >= bignum2) ==  (scriptnum1 >= num2));
    BOOST_CHECK((bignum1 <= bignum2) ==  (scriptnum1 <= num2));
}
开发者ID:10by10pixel,项目名称:bitcoin,代码行数:35,代码来源:scriptnum_tests.cpp


示例16: int_char_set_test

void int_char_set_test()
{
	BOOST_CHECK_EQUAL((size<Set>::value), 2);
	BOOST_CHECK(!(empty<Set>::value));
	BOOST_CHECK((std::is_same<typename clear<Set>::type, set<>>::value));
	BOOST_CHECK((std::is_same<typename at<Set, int>::type, int>::value));
	BOOST_CHECK((std::is_same<typename at<Set, char>::type, char>::value));

	BOOST_CHECK((has_key<Set, char>::value));
	BOOST_CHECK(!(has_key<Set, long>::value));

	typedef typename order<Set, int>::type o1;
	typedef typename order<Set, char>::type o2;
	typedef typename order<Set, long>::type o3;
	BOOST_CHECK(!(std::is_same<o1, void_>::value));
	BOOST_CHECK(!(std::is_same<o2, void_>::value));
	BOOST_CHECK((std::is_same<o3, void_>::value));
	BOOST_CHECK(!(std::is_same<o1, o2>::value));

	typedef typename begin<Set>::type first;
	typedef typename end<Set>::type last;

	BOOST_CHECK_EQUAL((distance<first, last>::value), 2);

	BOOST_CHECK((contains<Set, int>::value));
	BOOST_CHECK((contains<Set, char>::value));
}
开发者ID:oakad,项目名称:ucpf,代码行数:27,代码来源:set.cpp


示例17: base_test

    static inline void base_test(Geometry1 const& geometry1,
                                 Geometry2 const& geometry2,
                                 MultiLineString const& mls_int1,
                                 MultiLineString const& mls_int2,
                                 std::string const& case_id,
                                 double tolerance,
                                 bool test_vector_and_deque = false)
    {
        static bool vector_deque_already_tested = false;

        typedef typename boost::range_value<MultiLineString>::type LineString;
        typedef std::vector<LineString> linestring_vector;
        typedef std::deque<LineString> linestring_deque;

        MultiLineString mls_output;

        linestring_vector ls_vector_output;
        linestring_deque ls_deque_output;

        bg::intersection(geometry1, geometry2, mls_output);

        BOOST_CHECK_MESSAGE( equals::apply(mls_int1, mls_output, tolerance)
                             || equals::apply(mls_int2, mls_output, tolerance),
                             "case id: " << case_id
                             << ", intersection L/L: " << bg::wkt(geometry1)
                             << " " << bg::wkt(geometry2)
                             << " -> Expected: " << bg::wkt(mls_int1)
                             << " or: " << bg::wkt(mls_int2)
                             << " computed: " << bg::wkt(mls_output) );

        set_operation_output("intersection", case_id,
                             geometry1, geometry2, mls_output);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << "Geometry #1: " << bg::wkt(geometry1) << std::endl;
        std::cout << "Geometry #2: " << bg::wkt(geometry2) << std::endl;
        std::cout << "intersection : " << bg::wkt(mls_output) << std::endl;
        std::cout << "expected intersection : " << bg::wkt(mls_int1)
                  << " or: " << bg::wkt(mls_int2) << std::endl;
        std::cout << std::endl;
        std::cout << "************************************" << std::endl;
        std::cout << std::endl;
        std::cout << std::endl;
#endif

        if ( !vector_deque_already_tested && test_vector_and_deque )
        {
            vector_deque_already_tested = true;
#ifdef BOOST_GEOMETRY_TEST_DEBUG
            std::cout << std::endl;
            std::cout << "Testing with vector and deque as output container..."
                      << std::endl;
#endif
            bg::intersection(geometry1, geometry2, ls_vector_output);
            bg::intersection(geometry1, geometry2, ls_deque_output);

            BOOST_CHECK(multilinestring_equals
                        <
                            false
                        >::apply(mls_int1, ls_vector_output, tolerance));

            BOOST_CHECK(multilinestring_equals
                        <
                            false
                        >::apply(mls_int1, ls_deque_output, tolerance));

#ifdef BOOST_GEOMETRY_TEST_DEBUG
            std::cout << "Done!" << std::endl << std::endl;
#endif
        }

        // check the intersection where the order of the two
        // geometries is reversed
        bg::clear(mls_output);
        bg::intersection(geometry2, geometry1, mls_output);

        BOOST_CHECK_MESSAGE( equals::apply(mls_int1, mls_output, tolerance)
                             || equals::apply(mls_int2, mls_output, tolerance),
                             "case id: " << case_id
                             << ", intersection L/L: " << bg::wkt(geometry1)
                             << " " << bg::wkt(geometry2)
                             << " -> Expected: " << bg::wkt(mls_int1)
                             << " or: " << bg::wkt(mls_int2)
                             << " computed: " << bg::wkt(mls_output) );

#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << "Geometry #1: " << bg::wkt(geometry2) << std::endl;
        std::cout << "Geometry #2: " << bg::wkt(geometry1) << std::endl;
        std::cout << "intersection : " << bg::wkt(mls_output) << std::endl;
        std::cout << "expected intersection : " << bg::wkt(mls_int1)
                  << " or: " << bg::wkt(mls_int2) << std::endl;
        std::cout << std::endl;
        std::cout << "************************************" << std::endl;
        std::cout << std::endl;
        std::cout << std::endl;
#endif
    }
开发者ID:Ding8222,项目名称:abelkhan,代码行数:96,代码来源:test_intersection_linear_linear.hpp


示例18: test_base

void test_base() {
	Range16 r(0, 5);

	BOOST_CHECK(r.length() == 6);
	BOOST_CHECK(r.begin() == 0);
	BOOST_CHECK(r.end() == 5);

	BOOST_CHECK(r.contains(0));
	BOOST_CHECK(r.contains(3));
	BOOST_CHECK(r.contains(5));
	BOOST_CHECK(!r.contains(6));
	BOOST_CHECK(!r.contains(100));

	BOOST_CHECK_THROW(r.begin(6), std::exception);
	BOOST_CHECK_NO_THROW(r.begin(5));
	BOOST_CHECK(r.length() == 1);
	BOOST_CHECK_NO_THROW(r.end(10));
	BOOST_CHECK(r.begin() == 5);
	BOOST_CHECK(r.end() == 10);
	BOOST_CHECK(r.length() == 6);

	Range16 r1(0, 5);
	Range16 r2(0, 2);
	BOOST_CHECK(r1.contains(r2));
	BOOST_CHECK(r1.contains(0, 0));
	BOOST_CHECK(r1.contains(Range16(5, 5)));
	BOOST_CHECK(r1.contains(5, 6));
	BOOST_CHECK(!r1.contains(6, 6));

	BOOST_CHECK(r1.containsFull(r2));
	BOOST_CHECK(r1.containsFull(0, 4));
	BOOST_CHECK(r1.containsFull(0, 5));
	BOOST_CHECK(!r1.containsFull(0, 6));
	BOOST_CHECK(r1.containsFull(5, 5));
	BOOST_CHECK(r1.containsFull(Range16(1, 5)));
	BOOST_CHECK(!r1.containsFull(Range16(6, 6)));
	BOOST_CHECK(!r1.containsFull(5, 10));

	Range16 r3(20, 30);
	Range16 r4( 3, 10);
	BOOST_CHECK(!r3.contains(r4));
	BOOST_CHECK(!r3.borders(r4));

	// test comparison operators
	BOOST_CHECK(r1 != r2);
	BOOST_CHECK(r2 != r1);
	BOOST_CHECK(r3 != r4);
//	BOOST_CHECK(r3 > r4);
//	BOOST_CHECK(r4 < r3);
}
开发者ID:alosarv,项目名称:hydranode,代码行数:50,代码来源:test-range.cpp


示例19: test_even_more

void test_even_more() {
	RangeList16 rl;
	rl.merge(0, 100);
	rl.erase(0, 50);
	BOOST_CHECK(rl.size() == 1);
	BOOST_CHECK(rl.front().begin() == 51);
	BOOST_CHECK(rl.front().end() == 100);
	rl.clear();
	rl.merge(0, 29);
	rl.merge(34, 50);
	rl.merge(53, 100);
	BOOST_CHECK(rl.getContains(30, 33) == rl.end());
	BOOST_CHECK(rl.getContains(30, 60)->begin() == 34);
	BOOST_CHECK(rl.getContains(30, 60)->end() == 50);
	BOOST_CHECK(rl.getContains(30, 100) != rl.end());
	rl.erase(rl.getContains(30, 60));
	BOOST_CHECK(rl.getContains(30, 60)->begin() == 53);
	BOOST_CHECK(rl.getContains(30, 60)->end() == 100);
	rl.erase(rl.getContains(55, 55));
	BOOST_CHECK(rl.size() == 1);
	BOOST_CHECK(rl.begin()->begin() == 0);
	BOOST_CHECK(rl.begin()->end() == 29);

	RangeList32 rl2;
	rl2.merge(0ul, 1044496385ul);
	rl2.merge(1044496387ul, 4294967290ul);
	BOOST_CHECK(rl2.contains(Range32(123567ul)));
	BOOST_CHECK(rl2.contains(Range32(1044496385ul)));
	BOOST_CHECK(rl2.contains(Range32(123123245ul)));
	BOOST_CHECK(rl2.contains(Range32(1044496384ul)));
	BOOST_CHECK(rl2.contains(Range32(1044496387ul)));
	BOOST_CHECK(rl2.contains(Range32(2669731838ul)));
	BOOST_CHECK(rl2.contains(Range32(2669731840ul)));
	BOOST_CHECK(rl2.contains(Range32(2669731700ul)));
	BOOST_CHECK(!rl2.contains(Range32(1044496386ul)));
}
开发者ID:alosarv,项目名称:hydranode,代码行数:36,代码来源:test-range.cpp


示例20: verifyWellState

void verifyWellState(const std::string& rst_filename,
                     Opm::EclipseGridConstPtr ecl_grid,
                     Opm::ScheduleConstPtr schedule) {

  well_info_type * well_info = well_info_alloc(ecl_grid->c_ptr());
  well_info_load_rstfile(well_info, rst_filename.c_str(), false);

  //Verify numwells
  int numwells = well_info_get_num_wells(well_info);
  BOOST_CHECK(numwells == (int)schedule->numWells());

  std::vector<Opm::WellConstPtr> wells = schedule->getWells();

  for (int i = 0; i < numwells; ++i) {

    //Verify wellnames
    const char * wellname = well_info_iget_well_name(well_info, i);
    Opm::WellConstPtr well = wells.at(i);
    BOOST_CHECK(wellname == well->name());

    // Verify well-head position data
    well_ts_type * well_ts = well_info_get_ts(well_info , wellname);
    well_state_type * well_state = well_ts_iget_state(well_ts, 0);
    const well_conn_type * well_head = well_state_get_wellhead(well_state, ECL_GRID_GLOBAL_GRID);
    BOOST_CHECK(well_conn_get_i(well_head) == well->getHeadI());
    BOOST_CHECK(well_conn_get_j(well_head) == well->getHeadJ());

    for (int j = 0; j < well_ts_get_size(well_ts); ++j) {
      well_state = well_ts_iget_state(well_ts, j);

      //Verify welltype
      int ert_well_type = well_state_get_type(well_state);
      WellType welltype = well->isProducer(j) ? PRODUCER : INJECTOR;
      Opm::WellInjector::TypeEnum injectortype = well->getInjectionProperties(j).injectorType;
      int ecl_converted_welltype = Opm::EclipseWriter::eclipseWellTypeMask(welltype, injectortype);
      int ert_converted_welltype = well_state_translate_ecl_type_int(ecl_converted_welltype);
      BOOST_CHECK(ert_well_type == ert_converted_welltype);

      //Verify wellstatus
      int ert_well_status = well_state_is_open(well_state) ? 1 : 0;

      Opm::WellCommon::StatusEnum status = well->getStatus(j);
      int wellstatus = Opm::EclipseWriter::eclipseWellStatusMask(status);

      BOOST_CHECK(ert_well_status == wellstatus);

      //Verify number of completion connections
      const well_conn_collection_type * well_connections = well_state_get_global_connections( well_state );
      size_t num_wellconnections = well_conn_collection_get_size(well_connections);

      int report_nr = well_state_get_report_nr(well_state);
      Opm::CompletionSetConstPtr completions_set = well->getCompletions((size_t)report_nr);

      BOOST_CHECK(num_wellconnections == completions_set->size());

      //Verify coordinates for each completion connection
      for (size_t k = 0; k < num_wellconnections; ++k) {
          const well_conn_type * well_connection = well_conn_collection_iget_const(well_connections , k);

          Opm::CompletionConstPtr completion = completions_set->get(k);

          BOOST_CHECK(well_conn_get_i(well_connection) == completion->getI());
          BOOST_CHECK(well_conn_get_j(well_connection) == completion->getJ());
          BOOST_CHECK(well_conn_get_k(well_connection) == completion->getK());
      }
    }
  }

  well_info_free(well_info);
}
开发者ID:higgscc,项目名称:opm-core,代码行数:70,代码来源:test_writenumwells.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ BOOST_CHECK_CLOSE函数代码示例发布时间:2022-05-30
下一篇:
C++ BOOST_AUTO_TPL函数代码示例发布时间: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