Test cases for the version string comparator that converts "1.0" to 0.5. GVU test coverage is now 96.9%.
authorPeter Hosey <hg@boredzo.org>
Wed Oct 14 20:16:19 2009 -0700 (2009-10-14)
changeset 4524e21dae320e19
parent 4523 987556ed56e3
child 4525 e49d3c2578db
Test cases for the version string comparator that converts "1.0" to 0.5. GVU test coverage is now 96.9%.
Growl.xcodeproj/project.pbxproj
Unit tests/TestVersionComparisonBetweenStringsConverting1_0To0_5.h
Unit tests/TestVersionComparisonBetweenStringsConverting1_0To0_5.m
     1.1 --- a/Growl.xcodeproj/project.pbxproj	Wed Oct 14 18:05:03 2009 -0700
     1.2 +++ b/Growl.xcodeproj/project.pbxproj	Wed Oct 14 20:16:19 2009 -0700
     1.3 @@ -96,6 +96,7 @@
     1.4  		0A7F62600767C84E00E1C1E4 /* GrowlMusicVideoWindowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A7F62570767C84E00E1C1E4 /* GrowlMusicVideoWindowView.m */; };
     1.5  		0AEE179D0702C4960024B1A0 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AEE179C0702C4960024B1A0 /* ApplicationServices.framework */; };
     1.6  		31340CDD0D5B8E7100B9BEE0 /* GrowlPropertyListFilePathway.m in Sources */ = {isa = PBXBuildFile; fileRef = 31340CDB0D5B8E7100B9BEE0 /* GrowlPropertyListFilePathway.m */; };
     1.7 +		31B9BA5C1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m in Sources */ = {isa = PBXBuildFile; fileRef = 31B9BA5B1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m */; };
     1.8  		31C7594B1047202B008547BF /* simple-mailer.py in Resources */ = {isa = PBXBuildFile; fileRef = 31C7594A1047202B008547BF /* simple-mailer.py */; };
     1.9  		31E184E0108462F30011C78B /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 31E184DF108462F30011C78B /* SenTestingKit.framework */; };
    1.10  		31E184F51084632C0011C78B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83282741073A6BD70044A959 /* Cocoa.framework */; };
    1.11 @@ -692,6 +693,8 @@
    1.12  		31340CDA0D5B8E7100B9BEE0 /* GrowlPropertyListFilePathway.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrowlPropertyListFilePathway.h; path = Core/Source/GrowlPropertyListFilePathway.h; sourceTree = "<group>"; };
    1.13  		31340CDB0D5B8E7100B9BEE0 /* GrowlPropertyListFilePathway.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GrowlPropertyListFilePathway.m; path = Core/Source/GrowlPropertyListFilePathway.m; sourceTree = "<group>"; };
    1.14  		315C88BB1068F9A200880530 /* Localization.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Localization.xcconfig; path = xcconfig/Localization.xcconfig; sourceTree = "<group>"; };
    1.15 +		31B9BA5A1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestVersionComparisonBetweenStringsConverting1_0To0_5.h; sourceTree = "<group>"; };
    1.16 +		31B9BA5B1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestVersionComparisonBetweenStringsConverting1_0To0_5.m; sourceTree = "<group>"; };
    1.17  		31C7594A1047202B008547BF /* simple-mailer.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = "simple-mailer.py"; path = "external_dependencies/simple-mailer.py"; sourceTree = SOURCE_ROOT; };
    1.18  		31E184D61084628D0011C78B /* Unit tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Unit tests.octest"; sourceTree = BUILT_PRODUCTS_DIR; };
    1.19  		31E184D71084628D0011C78B /* Unit tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Unit tests-Info.plist"; sourceTree = "<group>"; };
    1.20 @@ -1736,6 +1739,8 @@
    1.21  				31E185E41084A9780011C78B /* TestVersionComparison.m */,
    1.22  				31E1863D1084B7500011C78B /* TestVersionComparisonBetweenStrings.h */,
    1.23  				31E1863E1084B7500011C78B /* TestVersionComparisonBetweenStrings.m */,
    1.24 +				31B9BA5A1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.h */,
    1.25 +				31B9BA5B1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m */,
    1.26  			);
    1.27  			path = "Unit tests";
    1.28  			sourceTree = "<group>";
    1.29 @@ -2864,6 +2869,7 @@
    1.30  				31E18504108465590011C78B /* GrowlVersionUtilities.c in Sources */,
    1.31  				31E185E51084A9780011C78B /* TestVersionComparison.m in Sources */,
    1.32  				31E1863F1084B7500011C78B /* TestVersionComparisonBetweenStrings.m in Sources */,
    1.33 +				31B9BA5C1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m in Sources */,
    1.34  			);
    1.35  			runOnlyForDeploymentPostprocessing = 0;
    1.36  		};
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Unit tests/TestVersionComparisonBetweenStringsConverting1_0To0_5.h	Wed Oct 14 20:16:19 2009 -0700
     2.3 @@ -0,0 +1,51 @@
     2.4 +//
     2.5 +//  TestVersionComparisonBetweenStringsConverting1_0To0_5.h
     2.6 +//  Growl
     2.7 +//
     2.8 +//  Created by Peter Hosey on 2009-10-13.
     2.9 +//  Copyright 2009 Peter Hosey. All rights reserved.
    2.10 +//
    2.11 +
    2.12 +#import <SenTestingKit/SenTestingKit.h>
    2.13 +
    2.14 +@interface TestVersionComparisonBetweenStringsConverting1_0To0_5 : SenTestCase
    2.15 +{}
    2.16 +
    2.17 +- (void) testSVNVersionNewerThanSVNVersion;
    2.18 +- (void) testSVNVersionEqualToSVNVersion;
    2.19 +
    2.20 +- (void) testDevelopmentVersionNewerThanDevelopmentVersion;
    2.21 +- (void) testDevelopmentVersionEqualToDevelopmentVersion;
    2.22 +
    2.23 +- (void) testAlphaNewerThanAlpha;
    2.24 +- (void) testAlphaEqualToAlpha;
    2.25 +
    2.26 +- (void) testBetaNewerThanBeta;
    2.27 +- (void) testBetaEqualToBeta;
    2.28 +
    2.29 +- (void) testReleaseNewerThanRelease;
    2.30 +- (void) testReleaseEqualToRelease;
    2.31 +
    2.32 +#pragma mark -
    2.33 +
    2.34 +- (void) testReleaseNewerThanBeta;
    2.35 +- (void) testReleaseNewerThanAlpha;
    2.36 +- (void) testReleaseNewerThanDevelopmentVersion;
    2.37 +- (void) testReleaseNewerThanSVNVersion;
    2.38 +
    2.39 +- (void) testBetaNewerThanAlpha;
    2.40 +- (void) testBetaNewerThanDevelopmentVersion;
    2.41 +- (void) testBetaNewerThanSVNVersion;
    2.42 +
    2.43 +- (void) testAlphaNewerThanDevelopmentVersion;
    2.44 +- (void) testAlphaNewerThanSVNVersion;
    2.45 +
    2.46 +- (void) testDevelopmentVersionNewerThanSVNVersion;
    2.47 +
    2.48 +#pragma mark Testing 1.0-to-0.5 conversion
    2.49 +
    2.50 +- (void) test1_0EqualTo0_5;
    2.51 +- (void) test1_0NewerThan0_6;
    2.52 +- (void) test1_0OlderThan0_4;
    2.53 +
    2.54 +@end
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Unit tests/TestVersionComparisonBetweenStringsConverting1_0To0_5.m	Wed Oct 14 20:16:19 2009 -0700
     3.3 @@ -0,0 +1,257 @@
     3.4 +//
     3.5 +//  TestVersionComparisonBetweenStringsConverting1_0To0_5.m
     3.6 +//  Growl
     3.7 +//
     3.8 +//  Created by Peter Hosey on 2009-10-13.
     3.9 +//  Copyright 2009 Peter Hosey. All rights reserved.
    3.10 +//
    3.11 +
    3.12 +#import "TestVersionComparisonBetweenStringsConverting1_0To0_5.h"
    3.13 +
    3.14 +#import "GrowlVersionUtilities.h"
    3.15 +
    3.16 +@implementation TestVersionComparisonBetweenStringsConverting1_0To0_5
    3.17 +
    3.18 +- (void) testSVNVersionNewerThanSVNVersion {
    3.19 +	NSString *olderString = @"1.0svn1000", *newerString = @"1.0svn1009";
    3.20 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.21 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
    3.22 +
    3.23 +	olderString = @"1.0svn1000";
    3.24 +	newerString = @"2.5.1svn1009";
    3.25 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.26 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
    3.27 +}
    3.28 +- (void) testSVNVersionEqualToSVNVersion {
    3.29 +	NSString *string = @"1.0svn1000";
    3.30 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
    3.31 +
    3.32 +	//Version-equal, but not string-equal.
    3.33 +	NSString *stringA = @"01.00svn01000";
    3.34 +	NSString *stringB =   @"1.0svn1000";
    3.35 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Version from string %@ must be equal to version from string %@", stringA, stringB);
    3.36 +}
    3.37 +
    3.38 +- (void) testDevelopmentVersionNewerThanDevelopmentVersion {
    3.39 +	NSString *olderString = @"1.0d10", *newerString = @"1.0d19";
    3.40 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.41 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
    3.42 +
    3.43 +	//Note that in this case, the development field is *lower*. Earlier development versions of newer releases should always compare newer.
    3.44 +	olderString = @"1.0d10";
    3.45 +	newerString = @"2.5.1d5";
    3.46 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.47 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
    3.48 +}
    3.49 +- (void) testDevelopmentVersionEqualToDevelopmentVersion {
    3.50 +	NSString *string = @"1.0d10";
    3.51 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
    3.52 +
    3.53 +	//Version-equal, but not string-equal.
    3.54 +	NSString *stringA = @"01.00d010";
    3.55 +	NSString *stringB =   @"1.0d10";
    3.56 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Version from string %@ must be equal to version from string %@", stringA, stringB);
    3.57 +}
    3.58 +
    3.59 +- (void) testAlphaNewerThanAlpha {
    3.60 +	NSString *olderString = @"1.0a10", *newerString = @"1.0a19";
    3.61 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.62 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
    3.63 +
    3.64 +	//Note that in this case, the development field is *lower*. Earlier development versions of newer releases should always compare newer.
    3.65 +	olderString = @"1.0a10";
    3.66 +	newerString = @"2.5.1a5";
    3.67 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.68 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
    3.69 +}
    3.70 +- (void) testAlphaEqualToAlpha {
    3.71 +	NSString *string = @"1.0a10";
    3.72 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
    3.73 +
    3.74 +	//Version-equal, but not string-equal.
    3.75 +	NSString *stringA = @"01.00a010";
    3.76 +	NSString *stringB =   @"1.0a10";
    3.77 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Version from string %@ must be equal to version from string %@", stringA, stringB);
    3.78 +}
    3.79 +
    3.80 +- (void) testBetaNewerThanBeta {
    3.81 +	NSString *olderString = @"1.0b10", *newerString = @"1.0b19";
    3.82 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.83 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
    3.84 +
    3.85 +	//Note that in this case, the development field is *lower*. Earlier development versions of newer releases should always compare newer.
    3.86 +	olderString = @"1.0b10";
    3.87 +	newerString = @"2.5.1b5";
    3.88 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.89 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
    3.90 +}
    3.91 +- (void) testBetaEqualToBeta {
    3.92 +	NSString *string = @"1.0b10";
    3.93 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
    3.94 +
    3.95 +	//Version-equal, but not string-equal.
    3.96 +	NSString *stringA = @"01.00b010";
    3.97 +	NSString *stringB =   @"1.0b10";
    3.98 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Version from string %@ must be equal to version from string %@", stringA, stringB);
    3.99 +}
   3.100 +
   3.101 +- (void) testReleaseNewerThanRelease {
   3.102 +	NSString *olderString = @"1.0", *newerString = @"1.0.1";
   3.103 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
   3.104 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
   3.105 +
   3.106 +	olderString = @"1.0";
   3.107 +	newerString = @"2.5.1";
   3.108 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
   3.109 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
   3.110 +}
   3.111 +- (void) testReleaseEqualToRelease {
   3.112 +	NSString *string = @"1.0";
   3.113 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
   3.114 +
   3.115 +	//Version-equal, but not string-equal.
   3.116 +	//Only "1.0" gets translated to 0.5. Other ways of expressing 1.0 remain verbatim.
   3.117 +	NSString *stringA = @"01.00.0";
   3.118 +	NSString *stringB =  @"1.0";
   3.119 +	STAssertFalse(compareVersionStringsTranslating1_0To0_5(stringA, stringB) == kCFCompareEqualTo, @"Version from string %@ must be in equal to (translated 0.5) version from string %@", stringA, stringB);
   3.120 +}
   3.121 +
   3.122 +#pragma mark -
   3.123 +
   3.124 +- (void) testReleaseNewerThanBeta {
   3.125 +	NSString *olderString = @"2.0b5", *newerString = @"2.0";
   3.126 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Beta (%@) must be less than release (%@)", olderString, newerString);
   3.127 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than beta (%@)", newerString, olderString);
   3.128 +
   3.129 +	//Inverse: Make sure an earlier beta of a later release compares as newer.
   3.130 +	olderString = newerString;
   3.131 +	newerString = @"3.0b2";
   3.132 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Beta (%@) must be less than release (%@)", olderString, newerString);
   3.133 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than beta (%@)", newerString, olderString);
   3.134 +}
   3.135 +- (void) testReleaseNewerThanAlpha {
   3.136 +	NSString *olderString = @"2.0a5", *newerString = @"2.0";
   3.137 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Alpha (%@) must be less than release (%@)", olderString, newerString);
   3.138 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than alpha (%@)", newerString, olderString);
   3.139 +
   3.140 +	//Inverse: Make sure an earlier alpha of a later release compares as newer.
   3.141 +	olderString = newerString;
   3.142 +	newerString = @"3.0a2";
   3.143 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Beta (%@) must be less than release (%@)", olderString, newerString);
   3.144 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than beta (%@)", newerString, olderString);
   3.145 +}
   3.146 +- (void) testReleaseNewerThanDevelopmentVersion {
   3.147 +	NSString *olderString = @"2.0d5", *newerString = @"2.0";
   3.148 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than release (%@)", olderString, newerString);
   3.149 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than development version (%@)", newerString, olderString);
   3.150 +
   3.151 +	//Inverse: Make sure an earlier development version of a later release compares as newer.
   3.152 +	olderString = newerString;
   3.153 +	newerString = @"3.0d2";
   3.154 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than release (%@)", olderString, newerString);
   3.155 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than development version (%@)", newerString, olderString);
   3.156 +}
   3.157 +- (void) testReleaseNewerThanSVNVersion {
   3.158 +	NSString *olderString = @"2.0svn500", *newerString = @"2.0";
   3.159 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than release (%@)", olderString, newerString);
   3.160 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.161 +
   3.162 +	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
   3.163 +	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
   3.164 +	olderString = newerString;
   3.165 +	newerString = @"3.0svn200";
   3.166 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than release (%@)", olderString, newerString);
   3.167 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.168 +}
   3.169 +
   3.170 +- (void) testBetaNewerThanAlpha {
   3.171 +	NSString *olderString = @"1.0a5", *newerString = @"1.0b4";
   3.172 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Alpha (%@) must be less than beta (%@)", olderString, newerString);
   3.173 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than alpha (%@)", newerString, olderString);
   3.174 +
   3.175 +	//Inverse: Make sure an earlier alpha of a later release compares as newer.
   3.176 +	olderString = newerString;
   3.177 +	newerString = @"2.0a2";
   3.178 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Alpha (%@) must be less than beta (%@)", olderString, newerString);
   3.179 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than alpha (%@)", newerString, olderString);
   3.180 +}
   3.181 +- (void) testBetaNewerThanDevelopmentVersion {
   3.182 +	NSString *olderString = @"1.0d5", *newerString = @"1.0b4";
   3.183 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than beta (%@)", olderString, newerString);
   3.184 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than development version (%@)", newerString, olderString);
   3.185 +
   3.186 +	//Inverse: Make sure an earlier development version of a later release compares as newer.
   3.187 +	olderString = newerString;
   3.188 +	newerString = @"2.0d2";
   3.189 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than beta (%@)", olderString, newerString);
   3.190 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than development version (%@)", newerString, olderString);
   3.191 +}
   3.192 +- (void) testBetaNewerThanSVNVersion {
   3.193 +	NSString *olderString = @"1.0svn500", *newerString = @"1.0b4";
   3.194 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than beta (%@)", olderString, newerString);
   3.195 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.196 +
   3.197 +	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
   3.198 +	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
   3.199 +	olderString = newerString;
   3.200 +	newerString = @"2.0svn200";
   3.201 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than beta (%@)", olderString, newerString);
   3.202 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.203 +}
   3.204 +
   3.205 +- (void) testAlphaNewerThanDevelopmentVersion {
   3.206 +	NSString *olderString = @"1.0d5", *newerString = @"1.0a4";
   3.207 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than alpha (%@)", olderString, newerString);
   3.208 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than development version (%@)", newerString, olderString);
   3.209 +
   3.210 +	//Inverse: Make sure an earlier development version of a later release compares as newer.
   3.211 +	olderString = newerString;
   3.212 +	newerString = @"2.0d2";
   3.213 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than alpha (%@)", olderString, newerString);
   3.214 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than development version (%@)", newerString, olderString);
   3.215 +}
   3.216 +- (void) testAlphaNewerThanSVNVersion {
   3.217 +	NSString *olderString = @"1.0svn500", *newerString = @"1.0a4";
   3.218 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than alpha (%@)", olderString, newerString);
   3.219 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.220 +
   3.221 +	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
   3.222 +	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
   3.223 +	olderString = newerString;
   3.224 +	newerString = @"2.0svn200";
   3.225 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than alpha (%@)", olderString, newerString);
   3.226 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.227 +}
   3.228 +
   3.229 +- (void) testDevelopmentVersionNewerThanSVNVersion {
   3.230 +	NSString *olderString = @"1.0svn500", *newerString = @"1.0d4";
   3.231 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than development version (%@)", olderString, newerString);
   3.232 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Development version (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.233 +
   3.234 +	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
   3.235 +	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
   3.236 +	olderString = newerString;
   3.237 +	newerString = @"2.0svn200";
   3.238 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than Development version (%@)", olderString, newerString);
   3.239 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.240 +}
   3.241 +
   3.242 +#pragma mark Testing 1.0-to-0.5 conversion
   3.243 +
   3.244 +- (void) test1_0EqualTo0_5 {
   3.245 +	NSString *stringA = @"1.0", *stringB = @"0.5";
   3.246 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Untranslated version number (%@) must be equal to translated 0.5 (%@)", stringA, stringB);
   3.247 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringB, stringA), (CFComparisonResult)kCFCompareEqualTo, @"Translated 0.5 (%@) must be equal to untranslated version number (%@)", stringB, stringA);
   3.248 +}
   3.249 +- (void) test1_0NewerThan0_6 {
   3.250 +	NSString *olderString = @"1.0", *newerString = @"0.6";
   3.251 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Translated 0.5 (%@) must be greater than untranslated version number (%@)", olderString, newerString);
   3.252 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Untranslated version number (%@) must be less than translated 0.5 (%@)", newerString, olderString);
   3.253 +}
   3.254 +- (void) test1_0OlderThan0_4 {
   3.255 +	NSString *olderString = @"0.4", *newerString = @"1.0";
   3.256 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Untranslated version number (%@) must be less than translated 0.5 (%@)", olderString, newerString);
   3.257 +	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Translated 0.5 (%@) must be greater than untranslated version number (%@)", newerString, olderString);
   3.258 +}
   3.259 +
   3.260 +@end