Overview
| Comment: | Migrate OFStreamTests to ObjFWTest |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | objfwtest |
| Files: | files | file ages | folders |
| SHA3-256: |
886a90bb341d8b93f487c4768eceb49c |
| User & Date: | js on 2024-02-18 19:23:08 |
| Other Links: | branch diff | manifest | tags |
Context
|
2024-02-18
| ||
| 19:27 | Remove old tests (check-in: 1fa2f03dc4 user: js tags: objfwtest) | |
| 19:23 | Migrate OFStreamTests to ObjFWTest (check-in: 886a90bb34 user: js tags: objfwtest) | |
| 19:13 | Migrate OFValueTests to ObjFWTest (check-in: a14df8d891 user: js tags: objfwtest) | |
Changes
Modified new_tests/Makefile from [114c8fcb6d] to [486a576b53].
| ︙ | ︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
OFNotificationCenterTests.m \
OFNumberTests.m \
OFObjectTests.m \
OFPBKDF2Tests.m \
OFPropertyListTests.m \
OFScryptTests.m \
OFSetTests.m \
OFStringTests.m \
OFSystemInfoTests.m \
OFUTF8StringTests.m \
OFValueTests.m \
OFXMLElementBuilderTests.m \
OFXMLNodeTests.m \
OFXMLParserTests.m \
| > | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
OFNotificationCenterTests.m \
OFNumberTests.m \
OFObjectTests.m \
OFPBKDF2Tests.m \
OFPropertyListTests.m \
OFScryptTests.m \
OFSetTests.m \
OFStreamTests.m \
OFStringTests.m \
OFSystemInfoTests.m \
OFUTF8StringTests.m \
OFValueTests.m \
OFXMLElementBuilderTests.m \
OFXMLNodeTests.m \
OFXMLParserTests.m \
|
| ︙ | ︙ |
Renamed and modified tests/OFStreamTests.m [b1e1e0bf5b] to new_tests/OFStreamTests.m [cac1034b86].
| ︙ | ︙ | |||
11 12 13 14 15 16 17 | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" | | > | > | | > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | < < < < < < < < < < < < < < < < < < < < < < < < < < | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 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 80 81 82 83 84 85 86 87 |
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "ObjFW.h"
#import "ObjFWTest.h"
@interface OFStreamTests: OTTestCase
@end
@interface OFTestStream: OFStream
{
int _state;
}
@end
@implementation OFStreamTests
- (void)testStream
{
size_t pageSize = [OFSystemInfo pageSize];
OFTestStream *stream = [[[OFTestStream alloc] init] autorelease];
char *cString = OFAllocMemory(pageSize - 2, 1);
@try {
OFString *string;
memset(cString, 'X', pageSize - 3);
cString[pageSize - 3] = '\0';
OTAssertEqualObjects([stream readLine], @"foo");
string = [stream readLine];
OTAssertNotNil(string);
OTAssertEqual(string.length, pageSize - 3);
OTAssertEqual(strcmp(string.UTF8String, cString), 0);
} @finally {
OFFreeMemory(cString);
}
}
@end
@implementation OFTestStream
- (bool)lowlevelIsAtEndOfStream
{
return (_state > 1);
}
- (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)size
{
size_t pageSize = [OFSystemInfo pageSize];
switch (_state) {
case 0:
if (size < 1)
return 0;
memcpy(buffer, "f", 1);
_state++;
return 1;
case 1:
if (size < pageSize)
return 0;
memcpy(buffer, "oo\n", 3);
memset((char *)buffer + 3, 'X', pageSize - 3);
_state++;
return pageSize;
}
return 0;
}
@end
|
Modified tests/Makefile from [b728fe0fc7] to [cc9a9f0351].
| ︙ | ︙ | |||
9 10 11 12 13 14 15 |
${PROG_NOINST}.nds \
${PROG_NOINST}.nro \
${PROG_NOINST}.rpx
DISTCLEAN = Info.plist
PROG_NOINST = tests${PROG_SUFFIX}
STATIC_LIB_NOINST = ${TESTS_STATIC_LIB}
| < | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
${PROG_NOINST}.nds \
${PROG_NOINST}.nro \
${PROG_NOINST}.rpx
DISTCLEAN = Info.plist
PROG_NOINST = tests${PROG_SUFFIX}
STATIC_LIB_NOINST = ${TESTS_STATIC_LIB}
SRCS = TestsAppDelegate.m
IOS_USER ?= mobile
IOS_TMP ?= /tmp/objfw-test
include ../buildsys.mk
.PHONY: run run-on-ios run-on-android
|
| ︙ | ︙ |
Modified tests/TestsAppDelegate.h from [490f0ea954] to [a0c4d5daa0].
| ︙ | ︙ | |||
54 55 56 57 58 59 60 | int _fails; } - (void)outputTesting: (OFString *)test inModule: (OFString *)module; - (void)outputSuccess: (OFString *)test inModule: (OFString *)module; - (void)outputFailure: (OFString *)test inModule: (OFString *)module; @end | < < < < | 54 55 56 57 58 59 60 | int _fails; } - (void)outputTesting: (OFString *)test inModule: (OFString *)module; - (void)outputSuccess: (OFString *)test inModule: (OFString *)module; - (void)outputFailure: (OFString *)test inModule: (OFString *)module; @end |
Modified tests/TestsAppDelegate.m from [98b6176409] to [aac1f271ba].
| ︙ | ︙ | |||
366 367 368 369 370 371 372 | [OFString stringWithUTF8String: (const char *)resourcesPath]]; #endif #if defined(OF_WII) && defined(OF_HAVE_FILES) [[OFFileManager defaultManager] changeCurrentDirectoryPath: @"/apps/objfw-tests"]; #endif | < < | 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | [OFString stringWithUTF8String: (const char *)resourcesPath]]; #endif #if defined(OF_WII) && defined(OF_HAVE_FILES) [[OFFileManager defaultManager] changeCurrentDirectoryPath: @"/apps/objfw-tests"]; #endif [OFStdOut reset]; #if defined(OF_IOS) [OFStdOut writeFormat: @"%d tests failed!", _fails]; [OFApplication terminateWithStatus: _fails]; #elif defined(OF_WII) [OFStdOut writeString: @"Press home button to exit!"]; |
| ︙ | ︙ |