Ejemplo n.º 1
0
int
main(int argc, char *argv[])
{
	START(argc, argv, "obj_cpp_unordered_set");

	if (argc != 3 || strchr("co", argv[1][0]) == nullptr)
		UT_FATAL("usage: %s <c,o> file-name", argv[0]);

	const char *path = argv[2];

	nvobj::pool<root> pop;
	bool open = (argv[1][0] == 'o');

	try {
		if (open) {
			pop = nvobj::pool<root>::open(path, LAYOUT);

		} else {
			pop = nvobj::pool<root>::create(path, LAYOUT,
							PMEMOBJ_MIN_POOL * 2,
							S_IWUSR | S_IRUSR);
			nvobj::transaction::manual tx(pop);
			pop.get_root()->cons =
				nvobj::make_persistent<containers>(pop);
			nvobj::transaction::commit();
		}
	} catch (nvml::pool_error &pe) {
		UT_FATAL("!pool::create: %s %s", pe.what(), path);
	}

	test_unordered_set(pop, open);

	pop.close();

	DONE(nullptr);
}
int test_main( int /* argc */, char* /* argv */[] ){
	test_unordered_set();
	test_unordered_multiset();
    return EXIT_SUCCESS;
}