Example #1
0
int
main()
{
  init_random_ness ();
  test_area ();
  test_intersect ();
  test_equal ();
  test_overlap_funcs ();
  test_basic_fitting ();

  test_regions_okay ();
  test_region_fitting ();

  test_clamping_to_region ();
  test_clipping_to_region ();
  test_shoving_into_region ();

  /* And now the functions dealing with edges more than boxes */
  test_find_onscreen_edges ();
  test_find_nonintersected_monitor_edges ();

  /* And now the misfit functions that don't quite fit in anywhere else... */
  test_gravity_resize ();
  test_find_closest_point_to_line ();

  printf ("All tests passed.\n");
  return 0;
}
Example #2
0
void test_geometry(std::string const& wkt,
            typename bg::default_area_result<Geometry>::type expected_area)
{
    Geometry geometry;
    bg::read_wkt(wkt, geometry);
    test_area(geometry, expected_area);
}
Example #3
0
/* program entry */
int
main (int argc, char **argv)
{
  int i, j;

  /* test_cubrid_area */
  {
    AREA_CREATE_INFO cubrid_infos[] = {
      {"Schema templates", sizeof (SM_TEMPLATE), 4}
      ,
      {"Domains", sizeof (TP_DOMAIN), 1024}
      ,
      {"Value containers", sizeof (DB_VALUE), 1024}
      ,
      {"Object templates", sizeof (OBJ_TEMPLATE), 32}
      ,
      {"Assignment templates", sizeof (OBJ_TEMPASSIGN), 64}
      ,
      {"Set references", sizeof (DB_COLLECTION), 1024}
      ,
      {"Set objects", sizeof (COL), 1024}
      ,
      {"Object list links", sizeof (DB_OBJLIST), 4096}
    };

    printf ("============================================================\n");
    printf ("Test simple get/free entry:\n");
    for (j = 0; j < (int) DIM (cubrid_infos); j++)
      {
	for (i = 1; i <= 64; i *= 2)
	  {
	    if (test_area (&cubrid_infos[j], i, test_area_proc) != NO_ERROR)
	      {
		goto fail;
	      }
	  }
      }

    printf ("============================================================\n");
    printf ("Test get/free entry with cache(32):\n");
    for (j = 0; j < (int) DIM (cubrid_infos); j++)
      {
	for (i = 1; i <= 64; i *= 2)
	  {
	    if (test_area (&cubrid_infos[j], i, test_area_proc_1) != NO_ERROR)
	      {
		goto fail;
	      }
	  }
      }

    printf ("============================================================\n");
    printf ("Test get/free entry with cache(500), random access:\n");
    for (j = 0; j < (int) DIM (cubrid_infos); j++)
      {
	for (i = 1; i <= 64; i *= 2)
	  {
	    if (test_area (&cubrid_infos[j], i, test_area_proc_2) != NO_ERROR)
	      {
		goto fail;
	      }
	  }
      }
  }

  /* test different alloc count */
  {
    AREA_CREATE_INFO diff_count_infos[] = {
      {"size 1", 50, 32}
      ,
      {"size 2", 50, 32 * 2}
      ,
      {"size 4", 50, 32 * 4}
      ,
      {"size 8", 50, 32 * 8}
      ,
      {"size 16", 50, 32 * 16}
      ,
      {"size 32", 50, 32 * 32}
      ,
      {"size 64", 50, 32 * 64}
      ,
      {"size 128", 50, 32 * 128}
    };

    printf ("============================================================\n");
    printf ("Test simple get/free entry with different alloc count:\n");
    for (i = 16; i <= 64; i *= 2)
      {
	for (j = 0; j < (int) DIM (diff_count_infos); j++)
	  {
	    if (test_area (&diff_count_infos[j], i, test_area_proc) != NO_ERROR)
	      {
		goto fail;
	      }
	  }
      }
  }


  /* all ok */
  return 0;

fail:
  printf ("Unit tests failed!\n");
  return ER_FAILED;
}