int main(int argc, char **argv)
{
	int input = 0;

	fprintf(stdout, "Constructing a file system\n");
	fprintf(stdout, "Brett Crawford\n\n");
	
	fprintf(stdout, "This program will test the file system I have created.\n\n");

	fprintf(stdout, "Test run 1 will initialize the unused Drive2MB virtual drive and\n");
	fprintf(stdout, "perform several file creations, directory creations, file reads,\n");
	fprintf(stdout, "and file writes.\n\n");

	fprintf(stdout, "Test run 2 will reopen the previously initialized Drive2MB and\n");
	fprintf(stdout, "display the boot record and the contents on the virtual drive.\n\n");

	fprintf(stdout, "Note: Test run 1 should be performed before test run 2.\n\n");

	while(input != 1 && input != 2)
	{
		fprintf(stdout, "Please choose the test to perform (1 or 2): ");
		scanf("%d", &input);
	}

	if(input == 1)
		testRun1();
	else
		testRun2();

	fprintf(stdout, "\nTest finished. Exiting program.\n");

	return 0;
}
Esempio n. 2
0
main()
{
	int l_retCode = 0;
/*	const char* l_szServer = "sama.mcom.com";
	char l_szUser[] = "sama44";
	char l_szPassword[] = "sama44";
*/
	const char* l_szServer = "alterego.mcom.com";
	char l_szUser[] = "imaptest";
	char l_szPassword[] = "test";

	char* l_szTagID = NULL;
	char* l_szValue = NULL;

	/*Initialize and connect to IMAP server*/
	imap4Client_t * l_pimap4Client = NULL;
	imap4Sink_t* l_pimap4Sink = NULL;
	l_retCode = imap4Sink_initialize(&l_pimap4Sink);
	checkResult(l_retCode);
	setSinkMethods(l_pimap4Sink);
	l_retCode = imap4_initialize(&l_pimap4Client, l_pimap4Sink);
	checkResult(l_retCode);
	
	l_retCode = imap4_connect(l_pimap4Client, l_szServer, 143, &l_szTagID);
	checkResult(l_retCode);
	l_retCode = imap4_processResponses(l_pimap4Client);
	checkResult(l_retCode);
	imap4Tag_free(&l_szTagID);

	l_retCode = imap4_login(l_pimap4Client, l_szUser, l_szPassword, NULL);
	checkResult(l_retCode);
	l_retCode = imap4_processResponses(l_pimap4Client);
	checkResult(l_retCode);
	imap4Tag_free(&l_szTagID);

	/****************************************************************************
	* TestRuns
	*****************************************************************************/

	testRun1(l_pimap4Client);
	testRun2(l_pimap4Client);
	testRun3(l_pimap4Client);
	testRun4(l_pimap4Client);
	testRun5(l_pimap4Client);
	testRun6(l_pimap4Client);
	testRun7(l_pimap4Client);

	/*Namespace and ACL Extensions*/
	testRun8(l_pimap4Client);

	/*End Session*/
	l_retCode = imap4_logout(l_pimap4Client, &l_szTagID);
	checkResult(l_retCode);
	l_retCode = imap4_processResponses(l_pimap4Client);
	checkResult(l_retCode);
	imap4Tag_free(&l_szTagID);

	imap4_free(&l_pimap4Client);
	imap4Sink_free(&l_pimap4Sink);

	printf("Session ended.\n");
	getchar();
	return 0;
}