ObjFW  Check-in [b0901ee40e]

Overview
Comment:Migrate OFThreadTests to ObjFWTest
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | objfwtest
Files: files | file ages | folders
SHA3-256: b0901ee40eebe3aa8d7ff0dca02ec84fcf41db0c45aae4208709ef89d94a1e5f
User & Date: js on 2024-02-11 22:01:39
Other Links: branch diff | manifest | tags
Context
2024-02-11
22:32
Migrate OFINIFileTests to ObjFWTest check-in: cc7c76d3c2 user: js tags: objfwtest
22:01
Migrate OFThreadTests to ObjFWTest check-in: b0901ee40e user: js tags: objfwtest
21:57
Migrate OFHMACTests to ObjFWTest check-in: e3fbb3ecea user: js tags: objfwtest
Changes

Modified new_tests/Makefile from [f6e6a1d934] to [1fa5b4b95f].

22
23
24
25
26
27
28

29
30
31
32

33
34
35
36
37
38
39
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41







+




+







       OFNumberTests.m			\
       OFPBKDF2Tests.m			\
       OFPropertyListTests.m		\
       OFScryptTests.m			\
       ${USE_SRCS_PLUGINS}		\
       ${USE_SRCS_SOCKETS}		\
       ${USE_SRCS_SUBPROCESSES}		\
       ${USE_SRCS_THREADS}		\
       testfile_bin.m
SRCS_PLUGINS = OFPluginTests.m
SRCS_SOCKETS = OFSocketTests.m
SRCS_SUBPROCESSES = OFSubprocessTests.m
SRCS_THREADS = OFThreadTests.m

include ../buildsys.mk

testfile_bin.m: testfile.bin
	${SHELL} ../utils/objfw-embed testfile.bin testfile.bin $@

.PHONY: run run-on-ios run-on-android

Renamed and modified tests/OFThreadTests.m [bbeb8a5fbf] to new_tests/OFThreadTests.m [b2b1434e44].

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
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







-
+
+

-
+
+















-
-
+
+

-
-
+

-
-
-
+

-
-
+
-
-
-
+
+
-
-

 * 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 "TestsAppDelegate.h"
#import "ObjFW.h"
#import "ObjFWTest.h"

static OFString *const module = @"OFThread";
@interface OFThreadTests: OTTestCase
@end

@interface TestThread: OFThread
@end

@implementation TestThread
- (id)main
{
	[[OFThread threadDictionary] setObject: @"bar" forKey: @"foo"];
	OFEnsure([[[OFThread threadDictionary]
	    objectForKey: @"foo"] isEqual: @"bar"]);

	return @"success";
}
@end

@implementation TestsAppDelegate (OFThreadTests)
- (void)threadTests
@implementation OFThreadTests
- (void)testThread
{
	void *pool = objc_autoreleasePoolPush();
	TestThread *thread;
	TestThread *thread = [TestThread thread];

	TEST(@"+[thread]", (thread = [TestThread thread]))

	TEST(@"-[start]", R([thread start]))
	[thread start];

	TEST(@"-[join]", [[thread join] isEqual: @"success"])

	OTAssertEqualObjects([thread join], @"success");
	TEST(@"-[threadDictionary]",
	    [[OFThread threadDictionary] objectForKey: @"foo"] == nil)

	OTAssertNil([[OFThread threadDictionary] objectForKey: @"foo"]);
}
	objc_autoreleasePoolPop(pool);
}
@end

Modified tests/Makefile from [7ea80715b4] to [ca9e95cc01].

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
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







-


















-







       OFXMLNodeTests.m			\
       OFXMLParserTests.m		\
       RuntimeTests.m			\
       ${RUNTIME_ARC_TESTS_M}		\
       TestsAppDelegate.m		\
       ${USE_SRCS_FILES}		\
       ${USE_SRCS_SOCKETS}		\
       ${USE_SRCS_THREADS}		\
       ${USE_SRCS_WINDOWS}		\
       testfile_ini.m
SRCS_SOCKETS = OFDNSResolverTests.m		\
	       ${OF_HTTP_CLIENT_TESTS_M}	\
	       OFHTTPCookieTests.m		\
	       OFHTTPCookieManagerTests.m	\
	       OFKernelEventObserverTests.m	\
	       OFTCPSocketTests.m		\
	       OFUDPSocketTests.m		\
	       ${USE_SRCS_APPLETALK}		\
	       ${USE_SRCS_IPX}			\
	       ${USE_SRCS_UNIX_SOCKETS}
SRCS_APPLETALK = OFDDPSocketTests.m
SRCS_IPX = OFIPXSocketTests.m		\
	   OFSPXSocketTests.m		\
	   OFSPXStreamSocketTests.m
SRCS_UNIX_SOCKETS = OFUNIXDatagramSocketTests.m	\
		    OFUNIXStreamSocketTests.m
SRCS_THREADS = OFThreadTests.m
SRCS_WINDOWS = OFWindowsRegistryKeyTests.m

IOS_USER ?= mobile
IOS_TMP ?= /tmp/objfw-test

include ../buildsys.mk

Modified tests/TestsAppDelegate.h from [5430f4b6a3] to [bc9ad3426e].

159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
159
160
161
162
163
164
165




166
167
168
169
170
171
172







-
-
-
-







- (void)stringTests;
@end

@interface TestsAppDelegate (OFTCPSocketTests)
- (void)TCPSocketTests;
@end

@interface TestsAppDelegate (OFThreadTests)
- (void)threadTests;
@end

@interface TestsAppDelegate (OFUDPSocketTests)
- (void)UDPSocketTests;
@end

@interface TestsAppDelegate (OFUNIXDatagramSocketTests)
- (void)UNIXDatagramSocketTests;
@end

Modified tests/TestsAppDelegate.m from [f2f9977222] to [35fd715ddc].

404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
404
405
406
407
408
409
410



411
412
413
414
415
416
417







-
-
-







	[self SPXStreamSocketTests];
# endif
# ifdef OF_HAVE_APPLETALK
	[self DDPSocketTests];
# endif
	[self kernelEventObserverTests];
#endif
#ifdef OF_HAVE_THREADS
	[self threadTests];
#endif
#if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_THREADS)
	[self HTTPClientTests];
#endif
#ifdef OF_HAVE_SOCKETS
	[self HTTPCookieTests];
	[self HTTPCookieManagerTests];
#endif