Example #1
0
int main()
{
  test_basic();
  test_capacity();
  test_comparison();
  test_composite_key();
  test_conv_iterators();
  test_copy_assignment();
  test_hash_ops();
  test_iterators();
  test_key_extractors();
  test_list_ops();
  test_modifiers();
  test_mpl_ops();
  test_observers();
  test_projection();
  test_range();
  test_rank_ops();
  test_rearrange();
  test_safe_mode();
  test_serialization();
  test_set_ops();
  test_special_set_ops();
  test_update();

  return boost::report_errors();
}
Example #2
0
int main ()
{
    BEGIN_TESTS(0);

    test_constructors();
    test_assignments();
    test_access();
    test_iterators();
    test_capacity();
    test_operations();
    test_search();

    return END_TESTS;
}
Example #3
0
static int
run_test (int /* argc */, char** /* argv */)
{
    rw_info (0, 0, 0, "std::vector<UserClass>::capacity() const");
    rw_info (0, 0, 0, "std::vector<UserClass>::reserve(size_type)");

    const Vector::size_type max_elems = Vector::size_type (rw_opt_nloops);

    rw_note (0 == rw_opt_no_exceptions, 0, 0, "exception test disabled");

    for (Vector::size_type i = 0; i < max_elems; ++i) {
        test_capacity (i);
    }

    return 0;
}
Example #4
0
int
main(void) {
  test_construct_with_null();
  test_construct_with_empty_string();
  test_construct_with_nonempty_string();
  test_append_char();
  test_at();
  test_back();
  test_capacity();
  test_clear();
  test_compare();
  test_data();
  test_empty();
  test_free();
  test_front();
  test_length();
  test_max_size();
  test_pop_back();
  test_push_back();
  test_reserve();
  test_resize();
  test_size();
  return EXIT_SUCCESS;
}
Example #5
0
static void
cd_set_capacity(cd_driver_info* info, uint64 capacity, uint32 blockSize)
{
	TRACE("cd_set_capacity(info = %p, capacity = %Ld, blockSize = %ld)\n",
		info, capacity, blockSize);

	// get log2, if possible
	uint32 blockShift = log2(blockSize);

	if ((1UL << blockShift) != blockSize)
		blockShift = 0;

	if (info->block_size != blockSize) {
		if (capacity == 0) {
			// there is obviously no medium in the drive, don't try to update
			// the DMA resource
			return;
		}

		if (info->block_size != 0) {
			dprintf("old %ld, new %ld\n", info->block_size, blockSize);
			panic("updating DMAResource not yet implemented...");
		}

		// TODO: we need to replace the DMAResource in our IOScheduler
		status_t status = info->dma_resource->Init(info->node, blockSize, 1024,
			32);
		if (status != B_OK)
			panic("initializing DMAResource failed: %s", strerror(status));

		// Allocate the I/O scheduler. If there seems to be sufficient memory
		// we use an IOCache, since that adds caching at the lowest I/O layer
		// and thus dramatically reduces I/O operations and seeks. The
		// disadvantage is that it increases free memory (physical pages)
		// fragmentation, which makes large contiguous allocations more likely
		// to fail.
		size_t freeMemory = vm_page_num_free_pages();
		if (freeMemory > 180 * 1024 * 1024 / B_PAGE_SIZE) {
			info->io_scheduler = new(std::nothrow) IOCache(info->dma_resource,
				1024 * 1024);
		} else {
			dprintf("scsi_cd: Using IOSchedulerSimple instead of IOCache to "
				"avoid memory allocation issues.\n");
			info->io_scheduler = new(std::nothrow) IOSchedulerSimple(
				info->dma_resource);
		}

		if (info->io_scheduler == NULL)
			panic("allocating IOScheduler failed.");

		// TODO: use whole device name here
		status = info->io_scheduler->Init("scsi");
		if (status != B_OK)
			panic("initializing IOScheduler failed: %s", strerror(status));

		info->io_scheduler->SetCallback(do_io, info);
		info->block_size = blockSize;
	}

	if (info->original_capacity != capacity && info->io_scheduler != NULL) {
		info->original_capacity = capacity;

		// For CDs, it's obviously relatively normal that they report a larger
		// capacity than it can actually address. Therefore we'll manually
		// correct the value here.
		test_capacity(info);

		info->io_scheduler->SetDeviceCapacity(info->capacity * blockSize);
	}
}
int test_main(int,char *[])
{
  test_capacity();
  return 0;
}