13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
-
+
-
+
-
-
+
|
* file.
*/
#include "config.h"
#import "TestsAppDelegate.h"
static OFString *module = @"OFWindowsRegistryKey";
static OFString *const module = @"OFWindowsRegistryKey";
@implementation TestsAppDelegate (OFWindowsRegistryKeyTests)
- (void)windowsRegistryKeyTests
{
void *pool = objc_autoreleasePoolPush();
OFData *data = [OFData dataWithItems: "abcdef"
OFData *data = [OFData dataWithItems: "abcdef" count: 6];
count: 6];
OFWindowsRegistryKey *softwareKey, *ObjFWKey;
OFWindowsRegistryKey *softwareKey, *objFWKey;
DWORD type;
TEST(@"+[OFWindowsRegistryKey classesRootKey]",
[OFWindowsRegistryKey classesRootKey])
TEST(@"+[OFWindowsRegistryKey currentConfigKey]",
[OFWindowsRegistryKey currentConfigKey])
|
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
88
|
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
|
-
+
-
-
+
+
-
-
-
+
-
-
+
-
-
+
+
-
-
-
+
+
-
-
-
+
+
+
-
+
|
openSubkeyAtPath: @"Software"
securityAndAccessRights: KEY_ALL_ACCESS]) &&
[[OFWindowsRegistryKey currentUserKey]
openSubkeyAtPath: @"nonexistent"
securityAndAccessRights: KEY_ALL_ACCESS] == nil)
TEST(@"-[createSubkeyAtPath:securityAndAccessRights:]",
(ObjFWKey = [softwareKey createSubkeyAtPath: @"ObjFW"
(objFWKey = [softwareKey createSubkeyAtPath: @"ObjFW"
securityAndAccessRights: KEY_ALL_ACCESS]))
TEST(@"-[setData:forValue:type:]",
R([ObjFWKey setData: data
TEST(@"-[setData:forValueNamed:type:]",
R([objFWKey setData: data forValueNamed: @"data" type: REG_BINARY]))
forValue: @"data"
type: REG_BINARY]))
TEST(@"-[dataForValue:subkeyPath:flags:type:]",
TEST(@"-[dataForValueNamed:subkeyPath:flags:type:]",
[[ObjFWKey dataForValue: @"data"
type: &type] isEqual: data] &&
[[objFWKey dataForValueNamed: @"data" type: &type] isEqual: data] &&
type == REG_BINARY)
TEST(@"-[setString:forValue:type:]",
R([ObjFWKey setString: @"foobar"
TEST(@"-[setString:forValueNamed:type:]",
R([objFWKey setString: @"foobar" forValueNamed: @"string"]) &&
forValue: @"string"]) &&
R([ObjFWKey setString: @"%PATH%;foo"
forValue: @"expand"
R([objFWKey setString: @"%PATH%;foo"
forValueNamed: @"expand"
type: REG_EXPAND_SZ]))
TEST(@"-[stringForValue:subkeyPath:]",
[[ObjFWKey stringForValue: @"string"] isEqual: @"foobar"] &&
[[ObjFWKey stringForValue: @"expand"
type: &type] isEqual: @"%PATH%;foo"] &&
[[objFWKey stringForValueNamed: @"string"] isEqual: @"foobar"] &&
[[objFWKey stringForValueNamed: @"expand" type: &type]
isEqual: @"%PATH%;foo"] &&
type == REG_EXPAND_SZ)
TEST(@"-[deleteValue:]", R([ObjFWKey deleteValue: @"data"]))
TEST(@"-[deleteValueNamed:]", R([objFWKey deleteValueNamed: @"data"]))
TEST(@"-[deleteSubkeyAtPath:]",
R([softwareKey deleteSubkeyAtPath: @"ObjFW"]))
objc_autoreleasePoolPop(pool);
}
@end
|