incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: Added Base64 unit tests.
Date Tue, 03 Jul 2012 05:20:23 GMT
Updated Branches:
  refs/heads/master 751172621 -> 21a9cec0f


Added Base64 unit tests.


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/21a9cec0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/21a9cec0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/21a9cec0

Branch: refs/heads/master
Commit: 21a9cec0febae45ebb71788fe30b1ff7fce28649
Parents: 7511726
Author: Shazron Abdullah <shazron@apache.org>
Authored: Mon Jul 2 22:20:13 2012 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Mon Jul 2 22:20:13 2012 -0700

----------------------------------------------------------------------
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |   26 ++------
 CordovaLib/CordovaLibTests/CDVBase64Tests.h     |   26 ++++++++
 CordovaLib/CordovaLibTests/CDVBase64Tests.m     |   60 ++++++++++++++++++
 3 files changed, 92 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/21a9cec0/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index adfdd79..90d7c14 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -1,24 +1,4 @@
 // !$*UTF8*$!
-/*
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-# http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#  KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-*/
 {
 	archiveVersion = 1;
 	classes = {
@@ -135,6 +115,7 @@
 		30C684951407044B004C1A8E /* CDVURLProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef
= 30C684921407044A004C1A8E /* CDVURLProtocol.h */; settings = {ATTRIBUTES = (Public, ); };
};
 		30C684961407044B004C1A8E /* CDVURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef
= 30C684931407044A004C1A8E /* CDVURLProtocol.m */; };
 		30C684971407044B004C1A8E /* CDVURLProtocol.m in Sources */ = {isa = PBXBuildFile; fileRef
= 30C684931407044A004C1A8E /* CDVURLProtocol.m */; };
+		30D1B08C15A2B36D0060C291 /* CDVBase64Tests.m in Sources */ = {isa = PBXBuildFile; fileRef
= 30D1B08B15A2B36D0060C291 /* CDVBase64Tests.m */; };
 		30E33AF213A7E24B00594D64 /* CDVPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef =
30E33AF013A7E24B00594D64 /* CDVPlugin.h */; };
 		30E33AF313A7E24B00594D64 /* CDVPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef =
30E33AF113A7E24B00594D64 /* CDVPlugin.m */; };
 		30E563CF13E217EC00C949AA /* NSMutableArray+QueueAdditions.h in Headers */ = {isa = PBXBuildFile;
fileRef = 30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */; };
@@ -271,6 +252,8 @@
 		30C6847F1406CB38004C1A8E /* CDVWhitelist.m */ = {isa = PBXFileReference; fileEncoding =
4; lastKnownFileType = sourcecode.c.objc; name = CDVWhitelist.m; path = Classes/CDVWhitelist.m;
sourceTree = "<group>"; };
 		30C684921407044A004C1A8E /* CDVURLProtocol.h */ = {isa = PBXFileReference; fileEncoding
= 4; lastKnownFileType = sourcecode.c.h; name = CDVURLProtocol.h; path = Classes/CDVURLProtocol.h;
sourceTree = "<group>"; };
 		30C684931407044A004C1A8E /* CDVURLProtocol.m */ = {isa = PBXFileReference; fileEncoding
= 4; lastKnownFileType = sourcecode.c.objc; name = CDVURLProtocol.m; path = Classes/CDVURLProtocol.m;
sourceTree = "<group>"; };
+		30D1B08A15A2B36D0060C291 /* CDVBase64Tests.h */ = {isa = PBXFileReference; fileEncoding
= 4; lastKnownFileType = sourcecode.c.h; path = CDVBase64Tests.h; sourceTree = "<group>";
};
+		30D1B08B15A2B36D0060C291 /* CDVBase64Tests.m */ = {isa = PBXFileReference; fileEncoding
= 4; lastKnownFileType = sourcecode.c.objc; path = CDVBase64Tests.m; sourceTree = "<group>";
};
 		30E33AF013A7E24B00594D64 /* CDVPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4;
lastKnownFileType = sourcecode.c.h; name = CDVPlugin.h; path = Classes/CDVPlugin.h; sourceTree
= "<group>"; };
 		30E33AF113A7E24B00594D64 /* CDVPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4;
lastKnownFileType = sourcecode.c.objc; name = CDVPlugin.m; path = Classes/CDVPlugin.m; sourceTree
= "<group>"; };
 		30E563CD13E217EC00C949AA /* NSMutableArray+QueueAdditions.h */ = {isa = PBXFileReference;
fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSMutableArray+QueueAdditions.h";
path = "Classes/NSMutableArray+QueueAdditions.h"; sourceTree = "<group>"; };
@@ -476,6 +459,8 @@
 		686357B0141002F100DF4CF2 /* CordovaLibTests */ = {
 			isa = PBXGroup;
 			children = (
+				30D1B08A15A2B36D0060C291 /* CDVBase64Tests.h */,
+				30D1B08B15A2B36D0060C291 /* CDVBase64Tests.m */,
 				30B342F315224B360070E6A5 /* CDVWebViewTest.h */,
 				30B342F415224B360070E6A5 /* CDVWebViewTest.m */,
 				3062D1AC151D4D9D000D9128 /* CDVLocalStorageTests.h */,
@@ -950,6 +935,7 @@
 				30AE4E8D1419532F005A9C9A /* CDVContactsTests.m in Sources */,
 				3062D1AE151D4D9D000D9128 /* CDVLocalStorageTests.m in Sources */,
 				30B342F515224B360070E6A5 /* CDVWebViewTest.m in Sources */,
+				30D1B08C15A2B36D0060C291 /* CDVBase64Tests.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/21a9cec0/CordovaLib/CordovaLibTests/CDVBase64Tests.h
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLibTests/CDVBase64Tests.h b/CordovaLib/CordovaLibTests/CDVBase64Tests.h
new file mode 100644
index 0000000..ae6f9be
--- /dev/null
+++ b/CordovaLib/CordovaLibTests/CDVBase64Tests.h
@@ -0,0 +1,26 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <SenTestingKit/SenTestingKit.h>
+
+@interface CDVBase64Tests : SenTestCase {
+
+}
+
+@end

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/21a9cec0/CordovaLib/CordovaLibTests/CDVBase64Tests.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLibTests/CDVBase64Tests.m b/CordovaLib/CordovaLibTests/CDVBase64Tests.m
new file mode 100644
index 0000000..bd3e68e
--- /dev/null
+++ b/CordovaLib/CordovaLibTests/CDVBase64Tests.m
@@ -0,0 +1,60 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+ 
+ http://www.apache.org/licenses/LICENSE-2.0
+ 
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "CDVBase64Tests.h"
+#import "NSData+Base64.h"
+
+@implementation CDVBase64Tests
+
+- (void)setUp
+{
+    [super setUp];
+    
+    // setup code here
+}
+
+- (void)tearDown
+{
+    // Tear-down code here.
+
+    [super tearDown];
+}
+
+- (void) testBase64Encode
+{
+    NSString* decodedString = @"abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&";
+    NSData* decodedData = [decodedString dataUsingEncoding:NSUTF8StringEncoding];
+
+    NSString* expectedEncodedString = @"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwIUAjJCVeJg==";
+    NSString* actualEncodedString = [decodedData base64EncodedString];
+    
+    STAssertTrue([expectedEncodedString isEqualToString:actualEncodedString], nil);
+}
+
+- (void) testBase64Decode
+{
+    NSString* encodedString = @"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXoxMjM0NTY3ODkwIUAjJCVeJg==";
+    NSString* decodedString = @"abcdefghijklmnopqrstuvwxyz1234567890!@#$%^&";
+    NSData* encodedData = [decodedString dataUsingEncoding:NSUTF8StringEncoding];
+    NSData* decodedData = [NSData dataFromBase64String:encodedString];
+    
+    STAssertTrue([encodedData isEqualToData:decodedData], nil);
+}
+
+@end


Mime
View raw message