/// \brief TODOCUMENT
			void operator()() {
				constexpr std_classn_rate_stat to_test = get<0>( get<I>( properties_of_classn_rate_stat::numerator_and_denominator_of_stat ) );
				BOOST_CHECK_NO_THROW( classn_rate_stat<to_test>() );
				classn_rate_stat<to_test> stat;
				BOOST_CHECK_NO_THROW( stat.get_name() );
				BOOST_CHECK_GT( stat.get_name().length(), 0 );
			}
static void
test_greater_than()
{
	{
		floating_point_emulation::tfloat<T, S> f(43), g(42);
		BOOST_CHECK_GT(f, g);
	}



	{
		floating_point_emulation::tfloat<T, S> f(43), g(42);
		BOOST_CHECK_EQUAL(f > g, true);
		BOOST_CHECK_EQUAL(g > f, false);
	}

	{
		floating_point_emulation::tfloat<T, S> f(43), g(42.);
		BOOST_CHECK_EQUAL(f > g, true);
		BOOST_CHECK_EQUAL(g > f, false);
	}

	{
		floating_point_emulation::tfloat<T, S> f(43.), g(42);
		BOOST_CHECK_EQUAL(f > g, true);
		BOOST_CHECK_EQUAL(g > f, false);
	}

	{
		floating_point_emulation::tfloat<T, S> f(43.), g(42.);
		BOOST_CHECK_EQUAL(f > g, true);
		BOOST_CHECK_EQUAL(g > f, false);
	}



	{
		floating_point_emulation::tfloat<T, S> f(42), g(42);
		BOOST_CHECK_EQUAL(f > g, false);
		BOOST_CHECK_EQUAL(g > f, false);
	}

	{
		floating_point_emulation::tfloat<T, S> f(42), g(42.);
		BOOST_CHECK_EQUAL(f > g, false);
		BOOST_CHECK_EQUAL(g > f, false);
	}

	{
		floating_point_emulation::tfloat<T, S> f(42.), g(42);
		BOOST_CHECK_EQUAL(f > g, false);
		BOOST_CHECK_EQUAL(g > f, false);
	}

	{
		floating_point_emulation::tfloat<T, S> f(42.), g(42.);
		BOOST_CHECK_EQUAL(f > g, false);
		BOOST_CHECK_EQUAL(g > f, false);
	}
}
示例#3
0
BOOST_FIXTURE_TEST_CASE_TEMPLATE( operator_less_partial_test, F, Fixtures, F )
{
  // for (auto p : F::Plist)
  for (auto it = F::Plist.begin(); it != F::Plist.end(); ++it) {
    auto p = *it;
    for (unsigned k = 0; k<16; k++)
      BOOST_CHECK_EQUAL( p.less_partial(p, k), 0 );
  }
  // for (auto p : F::Plist)
  //   for (auto q : F::Plist)
  for (auto itp = F::Plist.begin(); itp != F::Plist.end(); ++itp) {
    auto p = *itp;
    for (auto itq = F::Plist.begin(); itq != F::Plist.end(); ++itq) {
      auto q = *itq;
      BOOST_CHECK_EQUAL( p.less_partial(q, 0), 0 );
    }
  }

  BOOST_CHECK_EQUAL( F::zero.less_partial(F::P01, 1), 0 );
  BOOST_CHECK_EQUAL( F::P01.less_partial(F::zero, 1), 0 );
  BOOST_CHECK_LT( F::zero.less_partial(F::P01, 2), 0 );
  BOOST_CHECK_GT( F::P01.less_partial(F::zero, 2), 0 );

  BOOST_CHECK_LT( F::zero.less_partial(F::P10, 1), 0 );
  BOOST_CHECK_LT( F::zero.less_partial(F::P10, 2), 0 );
  BOOST_CHECK_GT( F::P10.less_partial(F::zero, 1), 0 );
  BOOST_CHECK_GT( F::P10.less_partial(F::zero, 2), 0 );

  BOOST_CHECK_EQUAL( F::PPa.less_partial(F::PPb, 1), 0 );
  BOOST_CHECK_EQUAL( F::PPa.less_partial(F::PPb, 2), 0 );
  BOOST_CHECK_EQUAL( F::PPa.less_partial(F::PPb, 3), 0 );
  BOOST_CHECK_LT( F::PPa.less_partial(F::PPb, 4), 0 );
  BOOST_CHECK_LT( F::PPa.less_partial(F::PPb, 5), 0 );
  BOOST_CHECK_GT( F::PPb.less_partial(F::PPa, 4), 0 );
  BOOST_CHECK_GT( F::PPb.less_partial(F::PPa, 5), 0 );
}
示例#4
0
BOOST_FIXTURE_TEST_CASE( advertising_scheduled, advertising )
{
    BOOST_CHECK_GT( scheduling().size(), 0 );
}
BOOST_AUTO_TEST_CASE_TEMPLATE
( test_neighbor_upper_bound, Tp, quad_sets )
{
  typedef quadrance<typename Tp::container_type, int, quad_diff> metric_type;
  typedef typename metric_type::distance_type distance_type;
  typedef neighbor_iterator<typename Tp::container_type, metric_type>
    neighbor_iterator_type;
  // Prove that you can find lower bound with N nodes, down to 1 node
  {
    Tp fix(100, randomize(-20, 20));
    metric_type metric;
    quad target;
    while (!fix.container.empty())
      {
        randomize(-22, 22)(target, 0, 0);
        // Find min and max dist first
        distance_type min_dist;
        distance_type max_dist;
        typename Tp::container_type::iterator it = fix.container.begin();
        min_dist = max_dist
          = metric.distance_to_key(fix.container.rank()(), *it, target);
        ++it;
        for (; it != fix.container.end(); ++it)
          {
            distance_type tmp
              = metric.distance_to_key(fix.container.rank()(), *it, target);
            if (tmp < min_dist) min_dist = tmp;
            if (tmp > max_dist) max_dist = tmp;
          }
        distance_type avg_dist = (min_dist + max_dist) / 2;
        // use this knowledge to test the upper bound
        neighbor_iterator_type i
          = neighbor_upper_bound(fix.container, metric, target, min_dist);
        BOOST_CHECK(i != neighbor_begin(fix.container, metric, target));
        if (i != neighbor_end(fix.container, metric, target))
          { BOOST_CHECK_LT(min_dist, distance(i)); }
        BOOST_CHECK_EQUAL(min_dist, distance(--i));
        i = neighbor_upper_bound(fix.container, metric, target, max_dist);
        BOOST_CHECK(i == neighbor_end(fix.container, metric, target));
        i = neighbor_upper_bound(fix.container, metric, target, avg_dist);
        if (i != neighbor_end(fix.container, metric, target))
          { BOOST_CHECK_GT(distance(i), avg_dist); }
        if (i == neighbor_end(fix.container, metric, target))
          { BOOST_CHECK_LE(distance(--i), avg_dist); }
        fix.container.erase(i);
      }
  }
  // Prove that you can find the upper bound when node and target are same
  {
    Tp fix(100, same());
    metric_type metric;
    quad target;
    same()(target, 0, 100);
    // All points and targets are the same.
    while (!fix.container.empty())
      {
        neighbor_iterator_type i
          = neighbor_upper_bound(fix.container, metric, target, 1);
        BOOST_CHECK(i == neighbor_end(fix.container, metric, target));
        i = neighbor_upper_bound(fix.container, metric, target, 0);
        BOOST_CHECK(i == neighbor_end(fix.container, metric, target));
        fix.container.erase(--i);
      }
  }
  // Prove that you can find the upper bound in an unbalanced tree
  {
    Tp fix(100, increase());
    metric_type metric;
    quad target;
    while (!fix.container.empty())
      {
        randomize(0, 100)(target, 0, 0);
        // Find min and max dist first
        distance_type min_dist;
        distance_type max_dist;
        typename Tp::container_type::iterator it = fix.container.begin();
        min_dist = max_dist
          = metric.distance_to_key(fix.container.rank()(), *it, target);
        ++it;
        for (; it != fix.container.end(); ++it)
          {
            distance_type tmp
              = metric.distance_to_key(fix.container.rank()(), *it, target);
            if (tmp < min_dist) min_dist = tmp;
            if (tmp > max_dist) max_dist = tmp;
          }
        distance_type avg_dist = (min_dist + max_dist) / 2;
        // Use this knowledge to test the upper bound
        neighbor_iterator_type i
          = neighbor_upper_bound(fix.container, metric, target, min_dist);
        BOOST_CHECK(i != neighbor_begin(fix.container, metric, target));
        if (i != neighbor_end(fix.container, metric, target))
          { BOOST_CHECK_LT(min_dist, distance(i)); }
        BOOST_CHECK_EQUAL(min_dist, distance(--i));
        i = neighbor_upper_bound(fix.container, metric, target, max_dist);
        BOOST_CHECK(i == neighbor_end(fix.container, metric, target));
        i = neighbor_upper_bound(fix.container, metric, target, avg_dist);
        if (i != neighbor_end(fix.container, metric, target))
          { BOOST_CHECK_GT(distance(i), avg_dist); }
        if (i == neighbor_end(fix.container, metric, target))
          { BOOST_CHECK_LE(distance(--i), avg_dist); }
        fix.container.erase(i);
      }
  }
  // Prove that you can find the upper bound in an unbalanced tree
  {
    Tp fix(100, decrease());
    metric_type metric;
    quad target;
    while (!fix.container.empty())
      {
        randomize(0, 100)(target, 0, 0);
        // Find min and max dist first
        distance_type min_dist;
        distance_type max_dist;
        typename Tp::container_type::iterator it = fix.container.begin();
        min_dist = max_dist
          = metric.distance_to_key(fix.container.rank()(), *it, target);
        ++it;
        for (; it != fix.container.end(); ++it)
          {
            distance_type tmp
              = metric.distance_to_key(fix.container.rank()(), *it, target);
            if (tmp < min_dist) min_dist = tmp;
            if (tmp > max_dist) max_dist = tmp;
          }
        distance_type avg_dist = (min_dist + max_dist) / 2;
        // Use this knowledge to test the upper bound
        neighbor_iterator_type i
          = neighbor_upper_bound(fix.container, metric, target, min_dist);
        BOOST_CHECK(i != neighbor_begin(fix.container, metric, target));
        if (i != neighbor_end(fix.container, metric, target))
          { BOOST_CHECK_LT(min_dist, distance(i)); }
        BOOST_CHECK_EQUAL(min_dist, distance(--i));
        i = neighbor_upper_bound(fix.container, metric, target, max_dist);
        BOOST_CHECK(i == neighbor_end(fix.container, metric, target));
        i = neighbor_upper_bound(fix.container, metric, target, avg_dist);
        if (i != neighbor_end(fix.container, metric, target))
          { BOOST_CHECK_GT(distance(i), avg_dist); }
        if (i == neighbor_end(fix.container, metric, target))
          { BOOST_CHECK_LE(distance(--i), avg_dist); }
        fix.container.erase(i);
      }
  }
}