9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
* the packaging of this file.
*/
#include "config.h"
#include <string.h>
#import "OFStream.h"
#import "OFAutoreleasePool.h"
#import "main.h"
static OFString *module = @"OFStream";
@interface StreamTester: OFStream
{
int state;
}
|
>
|
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
* the packaging of this file.
*/
#include "config.h"
#include <string.h>
#import "OFString.h"
#import "OFStream.h"
#import "OFAutoreleasePool.h"
#import "TestsAppDelegate.h"
static OFString *module = @"OFStream";
@interface StreamTester: OFStream
{
int state;
}
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
return of_pagesize;
}
return 0;
}
@end
void
stream_tests()
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
StreamTester *t = [[[StreamTester alloc] init] autorelease];
OFString *str;
char *cstr;
cstr = [t allocMemoryWithSize: of_pagesize - 2];
memset(cstr, 'X', of_pagesize - 3);
cstr[of_pagesize - 3] = '\0';
TEST(@"-[readLine]", [[t readLine] isEqual: @"foo"] &&
[(str = [t readLine]) length] == of_pagesize - 3 &&
!strcmp([str cString], cstr))
[pool drain];
}
|
|
|
>
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
return of_pagesize;
}
return 0;
}
@end
@implementation TestsAppDelegate (OFStreamTests)
- (void)streamTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
StreamTester *t = [[[StreamTester alloc] init] autorelease];
OFString *str;
char *cstr;
cstr = [t allocMemoryWithSize: of_pagesize - 2];
memset(cstr, 'X', of_pagesize - 3);
cstr[of_pagesize - 3] = '\0';
TEST(@"-[readLine]", [[t readLine] isEqual: @"foo"] &&
[(str = [t readLine]) length] == of_pagesize - 3 &&
!strcmp([str cString], cstr))
[pool drain];
}
@end
|