ObjFW  Check-in [35347686ad]

Overview
Comment:Add OFDNSResolverTests

These only print the settings for now.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 35347686ad082fa08c09c2fdd802375249c51d123d483c9b5660760dd254e4af
User & Date: js on 2018-08-19 23:32:44
Other Links: manifest | tags
Context
2018-08-19
23:50
OFDNSResolver: Do not allow IPs as local domain check-in: 7050b3a480 user: js tags: trunk
23:32
Add OFDNSResolverTests check-in: 35347686ad user: js tags: trunk
02:40
tests: Ignore unimplemented user{Config,Data}Path check-in: e814441c17 user: js tags: trunk
Changes

Modified tests/Makefile from [041cc37eef] to [d4732b51d0].

48
49
50
51
52
53
54

55

56
57
58
59
60
61
62
48
49
50
51
52
53
54
55

56
57
58
59
60
61
62
63







+
-
+







	     OFSerializationTests.m	\
	     OFSHA1HashTests.m		\
	     OFSHA224HashTests.m	\
	     OFSHA256HashTests.m	\
	     OFSHA384HashTests.m	\
	     OFSHA512HashTests.m
SRCS_PLUGINS = OFPluginTests.m
SRCS_SOCKETS = OFDNSResolverTests.m		\
SRCS_SOCKETS = OFHTTPCookieTests.m		\
	       OFHTTPCookieTests.m		\
	       OFHTTPCookieManagerTests.m	\
	       ${OFHTTPCLIENTTESTS_M}		\
	       OFKernelEventObserverTests.m	\
	       OFTCPSocketTests.m		\
	       OFUDPSocketTests.m		\
	       SocketTests.m
SRCS_THREADS = OFThreadTests.m

Added tests/OFDNSResolverTests.m version [0153284c85].









































































1
2
3
4
5
6
7
8
9
10
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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
 *               2018
 *   Jonathan Schleifer <js@heap.zone>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * 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 "OFDNSResolver.h"
#import "OFArray.h"
#import "OFDictionary.h"
#import "OFString.h"
#import "OFAutoreleasePool.h"

#import "TestsAppDelegate.h"

static OFString *module = @"OFDNSResolverTests";

@implementation TestsAppDelegate (OFDNSResolverTests)
- (void)DNSResolverTests
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFDNSResolver *resolver = [OFDNSResolver resolver];
	OFMutableString *staticHosts = [OFMutableString string];

	for (OFString *host in [resolver staticHosts]) {
		OFString *IPs;

		if ([staticHosts length] > 0)
			[staticHosts appendString: @"; "];

		IPs = [[[resolver staticHosts] objectForKey: host]
		    componentsJoinedByString: @", "];

		[staticHosts appendFormat: @"%@=(%@)", host, IPs];
	}
	PRINT(GREEN, @"Static hosts: %@", staticHosts);

	PRINT(GREEN, @"Name servers: %@",
	    [[resolver nameServers] componentsJoinedByString: @", "]);

	PRINT(GREEN, @"Local domain: %@", [resolver localDomain]);

	PRINT(GREEN, @"Search domains: %@",
	    [[resolver searchDomains] componentsJoinedByString: @", "]);

	PRINT(GREEN, @"Timeout: %lf", [resolver timeout]);

	PRINT(GREEN, @"Max attempts: %u", [resolver maxAttempts]);

	PRINT(GREEN, @"Min number of dots in absolute name: %u",
	    [resolver minNumberOfDotsInAbsoluteName]);

	PRINT(GREEN, @"Uses TCP: %u", [resolver usesTCP]);

	PRINT(GREEN, @"Config reload interval: %lf",
	    [resolver configReloadInterval]);

	[pool drain];
}
@end

Modified tests/TestsAppDelegate.h from [f163cc51a8] to [3fe9f6c770].

94
95
96
97
98
99
100




101
102
103
104
105
106
107
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111







+
+
+
+







@interface TestsAppDelegate (OFBlockTests)
- (void)blockTests;
@end

@interface TestsAppDelegate (OFCharacterSetTests)
- (void)characterSetTests;
@end

@interface TestsAppDelegate (OFDNSResolverTests)
- (void)DNSResolverTests;
@end

@interface TestsAppDelegate (OFDataTests)
- (void)dataTests;
@end

@interface TestsAppDelegate (OFDateTests)
- (void)dateTests;

Modified tests/TestsAppDelegate.m from [6a3d9e4d37] to [83bb4f0759].

438
439
440
441
442
443
444



445
446
447
448
449
450
451
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454







+
+
+







#endif
	[self JSONTests];
	[self propertyListTests];
#if defined(OF_HAVE_PLUGINS)
	[self pluginTests];
#endif

#ifdef OF_HAVE_SOCKETS
	[self DNSResolverTests];
#endif
	[self systemInfoTests];
	[self localeTests];

#if defined(OF_IOS)
	[self outputString: [OFString stringWithFormat: @"%d tests failed!",
							_fails]
		   inColor: NO_COLOR];