ObjFW  Check-in [5cbecd8453]

Overview
Comment:Migrate OFColorTests to ObjFWTest
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | objfwtest
Files: files | file ages | folders
SHA3-256: 5cbecd845310efc2408f4036b7d3b7c20dacb3999665be6fe5eccf17c34337fa
User & Date: js on 2024-02-11 12:28:52
Other Links: branch diff | manifest | tags
Context
2024-02-11
13:49
Migrate OFIRITests to ObjFWTest check-in: 5796b73644 user: js tags: objfwtest
12:28
Migrate OFColorTests to ObjFWTest check-in: 5cbecd8453 user: js tags: objfwtest
12:24
Migrate OFPluginTests to ObjFWTest check-in: 540160ff20 user: js tags: objfwtest
Changes

Modified new_tests/Makefile from [8649fe6555] to [5da634b74b].

1
2
3
4
5

6

7
8
9
10
11
12
13
1
2
3
4
5
6

7
8
9
10
11
12
13
14





+
-
+







include ../extra.mk

SUBDIRS = ${TESTPLUGIN}

PROG_NOINST = tests${PROG_SUFFIX}
SRCS = OFColorTests.m		\
SRCS = OFNumberTests.m		\
       OFNumberTests.m		\
       OFPBKDF2Tests.m		\
       OFPropertyListTests.m	\
       ${USE_SRCS_PLUGINS}
SRCS_PLUGINS = OFPluginTests.m

include ../buildsys.mk

Renamed and modified tests/OFColorTests.m [43c0fcb4d4] to new_tests/OFColorTests.m [70086bf554].

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







-
-
+
+
-

-
-
+

-
-
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

-
-
+
+
+
+


+
+
+
-
-
-
-
-
+
+
+
+
+
+
-


 * 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 = @"OFColor";

@implementation TestsAppDelegate (OFColorTests)
- (void)colorTests
@interface OFColorTests: OTTestCase
{
	void *pool = objc_autoreleasePoolPush();
	OFColor *color;
	OFColor *_color;
	float red, green, blue, alpha;

	TEST(@"+[colorWithRed:green:blue:alpha:]",
	    (color = [OFColor colorWithRed: 63.f / 255
				     green: 127.f / 255
				      blue: 1
				     alpha: 1]))

}
@end

@implementation OFColorTests
- (void)setUp
{
	_color = [[OFColor alloc] initWithRed: 63.f / 255
					green: 127.f / 255
					 blue: 1
					alpha: 1];
}

- (void)dealloc
{
	[_color release];

	[super dealloc];
}

#ifdef OF_OBJFW_RUNTIME
	TEST(@"+[colorWithRed:green:blue:alpha:] returns tagged pointer",
	    object_isTaggedPointer(color))
- (void)testReturnsTaggedPointer
{
	OTAssertTrue(object_isTaggedPointer(_color));
}
#endif

- (void)testGetRedGreenBlueAlpha
{
	float red, green, blue, alpha;
	TEST(@"-[getRed:green:blue:alpha:]",
	    R([color getRed: &red green: &green blue: &blue alpha: &alpha]) &&
	    red == 63.f / 255 && green == 127.f / 255 && blue == 1 &&
	    alpha == 1)


	[_color getRed: &red green: &green blue: &blue alpha: &alpha];
	OTAssertEqual(red, 63.f / 255);
	OTAssertEqual(green, 127.f / 255);
	OTAssertEqual(blue, 1);
	OTAssertEqual(alpha, 1);
	objc_autoreleasePoolPop(pool);
}
@end

Modified tests/Makefile from [5901b6f9c4] to [f2a9887732].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
16
17
18
19
20
21
22

23
24
25
26
27
28
29







-








PROG_NOINST = tests${PROG_SUFFIX}
STATIC_LIB_NOINST = ${TESTS_STATIC_LIB}
SRCS = ForwardingTests.m		\
       OFArrayTests.m			\
       ${OF_BLOCK_TESTS_M}		\
       OFCharacterSetTests.m		\
       OFColorTests.m			\
       OFDataTests.m			\
       OFDateTests.m			\
       OFDictionaryTests.m		\
       OFHMACTests.m			\
       OFINIFileTests.m			\
       OFIRITests.m			\
       OFInvocationTests.m		\