Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C64BE104C1 for ; Mon, 15 Jul 2013 16:32:39 +0000 (UTC) Received: (qmail 88001 invoked by uid 500); 15 Jul 2013 16:32:39 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 87977 invoked by uid 500); 15 Jul 2013 16:32:39 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 87663 invoked by uid 99); 15 Jul 2013 16:32:37 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Jul 2013 16:32:37 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 74F5589DC93; Mon, 15 Jul 2013 16:32:37 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ian@apache.org To: commits@cordova.apache.org Date: Mon, 15 Jul 2013 16:32:40 -0000 Message-Id: <32b82e4bf78e4c2a924b36613bcbc809@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [4/6] ios commit: [CB-4202] [CB-3653] Remove EXIF (Camera plugin) unit tests [CB-4202] [CB-3653] Remove EXIF (Camera plugin) unit tests Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/a7d8a166 Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/a7d8a166 Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/a7d8a166 Branch: refs/heads/master Commit: a7d8a166888c743031047f0a68b86e037f1ef791 Parents: b246b4a Author: Ian Clelland Authored: Mon Jul 15 12:28:04 2013 -0400 Committer: Ian Clelland Committed: Mon Jul 15 12:31:38 2013 -0400 ---------------------------------------------------------------------- CordovaLibTests/CDVExifTests.h | 38 ----- CordovaLibTests/CDVExifTests.m | 171 ------------------- .../CordovaTests.xcodeproj/project.pbxproj | 6 - 3 files changed, 215 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7d8a166/CordovaLibTests/CDVExifTests.h ---------------------------------------------------------------------- diff --git a/CordovaLibTests/CDVExifTests.h b/CordovaLibTests/CDVExifTests.h deleted file mode 100644 index 2f41c4c..0000000 --- a/CordovaLibTests/CDVExifTests.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - 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 - -#import - -#define ARC4RANDOM_MAX 0x100000000 - -@interface CDVExifTests : SenTestCase { - CDVJpegHeaderWriter* testHeaderWriter; - NSNumber* testErrorThreshhold; -} - -- (void)testContinuedFractionWithUInt; -- (void)testContinuedFractionWithUFloat; -- (void)testContinuedFractionsWorstCase; -- (void)testFormatHexFromDecimal; -- (void)testFormatNumberWithLeadingZeroes; -- (void)testUnsignedRationalToString; -- (void)testSignedRationalToString; -@end http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7d8a166/CordovaLibTests/CDVExifTests.m ---------------------------------------------------------------------- diff --git a/CordovaLibTests/CDVExifTests.m b/CordovaLibTests/CDVExifTests.m deleted file mode 100644 index aa456c8..0000000 --- a/CordovaLibTests/CDVExifTests.m +++ /dev/null @@ -1,171 +0,0 @@ -/* - 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 - -#import "CDVExifTests.h" - -@implementation CDVExifTests - -- (void)setUp -{ - [super setUp]; - testHeaderWriter = [[CDVJpegHeaderWriter alloc] init]; - testErrorThreshhold = [NSNumber numberWithDouble:0.000001]; - NSLog(@"%x", ~10 + 1); -} - -- (void)tearDown -{ - // Tear-down code here. - - [super tearDown]; -} - -// ================================================================================================== -// rational approximation of decimal by continued fraction tests -// ================================================================================================== - -// tests continued fraction with random int -- (void)testContinuedFractionWithUInt -{ - NSLog(@"Continued Fraction Test with random int value, numerator should be generated value, denominator should be 1"); - NSNumber* numerator = @0; - NSNumber* denominator = @0; - NSNumber* testValue = [NSNumber numberWithInt:abs(arc4random())]; - [testHeaderWriter decimalToUnsignedRational:testValue - withResultNumerator:&numerator - withResultDenominator:&denominator]; - STAssertEquals([numerator intValue], - [testValue intValue], - @"Numerator did not match"); - STAssertEquals([denominator intValue], - 1, - @"denominator was not one"); -} - -// tests continued fraction with random float -- (void)testContinuedFractionWithUFloat -{ - NSLog(@"Continued Fraction Test with random double value, resulting fraction should be within acceptable error threshhold"); - NSNumber* threshhold = @0.1; - NSNumber* numerator = @0; - NSNumber* denominator = @0; - NSLog(@"%f", ((double)arc4random() / ARC4RANDOM_MAX) * 100.0f); - NSNumber* testValue = [NSNumber numberWithDouble: - ((double)arc4random() / ARC4RANDOM_MAX) * 100.0f]; - - [testHeaderWriter decimalToUnsignedRational:testValue - withResultNumerator:&numerator - withResultDenominator:&denominator]; - NSLog(@"%lf, %lf", [testValue doubleValue], [numerator doubleValue] / [denominator doubleValue]); - - STAssertEqualsWithAccuracy([testValue doubleValue], - [numerator doubleValue] / [denominator doubleValue], - [threshhold doubleValue], - @"rational approximation did not meet acceptable error threshhold"); -} - -// tests continued fraction in sqrt(2) worst case -- (void)testContinuedFractionsWorstCase -{ - NSLog(@"Continued Fraction Test with provable worst case ~sqrt(2), resulting fraction should be within acceptable error threshhold"); - NSNumber* threshhold = @0.1; - NSNumber* numerator = @0; - NSNumber* denominator = @0; - NSNumber* testValue = [NSNumber numberWithDouble:sqrt(2)]; - [testHeaderWriter decimalToUnsignedRational:testValue - withResultNumerator:&numerator - withResultDenominator:&denominator]; - STAssertEqualsWithAccuracy([testValue doubleValue], - [numerator doubleValue] / [denominator doubleValue], - [threshhold doubleValue], - @"rational approximation did not meet acceptable error threshhold"); -} - -// tests format hex from a decimal -- (void)testFormatHexFromDecimal -{ - NSNumber* testValue = @1; - NSNumber* testPlaces = @8; - NSString* result = nil; - - result = [testHeaderWriter formattedHexStringFromDecimalNumber:testValue - withPlaces:testPlaces]; - // assert not nil - STAssertNotNil(result, @"nil renturned from formattedHexStringFromDecimalNumber"); - // assert correct number of places - STAssertEquals([result length], [testPlaces unsignedIntegerValue], - @"returned string to wrong number of places. Should be = %i Was = %i", - [testPlaces intValue], - [result length]); - // assert correct hex representation - STAssertTrueNoThrow([result isEqualToString:@"00000001"], @"result should be equal to @00000001"); -} - -// tests format number string with leading zeroes -- (void)testFormatNumberWithLeadingZeroes -{ - NSString* result = nil; - NSNumber* testValue = @8769; // Exif SubIFD Offset Tag - NSNumber* testPlaces = @6; - - result = [testHeaderWriter formatNumberWithLeadingZeroes:testValue - withPlaces:testPlaces]; - STAssertNotNil(result, @"nil renturned from formattedHexStringFromDecimalNumber"); - STAssertEquals([result length], - [testPlaces unsignedIntegerValue], - @"returned string to wrong number of places. Should be = %i Was = %i", - [testPlaces intValue], - [result length]); - // assert correct hex representation - STAssertTrueNoThrow([result isEqualToString:@"008769"], @"result was = %@ should be = @008769", result); -} - -- (void)testUnsignedRationalToString -{ - NSString* result = nil; - NSNumber* numerator = @1; - NSNumber* denominator = @10; - - result = [testHeaderWriter formatRationalWithNumerator:numerator - withDenominator:denominator - asSigned:FALSE]; - NSLog(@"%@", result); - STAssertNotNil(result, @"nil returned from testUnsignedRationalToString"); - STAssertTrueNoThrow([result length] == 16, @"returned string with wrong length. Exif rationals are 8 bytes, string has %ld bytes", [result length] / 2); - STAssertTrueNoThrow([result isEqualToString:@"000000010000000a"], @"result was = %@ should be = @0000000100000010", result); -} - -- (void)testSignedRationalToString -{ - NSString* result = nil; - NSNumber* numerator = @ - 1; - NSNumber* denominator = @ - 10; - - result = [testHeaderWriter formatRationalWithNumerator:numerator - withDenominator:denominator - asSigned:TRUE]; - NSLog(@"%@", result); - STAssertNotNil(result, @"nil returned from testSignedRationalToString"); - STAssertTrueNoThrow([result length] == 16, @"returned string with wrong length. Exif rationals are 8 bytes, string has %ld bytes", [result length] / 2); - STAssertTrueNoThrow([result isEqualToString:@"fffffffffffffff6"], @"result was = %@ should be = @000000FF000000F6", result); -} - -@end http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/a7d8a166/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj ---------------------------------------------------------------------- diff --git a/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj b/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj index acd7bc8..5de43de 100644 --- a/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj +++ b/CordovaLibTests/CordovaTests.xcodeproj/project.pbxproj @@ -41,7 +41,6 @@ 68A32D7D141030E4006B237C /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 686357AE141002F100DF4CF2 /* CoreGraphics.framework */; }; 68A32D7E141030EB006B237C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 686357AA141002F100DF4CF2 /* UIKit.framework */; }; 68A32D7F141030F3006B237C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 686357AC141002F100DF4CF2 /* Foundation.framework */; }; - 7E13A295175D487B00E522AB /* CDVExifTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E13A294175D487B00E522AB /* CDVExifTests.m */; }; 7E91406017711D88002C6A3F /* CDVWebViewDelegateTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 7E91405F17711D88002C6A3F /* CDVWebViewDelegateTests.m */; }; 8220B5C216D541BD00EC3921 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8220B5C116D541BD00EC3921 /* AssetsLibrary.framework */; }; 8220B5C616D542F500EC3921 /* AssetsLibrary.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8220B5C116D541BD00EC3921 /* AssetsLibrary.framework */; }; @@ -107,8 +106,6 @@ 686357D414100AF200DF4CF2 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; 686357DC14100B1600DF4CF2 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 68A32D7414103017006B237C /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; - 7E13A293175D487B00E522AB /* CDVExifTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVExifTests.h; sourceTree = ""; }; - 7E13A294175D487B00E522AB /* CDVExifTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVExifTests.m; sourceTree = ""; }; 7E91405F17711D88002C6A3F /* CDVWebViewDelegateTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWebViewDelegateTests.m; sourceTree = ""; }; 8220B5C116D541BD00EC3921 /* AssetsLibrary.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AssetsLibrary.framework; path = System/Library/Frameworks/AssetsLibrary.framework; sourceTree = SDKROOT; }; EB37018115D18B2D00BEBC43 /* CordovaLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CordovaLib.xcodeproj; path = ../CordovaLib/CordovaLib.xcodeproj; sourceTree = ""; }; @@ -251,8 +248,6 @@ isa = PBXGroup; children = ( 7E91405F17711D88002C6A3F /* CDVWebViewDelegateTests.m */, - 7E13A293175D487B00E522AB /* CDVExifTests.h */, - 7E13A294175D487B00E522AB /* CDVExifTests.m */, EB96677116ADBCF500D86CDF /* CDVUserAgentTest.m */, EBA3554415A731F100F4DE24 /* CDVFakeFileManager.h */, EBA3554515A731F100F4DE24 /* CDVFakeFileManager.m */, @@ -433,7 +428,6 @@ EBA3556F15ABD0C900F4DE24 /* CDVFileTransferTests.m in Sources */, EB89634A15FE66EA00E12277 /* CDVInvokedUrlCommandTests.m in Sources */, EB96677216ADBCF500D86CDF /* CDVUserAgentTest.m in Sources */, - 7E13A295175D487B00E522AB /* CDVExifTests.m in Sources */, 7E91406017711D88002C6A3F /* CDVWebViewDelegateTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0;