67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
{
void *pool = objc_autoreleasePoolPush();
size_t pageSize = [OFSystemInfo pageSize];
StreamTester *t = [[[StreamTester alloc] init] autorelease];
OFString *str;
char *cstr;
cstr = [t allocMemoryWithSize: pageSize - 2];
memset(cstr, 'X', pageSize - 3);
cstr[pageSize - 3] = '\0';
TEST(@"-[readLine]", [[t readLine] isEqual: @"foo"] &&
[(str = [t readLine]) length] == pageSize - 3 &&
!strcmp(str.UTF8String, cstr))
objc_autoreleasePoolPop(pool);
}
@end
|
|
>
>
|
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
{
void *pool = objc_autoreleasePoolPush();
size_t pageSize = [OFSystemInfo pageSize];
StreamTester *t = [[[StreamTester alloc] init] autorelease];
OFString *str;
char *cstr;
cstr = of_malloc(pageSize - 2, 1);
memset(cstr, 'X', pageSize - 3);
cstr[pageSize - 3] = '\0';
TEST(@"-[readLine]", [[t readLine] isEqual: @"foo"] &&
[(str = [t readLine]) length] == pageSize - 3 &&
!strcmp(str.UTF8String, cstr))
free(cstr);
objc_autoreleasePoolPop(pool);
}
@end
|