My favorites
▼
|
Sign in
touchcode
Repository of iPhone and iPod Touch source code.
Project Home
Export to GitHub
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
25
attachment: serializer_deserializer_tests.patch
(5.4 KB)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
Index: UnitTests/CJSONSerializer_UnitTests.m
===================================================================
--- UnitTests/CJSONSerializer_UnitTests.m (revision 101)
+++ UnitTests/CJSONSerializer_UnitTests.m (working copy)
@@ -11,5 +11,17 @@
#import "CJSONSerializer.h"
@implementation CJSONSerializer_UnitTests
+-(void)testEmptyDictionary {
+ NSString *jsonEquivalent = @"{}";
+ NSDictionary *emptyDictionary = [NSDictionary dictionary];
+ id theObject = [[CJSONSerializer serializer] serializeObject:emptyDictionary];
+ STAssertEqualObjects(jsonEquivalent, theObject, nil);
+}
+-(void)testSingleKeyValuePair {
+ NSString *jsonEquivalent = @"{\"a\":\"b\"}";
+ NSDictionary *dictionary = [NSDictionary dictionaryWithObject:@"b" forKey:@"a"];
+ id theObject = [[CJSONSerializer serializer] serializeObject:dictionary];
+ STAssertEqualObjects(jsonEquivalent, theObject, nil);
+}
@end
Index: UnitTests/CJSONDeserializer_UnitTests.h
===================================================================
--- UnitTests/CJSONDeserializer_UnitTests.h (revision 0)
+++ UnitTests/CJSONDeserializer_UnitTests.h (revision 0)
@@ -0,0 +1,16 @@
+//
+// CJSONDeserializer_UnitTests.h
+// TouchJSON
+//
+// Created by Luis de la Rosa on 8/6/08.
+// Copyright 2008 Happy Apps LLC. All rights reserved.
+//
+
+#import <SenTestingKit/SenTestingKit.h>
+
+
+@interface CJSONDeserializer_UnitTests : SenTestCase {
+
+}
+
+@end
Index: UnitTests/CJSONDeserializer_UnitTests.m
===================================================================
--- UnitTests/CJSONDeserializer_UnitTests.m (revision 0)
+++ UnitTests/CJSONDeserializer_UnitTests.m (revision 0)
@@ -0,0 +1,30 @@
+//
+// CJSONDeserializer_UnitTests.m
+// TouchJSON
+//
+// Created by Luis de la Rosa on 8/6/08.
+// Copyright 2008 Happy Apps LLC. All rights reserved.
+//
+
+#import "CJSONDeserializer_UnitTests.h"
+#import "CJSONDeserializer.h"
+
+
+@implementation CJSONDeserializer_UnitTests
+
+-(void)testEmptyDictionary {
+ NSString *theSource = @"{}";
+ NSData *theData = [theSource dataUsingEncoding:NSUTF32BigEndianStringEncoding];
+ id theObject = [[CJSONDeserializer deserializer] deserialize:theData error:nil];
+ NSDictionary *dictionary = [NSDictionary dictionary];
+ STAssertEqualObjects(dictionary, theObject, nil);
+}
+
+-(void)testSingleKeyValuePair {
+ NSString *theSource = @"{\"a\":\"b\"}";
+ NSData *theData = [theSource dataUsingEncoding:NSUTF32BigEndianStringEncoding];
+ id theObject = [[CJSONDeserializer deserializer] deserialize:theData error:nil];
+ NSDictionary *dictionary = [NSDictionary dictionaryWithObject:@"b" forKey:@"a"];
+ STAssertEqualObjects(dictionary, theObject, nil);
+}
+@end
Index: TouchJSON.xcodeproj/project.pbxproj
===================================================================
--- TouchJSON.xcodeproj/project.pbxproj (revision 101)
+++ TouchJSON.xcodeproj/project.pbxproj (working copy)
@@ -42,6 +42,7 @@
45FDB4D9094E057C00A8B4AB /* CJSONScanner.m in Sources */ = {isa = PBXBuildFile; fileRef = 45FDB4BB094E056800A8B4AB /* CJSONScanner.m */; };
45FDB4DB094E058000A8B4AB /* CDataScanner_Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 45FDB4B5094E056800A8B4AB /* CDataScanner_Extensions.m */; };
45FDB4DC094E058000A8B4AB /* NSCharacterSet_Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 45FDB4B3094E056800A8B4AB /* NSCharacterSet_Extensions.m */; };
+ DEDF6D770E4A4000005D2575 /* CJSONDeserializer_UnitTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DEDF6D750E4A3F64005D2575 /* CJSONDeserializer_UnitTests.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -88,6 +89,8 @@
45FDB4BB094E056800A8B4AB /* CJSONScanner.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CJSONScanner.m; sourceTree = "<group>"; };
45FDB4BE094E056800A8B4AB /* CJSONSerializer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CJSONSerializer.h; sourceTree = "<group>"; };
45FDB4BF094E056800A8B4AB /* CJSONSerializer.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; path = CJSONSerializer.m; sourceTree = "<group>"; };
+ DEDF6D740E4A3F64005D2575 /* CJSONDeserializer_UnitTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CJSONDeserializer_UnitTests.h; sourceTree = "<group>"; };
+ DEDF6D750E4A3F64005D2575 /* CJSONDeserializer_UnitTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CJSONDeserializer_UnitTests.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -150,6 +153,8 @@
453111820A64ECFA00A970C2 /* Blake.json */,
45DFEABA0DB6F289009267D5 /* CDataScanner_UnitTests.h */,
45DFEABB0DB6F289009267D5 /* CDataScanner_UnitTests.m */,
+ DEDF6D740E4A3F64005D2575 /* CJSONDeserializer_UnitTests.h */,
+ DEDF6D750E4A3F64005D2575 /* CJSONDeserializer_UnitTests.m */,
);
path = UnitTests;
sourceTree = "<group>";
@@ -311,6 +316,7 @@
45DFEABD0DB6F289009267D5 /* CDataScanner_UnitTests.m in Sources */,
45DFEBDF0DB7080D009267D5 /* CJSONSerializer_UnitTests.m in Sources */,
45DFEBE00DB7080E009267D5 /* CJSONScanner_UnitTests.m in Sources */,
+ DEDF6D770E4A4000005D2575 /* CJSONDeserializer_UnitTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Powered by
Google Project Hosting