Ejemplo n.º 1
0
    static inline
    void apply(Geometry1 const& geometry1,
               Geometry2 const& geometry2,
               DistanceType const& expected_distance,
               ComparableDistanceType const& expected_comparable_distance,
               Strategy const& strategy,
               bool is_finite = true)
    {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
        typedef pretty_print_geometry<Geometry1> PPG1;
        typedef pretty_print_geometry<Geometry2> PPG2;
        PPG1::apply(geometry1, std::cout);
        std::cout << " - ";
        PPG2::apply(geometry2, std::cout);
        std::cout << std::endl;
#endif

        base_test("", geometry1, geometry2,
                  expected_distance, expected_comparable_distance,
                  strategy, is_finite);

        base_test("[reversed args]", geometry2, geometry1,
                  expected_distance, expected_comparable_distance,
                  strategy, is_finite);

#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << std::endl;
#endif
    }
Ejemplo n.º 2
0
int main() {
    double arr[] = {0.156, 0.5, 0.344};
    vector<double> prob_vec (arr, arr + sizeof(arr) / sizeof(arr[0]) );
    base_test("((((Aa,aa),(Aa,Aa)),((aa,aa),(aa,AA))),Aa);", prob_vec);

    double arr2[] = {0, 0.875, 0.125};
    vector<double> prob_vec2 (arr2, arr2 + sizeof(arr2) / sizeof(arr2[0]) );
    base_test("(aa,((Aa,AA),AA));", prob_vec2);

    string test_str = make_long_test_string(15) + ";";
    base_test(test_str, vector<double>());

    return 0;
}
Ejemplo n.º 3
0
main()

{

  /* variables and pointers to test RGMII interface */
  int i;
  volatile unsigned long rgmiistatus;
  volatile unsigned long rgmiibuf[256];
  volatile unsigned long* rgmiistatusp = (unsigned long*) 0x80001000;
  volatile unsigned long* rgmiiop = (unsigned long*) 0x80001400;
  volatile unsigned long* rgmiiip = (unsigned long*) 0x80001800;

  report_start();
  
  base_test();
      
  greth_test(0x800c0000);

  /* Read RGMII status and buffers */
  rgmiistatus = *rgmiistatusp;

  for (i = 0; i < 16; i++) {
     rgmiibuf[i] = *(rgmiiop + i);
  }

  for (i = 0; i < 16; i++) {
     rgmiibuf[i] = *(rgmiiip + i);
  }

  report_end();
}
Ejemplo n.º 4
0
int main(void) {
  uint32_t n;

  init_rationals();
  init_poly_table(&poly_table, 100, 20);
  build_poly_table(&poly_table, 100, 1000);

  printf("==== ALL POLYS ====\n");
  print_poly_table(&poly_table);
  printf("====\n");

  base_test();
  random_test(1000, 40);

  n = 1000;
  while (n > 0) {
    random_test(4000, 200);
    n --;
  }

  n = 1000;
  while (n > 0) {
    random_test(4000, 100);
    n --;
  }

  delete_poly_table(&poly_table);
  cleanup_rationals();

  return 0;
}
Ejemplo n.º 5
0
main()

{
  report_start();


  base_test();
//  svgactrl_test(0x80000600, 1, 0, 0x40200000, -1, 0, 0);
//  greth_test(0x80000e00);

/*
  spw_test(0x80100A00);
  spw_test(0x80100B00);
  spw_test(0x80100C00);
*/

//  grusbhc_test(0x80000d00, 0xfffa0000, 0, 0);
  /* Delay end of testing if GRUSB_DCL (with real timing) is to be tested.
     The core needs about 4 ms of simulation time to get into a running
           state. After that the amount of simulation time needed depends on how
     much data that is transfered. */
/*    for (i = 0; i < 140000; i++) */
/*      ; */

  report_end();
}
Ejemplo n.º 6
0
main()

{
	report_start();

	base_test();
        greth_test(0x80000b00);
        greth_test(0x80000c00);
        report_end();
}
    static inline void apply(Geometry1 const& geometry1,
                             Geometry2 const& geometry2,
                             MultiLineString const& mls_int1,
                             MultiLineString const& mls_int2,
                             std::string const& case_id,
                             double tolerance
                                 = std::numeric_limits<double>::epsilon())
    {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << "test case: " << case_id << std::endl;
        std::stringstream sstr;
        sstr << "svgs/" << case_id << ".svg";
#ifdef TEST_WITH_SVG
        to_svg(geometry1, geometry2, sstr.str());
#endif
#endif

        Geometry1 rg1(geometry1);
        bg::reverse<Geometry1>(rg1);

        Geometry2 rg2(geometry2);
        bg::reverse<Geometry2>(rg2);

        typedef typename bg::tag_cast
            <
                Geometry1, bg::linear_tag
            >::type tag1_type;

        typedef typename bg::tag_cast
            <
                Geometry2, bg::linear_tag
            >::type tag2_type;

        bool const are_linear
            = boost::is_same<tag1_type, bg::linear_tag>::value
            && boost::is_same<tag2_type, bg::linear_tag>::value;

        test_get_turns_ll_invariance<are_linear>::apply(geometry1, geometry2);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << std::endl
                  << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
                  << std::endl << std::endl;
#endif
        test_get_turns_ll_invariance<are_linear>::apply(rg1, geometry2);

        base_test(geometry1, geometry2, mls_int1, mls_int2, case_id, tolerance);
        //        base_test(rg1, rg2, mls_int1, mls_int2);
        base_test_all(geometry1, geometry2);

#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << std::endl;
        std::cout << std::endl;
#endif
    }
Ejemplo n.º 8
0
int main(int argc, const char*argv[])
{
	if (argc != 2) {
		fprintf(stderr, "USAGE: %s base|bench\n", argv[0]);
		return -1;
	}
	if (0 == strcmp(argv[1],"base")) {
		return base_test();
	} 
	return bench_test();
}
    static inline void apply(Geometry1 const& geometry1,
                             Geometry2 const& geometry2,
                             MultiLineString const& mls_diff,
                             std::string const& case_id,
                             double tolerance
                             = std::numeric_limits<double>::epsilon())
    {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << "test case: " << case_id << std::endl;
        std::stringstream sstr;
        sstr << "svgs/" << case_id << ".svg";
#ifdef TEST_WITH_SVG
        to_svg(geometry1, geometry2, sstr.str());
#endif
#endif

        Geometry1 rg1(geometry1);
        bg::reverse<Geometry1>(rg1);

        Geometry2 rg2(geometry2);
        bg::reverse<Geometry2>(rg2);

        test_get_turns_ll_invariance<>::apply(geometry1, geometry2);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << std::endl
                  << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
                  << std::endl << std::endl;
#endif
        test_get_turns_ll_invariance<>::apply(rg1, geometry2);

        base_test(geometry1, geometry2, mls_diff, case_id, tolerance);
        base_test(geometry1, rg2, mls_diff, case_id, tolerance, false);
        base_test(rg1, geometry2, mls_diff, case_id, tolerance, false, true);
        base_test(rg1, rg2, mls_diff, case_id, tolerance, false, true);

#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << std::endl;
        std::cout << std::endl;
#endif
    }
Ejemplo n.º 10
0
main()

{
	report_start();
        
//	svgactrl_test(0x80000600, 1, 0, 0x40200000, -1, 0, 0);

        base_test();

	gpio_test(0x80000900);
	gpio_test(0x80000a00); 

        report_end();
}
Ejemplo n.º 11
0
main()

{
	report_start();

	base_test();

	greth_test(0x80000a00);

	i2cmst_test(0x80000800);

	spictrl_test(0x80000900, 2);

	report_end();
}
Ejemplo n.º 12
0
main()

{
	report_start();

	base_test();
/*
	ramfill();
	leon3_test(1, 0x80000200, 0);
	irqtest(0x80000200);
	apbuart_test(0x80000100);
	gptimer_test(0x80000300);
        gpio_fifo_test(0x80000b00);

*/

	report_end();
}
    static inline void apply(Geometry1 const& geometry1,
                             Geometry2 const& geometry2,
                             MultiLineString const& mls_int1,
                             MultiLineString const& mls_int2,
                             std::string const& case_id)
    {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << "test case: " << case_id << std::endl;
        std::stringstream sstr;
        sstr << "svgs/" << case_id << ".svg";
#ifdef TEST_WITH_SVG
        to_svg(geometry1, geometry2, sstr.str());
#endif
#endif

        Geometry1 rg1(geometry1);
        bg::reverse<Geometry1>(rg1);

        Geometry2 rg2(geometry2);
        bg::reverse<Geometry2>(rg2);

        test_get_turns_ll_invariance<>::apply(geometry1, geometry2);
#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << std::endl
                  << "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
                  << std::endl << std::endl;
#endif
        test_get_turns_ll_invariance<>::apply(rg1, geometry2);


        base_test(geometry1, geometry2, mls_int1, mls_int2, case_id);
        //        base_test(rg1, rg2, mls_int1, mls_int2);
        base_test_all(geometry1, geometry2);

#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << std::endl;
        std::cout << std::endl;
#endif
    }
Ejemplo n.º 14
0
    static inline void apply(Geometry const& geometry, bool expected_result)
    {
        base_test(geometry, expected_result);

        if ( is_convertible_to_closed<Geometry>::apply(geometry) )
        {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
            std::cout << "...checking closed geometry..."
                      << std::endl;
#endif
            ClosedGeometry closed_geometry;
            bg::convert(geometry, closed_geometry);
            base_test(closed_geometry, expected_result);
        }
        if ( is_convertible_to_cw<Geometry>::apply(geometry) )
        {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
            std::cout << "...checking cw open geometry..."
                      << std::endl;
#endif            
            CWGeometry cw_geometry;
            bg::convert(geometry, cw_geometry);
            base_test(cw_geometry, expected_result);
            if ( is_convertible_to_closed<CWGeometry>::apply(cw_geometry) )
            {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
                std::cout << "...checking cw closed geometry..."
                          << std::endl;
#endif            
                CWClosedGeometry cw_closed_geometry;
                bg::convert(cw_geometry, cw_closed_geometry);
                base_test(cw_closed_geometry, expected_result);
            }
        }

        if ( is_convertible_to_polygon<Geometry>::value )
        {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
            std::cout << "...checking geometry converted to polygon..."
                      << std::endl;
#endif            
            typename is_convertible_to_polygon<Geometry>::type polygon;
            bg::convert(geometry, polygon);
            base_test(polygon, expected_result);
        }

        if ( is_convertible_to_multipolygon<Geometry>::value )
        {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
            std::cout << "...checking geometry converted to multi-polygon..."
                      << std::endl;
#endif            
            typename is_convertible_to_multipolygon
                <
                    Geometry
                >::type multipolygon;

            bg::convert(geometry, multipolygon);
            base_test(multipolygon, expected_result);
        }

#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << std::endl << std::endl << std::endl;
#endif
    }
Ejemplo n.º 15
0
    static inline void apply(std::string const& case_id,
                             Geometry const& geometry,
                             bool expected_result)
    {
        std::stringstream sstr;
        sstr << case_id << "-original";
        base_test(sstr.str(), geometry, expected_result);

        if ( is_convertible_to_closed<Geometry>::apply(geometry) )
        {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
            std::cout << "...checking closed geometry..."
                      << std::endl;
#endif
            ClosedGeometry closed_geometry;
            bg::convert(geometry, closed_geometry);
            sstr.str("");
            sstr << case_id << "-2closed";
            base_test(sstr.str(), closed_geometry, expected_result);
        }
        if ( is_convertible_to_cw<Geometry>::apply(geometry) )
        {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
            std::cout << "...checking cw open geometry..."
                      << std::endl;
#endif            
            CWGeometry cw_geometry;
            bg::convert(geometry, cw_geometry);
            sstr.str("");
            sstr << case_id << "-2CW";
            base_test(sstr.str(), cw_geometry, expected_result);
            if ( is_convertible_to_closed<CWGeometry>::apply(cw_geometry) )
            {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
                std::cout << "...checking cw closed geometry..."
                          << std::endl;
#endif            
                CWClosedGeometry cw_closed_geometry;
                bg::convert(cw_geometry, cw_closed_geometry);
                sstr.str("");
                sstr << case_id << "-2CWclosed";
                base_test(sstr.str(), cw_closed_geometry, expected_result);
            }
        }

        if ( BOOST_GEOMETRY_CONDITION(is_convertible_to_polygon<Geometry>::value) )
        {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
            std::cout << "...checking geometry converted to polygon..."
                      << std::endl;
#endif            
            typename is_convertible_to_polygon<Geometry>::type polygon;
            bg::convert(geometry, polygon);
            sstr.str("");
            sstr << case_id << "-2Polygon";
            base_test(sstr.str(), polygon, expected_result);
        }

        if ( BOOST_GEOMETRY_CONDITION(is_convertible_to_multipolygon<Geometry>::value) )
        {
#ifdef BOOST_GEOMETRY_TEST_DEBUG
            std::cout << "...checking geometry converted to multi-polygon..."
                      << std::endl;
#endif            
            typename is_convertible_to_multipolygon
                <
                    Geometry
                >::type multipolygon;

            bg::convert(geometry, multipolygon);
            sstr.str("");
            sstr << case_id << "-2MultiPolygon";
            base_test(sstr.str(), multipolygon, expected_result);
        }

#ifdef BOOST_GEOMETRY_TEST_DEBUG
        std::cout << std::endl << std::endl << std::endl;
#endif
    }