Esempio n. 1
0
static int
run_test (int /*unused*/, char* /*unused*/ [])
{
    test_simple_throw ();

    // constructors
    test_size_ctor ();
    test_npos_ctor ();

    test_max_size_ctor1 ();
    test_max_size_ctor2 ();

    test_len_ctor ();

    // member functions
    test_resize ();
    test_reserve ();
    test_at ();
    test_append ();
    test_assign ();

    test_insert1 ();
    test_insert2 ();

    test_erase ();

    test_replace1 ();
    test_replace2 ();
    test_replace3 ();

    test_copy ();
    test_substr ();

    return 0;
}
int main(void)
{
	board_init();

	if (test_erase() == STATUS_OK) {
		/* Toggle LED to indicate success */
		gpio_toggle_pin(LED_PIN_0);
	}

	if (test_write() == STATUS_OK) {
		/* Toggle LED to indicate success */
		gpio_toggle_pin(LED_PIN_1);
	}

	if (test_atomic_write() == STATUS_OK) {
		/* Toggle LED to indicate success */
		gpio_toggle_pin(LED_PIN_2);
	}

	if (test_split_write() == STATUS_OK) {
		/* Toggle LED to indicate success */
		gpio_toggle_pin(LED_PIN_3);
	}

	if (test_erase_bytes() == STATUS_OK) {
		/* Toggle LED to indicate success */
		gpio_toggle_pin(LED_PIN_4);
	}

	/* Toggle LED to indicate that we are done */
	gpio_toggle_pin(LED_PIN_7);

	while (true) {}

}
Esempio n. 3
0
int main(void)
{
	board_init();

	// Initialize graphics library
	gfx_mono_init();

	// Enable backlight
	ioport_set_pin_high(LCD_BACKLIGHT_ENABLE_PIN);

	gfx_mono_draw_string("Tests successful: \r\n1   2   3   4   5",
			0, 0, &sysfont);

	if (test_erase() == STATUS_OK) {
		gfx_mono_draw_string("OK",
				0, 2 * SYSFONT_HEIGHT + 1, &sysfont);
	} else {
		gfx_mono_draw_string("ERR",
				0, 2 * SYSFONT_HEIGHT + 1, &sysfont);
	}

	if (test_write() == STATUS_OK) {
		gfx_mono_draw_string("OK",
				4 * SYSFONT_WIDTH, 2 * SYSFONT_HEIGHT + 1, &sysfont);
	} else {
		gfx_mono_draw_string("ERR",
				4 * SYSFONT_WIDTH, 2 * SYSFONT_HEIGHT + 1, &sysfont);
	}

	if (test_atomic_write() == STATUS_OK) {
		gfx_mono_draw_string("OK",
				8 * SYSFONT_WIDTH, 2 * SYSFONT_HEIGHT + 1, &sysfont);
	} else {
		gfx_mono_draw_string("ERR",
				8 * SYSFONT_WIDTH, 2 * SYSFONT_HEIGHT + 1, &sysfont);
	}

	if (test_split_write() == STATUS_OK) {
		gfx_mono_draw_string("OK",
				12 * SYSFONT_WIDTH, 2 * SYSFONT_HEIGHT + 1, &sysfont);
	} else {
		gfx_mono_draw_string("ERR",
				12 * SYSFONT_WIDTH, 2 * SYSFONT_HEIGHT + 1, &sysfont);
	}

	if (test_erase_bytes() == STATUS_OK) {
		gfx_mono_draw_string("OK",
				16 * SYSFONT_WIDTH, 2 * SYSFONT_HEIGHT + 1, &sysfont);
	} else {
		gfx_mono_draw_string("ERR",
				16 * SYSFONT_WIDTH, 2 * SYSFONT_HEIGHT + 1, &sysfont);
	}

	while (true) {}

}
Esempio n. 4
0
int
main()
{
	test_empty_rope();
	test_append();
	test_prepend();
	test_insert();
	test_erase();
	return 0;
}
Esempio n. 5
0
int main(int argc, char* argv[])
{
	test_basic();
	test_iteration();
	test_find();
	test_erase();
	test_list();
	test_unordered();
	int a = sizeof(obj);
	int b = sizeof(boost::optional<obj&>);
	int xx = 0;
	return boost::report_errors();
}
Esempio n. 6
0
void test_slist(struct cag_test_series *tests)
{
	test_it(tests);
	test_new(tests);
	test_prepend(tests);
	test_insert(tests);
	test_insertp(tests);
	test_distance(tests);
	test_front(tests);
	test_erase(tests);
	test_copy(tests);
	test_reverse(tests);
	test_copy_over(tests);
	test_sort(tests);
	test_find(tests);
}
Esempio n. 7
0
int
main()
{
    BOOST_STATIC_ASSERT((!phx::stl::has_mapped_type<std::list<int> >::value));
    BOOST_STATIC_ASSERT((!phx::stl::has_key_type<std::list<int> >::value));

    std::list<int> const data = build_list();
    test_empty(data);
    test_end(data);
    test_erase(data);
    test_front(data);
    test_get_allocator(data);
    test_insert(data);
    test_max_size(data);
    return boost::report_errors();
}
Esempio n. 8
0
int
main()
{
    std::deque<int> const data = build_deque();
    test_assign(data);
    test_assign2(data);
    test_at(data);
    test_back(data);
    test_begin(data);
    test_clear(data);
    test_front(data);
    test_empty(data);
    test_end(data);
    test_erase(data);
    test_get_allocator(data);
    return boost::report_errors();
}
Esempio n. 9
0
void test_insert( uint32_t num_nodes , uint32_t num_inserts , uint32_t num_duplicates , bool near )
{
  typedef Kokkos::UnorderedMap<uint32_t,uint32_t, Device> map_type;
  typedef Kokkos::UnorderedMap<const uint32_t,const uint32_t, Device> const_map_type;

  const uint32_t expected_inserts = (num_inserts + num_duplicates -1u) / num_duplicates;

  map_type map;
  map.rehash(num_nodes,false);

  if (near) {
    Impl::TestInsert<map_type,true> test_insert(map, num_inserts, num_duplicates);
    test_insert.testit();
  } else
  {
    Impl::TestInsert<map_type,false> test_insert(map, num_inserts, num_duplicates);
    test_insert.testit();
  }

  const bool print_list = false;
  if (print_list) {
    Kokkos::Impl::UnorderedMapPrint<map_type> f(map);
    f.apply();
  }

  const uint32_t map_size = map.size();

  ASSERT_FALSE( map.failed_insert());
  {
    EXPECT_EQ(expected_inserts, map_size);

    {
      uint32_t find_errors = 0;
      Impl::TestFind<const_map_type> test_find(map, num_inserts, num_duplicates);
      test_find.testit(find_errors);
      EXPECT_EQ( 0u, find_errors);
    }

    map.begin_erase();
    Impl::TestErase<map_type,false> test_erase(map, num_inserts, num_duplicates);
    test_erase.testit();
    map.end_erase();
    EXPECT_EQ(0u, map.size());
  }
}
Esempio n. 10
0
int main(int argc, char** argv)
{
  if (!parse_args(argc,argv)) {
    return 0;
  }

  plan_tests(16);

  Waypoints waypoints;

  ok(setup_waypoints(waypoints),"waypoint setup",0);

  unsigned size = waypoints.size();

  ok(test_lookup(waypoints,3),"waypoint lookup",0);
  ok(!test_lookup(waypoints,5000),"waypoint bad lookup",0);
  ok(test_nearest(waypoints),"waypoint nearest",0);
  ok(test_nearest_landable(waypoints),"waypoint nearest landable",0);
  ok(test_location(waypoints,true),"waypoint location good",0);
  ok(test_location(waypoints,false),"waypoint location bad",0);
  ok(test_range(waypoints,100)==1,"waypoint visit range 100m",0);
  ok(test_radius(waypoints,100)==1,"waypoint radius 100m",0);
  ok(test_range(waypoints,500000)== waypoints.size(),"waypoint range 500000m",0);
  ok(test_radius(waypoints,25000)<= test_range(waypoints,25000),"waypoint radius<range",0);

  // test clear
  waypoints.clear();
  ok(waypoints.size()==0,"waypoint clear",0);
  setup_waypoints(waypoints);
  ok(size == waypoints.size(),"waypoint setup after clear",0);

  ok(test_copy(waypoints),"waypoint copy",0);

  ok(test_erase(waypoints,3),"waypoint erase",0);
  ok(test_replace(waypoints,4),"waypoint replace",0);

  return exit_status();
}
Esempio n. 11
0
int t_map()
{
	c_map map;

	c_map_create(&map, int_comparer);

	
	assert(__c_rb_tree_verify(map._l));
	printf("0. test create with insert unique\n");
	create_with_insert_unique(&map);
	print_map(&map);
	rprint_map(&map);
	assert(__c_rb_tree_verify(map._l));

	printf("\n\n1. test clear\n");
	test_clear(&map);
	assert(__c_rb_tree_verify(map._l));

	printf("\n\n2. test size and empty\n");
	test_size_empty(&map);
	assert(__c_rb_tree_verify(map._l));

	printf("\n\n3. test create with insert equal\n");
	c_map_clear(&map);
	create_with_insert_equal(&map);
	print_map(&map);
	rprint_map(&map);
	assert(__c_rb_tree_verify(map._l));

	printf("\n\n4. test swap\n");
	create_with_insert_unique(&map);
	test_swap(&map);
	assert(__c_rb_tree_verify(map._l));

	printf("\n\n5. test create with insert unique1\n");
	create_with_insert_unique1(&map);
	print_map(&map);
	rprint_map(&map);
	assert(__c_rb_tree_verify(map._l));

	printf("\n\n6. test create with insert equal1\n");
	c_map_clear(&map);
	create_with_insert_equal1(&map);
	print_map(&map);
	rprint_map(&map);
	assert(__c_rb_tree_verify(map._l));

	printf("\n\n7. test create with insert unique2\n");
	c_map_clear(&map);
	create_with_insert_unique2(&map);
	print_map(&map);
	rprint_map(&map);
	assert(__c_rb_tree_verify(map._l));

	printf("\n\n8. test create with insert equal2\n");
	c_map_clear(&map);
	create_with_insert_equal2(&map);
	print_map(&map);
	rprint_map(&map);
	assert(__c_rb_tree_verify(map._l));
	
	printf("\n\n9. test erase\n");
	c_map_clear(&map);
	create_with_insert_unique(&map);
	test_erase(&map);
	create_with_insert_unique(&map);	
	test_reverse_erase(&map);	
	print_map(&map);
	assert(__c_rb_tree_verify(map._l));

	printf("\n\n10. test find and erase\n");
	c_map_clear(&map);
	printf("* test_find_erase:\n");
	create_with_insert_unique(&map);
	print_map(&map);	
	test_find_erase(&map);
	print_map(&map);	
	printf("* test_reverse_find_erase:\n");
	create_with_insert_unique(&map);
	print_map(&map);	
	test_reverse_find_erase(&map);
	print_map(&map);	
	assert(__c_rb_tree_verify(map._l));

	printf("\n\n11. test count:\n"); // 'lower_bound' 'upper_bound' 'equal_range' used	
	create_with_insert_unique(&map);
	test_count(&map);

	printf("\n\n12. test less:\n");
	test_less();

	printf("\n\n13. test equal:\n");
	test_equal();

	printf("\n\n14. test at:\n");
	test_at();
	
	c_map_destroy(&map);
	printf("\n\nfinish testing map!\n");
	return 0;
}