Esempio n. 1
0
int32_t
main(int argc, char *argv[]) 
{
	int32_t ret = 0;

	if((fp = fopen("ZS_ShutdownIO.log", "w+")) == 0)
	{
		fprintf(stderr, "open log file failed!.\n");
		return -1;
	}

	/*
	 * Init ZS, creates containers, performs I/O and 
	 * random graceful shutdown.
	 */
	ret = mgr1();

	/*
	 * Clean up
	 */
	fclose(fp);

	fprintf(stderr, "Test Completed\n");
	fprintf(stderr, "Test Result:%s\n", (!ret ? "Passed":"Failed"));
	return ret;
}
void TestMapSettingsManager::testMapMetaSaveLoad()
{
	Settings conf;
	std::string path = getTestTempDirectory()
		+ DIR_DELIM + "foobar" + DIR_DELIM + "map_meta.txt";

	// Create a set of mapgen params and save them to map meta
	conf.set("seed", "12345");
	conf.set("water_level", "5");
	MapSettingsManager mgr1(&conf, path);
	MapgenParams *params1 = mgr1.makeMapgenParams();
	UASSERT(params1);
	UASSERT(mgr1.saveMapMeta());

	// Now try loading the map meta to mapgen params
	conf.set("seed", "67890");
	conf.set("water_level", "32");
	MapSettingsManager mgr2(&conf, path);
	UASSERT(mgr2.loadMapMeta());
	MapgenParams *params2 = mgr2.makeMapgenParams();
	UASSERT(params2);

	// Check that both results are correct
	UASSERTEQ(u64, params1->seed, 12345);
	UASSERTEQ(s16, params1->water_level, 5);
	UASSERTEQ(u64, params2->seed, 12345);
	UASSERTEQ(s16, params2->water_level, 5);
}
Esempio n. 3
0
int
main()
{
  Employee emp1("vektor",3);
  Manager mgr1("dewanto",1,1);
  
  std::vector<Employee> emps;
  emps.push_back(emp1);
  emps.push_back(mgr1);// M a n a g e r can be used wherever an E m p l o y e e is acceptable
  
}
void TestMapSettingsManager::testMapMetaFailures()
{
	std::string test_mapmeta_path;
	Settings conf;

	// Check to see if it'll fail on a non-existent map meta file
	test_mapmeta_path = "woobawooba/fgdfg/map_meta.txt";
	UASSERT(!fs::PathExists(test_mapmeta_path));

	MapSettingsManager mgr1(&conf, test_mapmeta_path);
	UASSERT(!mgr1.loadMapMeta());

	// Check to see if it'll fail on a corrupt map meta file
	test_mapmeta_path = makeMetaFile(true);
	UASSERT(fs::PathExists(test_mapmeta_path));

	MapSettingsManager mgr2(&conf, test_mapmeta_path);
	UASSERT(!mgr2.loadMapMeta());
}