// StringTest.m -- test out the String class

#import <daymisckit/daymisckit.h>
#import <appkit/appkit.h>
#import <stdio.h>

void main()
{
	id logFile = [[DAYLogFile alloc] init];
	id theLine = [[DAYString alloc] init];
	int i;
	[logFile setFileName:[[DAYString alloc] initString:"sample.log"]];

	[theLine setStringValue:"This is the first line.\n"];
	[logFile addLineToLogFile:theLine];
	[theLine setStringValue:"Repeat this line four times.\n"];
	[logFile openFile];
	for (i=0; i<4; i++) [logFile appendToLogFile:theLine andFlush:NO];
	[theLine setStringValue:"Repeat this line twice.\n"];
	[logFile appendToLogFile:theLine andFlush:NO];
	[logFile appendToLogFile:theLine andFlush:NO];
	[logFile closeFile];
	[theLine setStringValue:"Repeat this new line twice.\n"];
	[logFile openFile];
	[logFile appendToLogFile:theLine andFlush:NO];
	[logFile appendToLogFile:theLine andFlush:NO];
	[theLine setStringValue:"And this line three times.\n"];
	for (i=0; i<3; i++) [logFile appendToLogFile:theLine andFlush:YES];
	[logFile closeFile];
	[theLine setStringValue:"This is the last line.\n"];
	[logFile addLineToLogFile:theLine];
	system("cat sample.log");
	
	exit(0);
}
