Added test cases for comparing version strings. All pass.
authorPeter Hosey <hg@boredzo.org>
Tue Oct 13 06:31:59 2009 -0700 (2009-10-13)
changeset 4520ec1cf41d2ca4
parent 4519 ae36d1878499
child 4521 273618d372b1
Added test cases for comparing version strings. All pass.
Growl.xcodeproj/project.pbxproj
Unit tests/TestVersionComparisonBetweenStrings.h
Unit tests/TestVersionComparisonBetweenStrings.m
     1.1 --- a/Growl.xcodeproj/project.pbxproj	Tue Oct 13 06:24:50 2009 -0700
     1.2 +++ b/Growl.xcodeproj/project.pbxproj	Tue Oct 13 06:31:59 2009 -0700
     1.3 @@ -102,6 +102,7 @@
     1.4  		31E18503108463E60011C78B /* TestVersionParsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 31E18502108463E60011C78B /* TestVersionParsing.m */; };
     1.5  		31E18504108465590011C78B /* GrowlVersionUtilities.c in Sources */ = {isa = PBXBuildFile; fileRef = 0790135507D9321B0023B640 /* GrowlVersionUtilities.c */; };
     1.6  		31E185E51084A9780011C78B /* TestVersionComparison.m in Sources */ = {isa = PBXBuildFile; fileRef = 31E185E41084A9780011C78B /* TestVersionComparison.m */; };
     1.7 +		31E1863F1084B7500011C78B /* TestVersionComparisonBetweenStrings.m in Sources */ = {isa = PBXBuildFile; fileRef = 31E1863E1084B7500011C78B /* TestVersionComparisonBetweenStrings.m */; };
     1.8  		342157C00C2AE377004003BB /* PriorityTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 342157BE0C2AE377004003BB /* PriorityTransformer.m */; };
     1.9  		3433456E0790E39200C84B15 /* Bubbles.growlView in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0AB508AE0767C87B006EA5CB /* Bubbles.growlView */; };
    1.10  		343345880790E3D600C84B15 /* Smoke.growlView in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0AB508AF0767C87B006EA5CB /* Smoke.growlView */; };
    1.11 @@ -700,6 +701,8 @@
    1.12  		31E1852A108469460011C78B /* UnitTests-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UnitTests-Prefix.pch"; sourceTree = "<group>"; };
    1.13  		31E185E31084A9780011C78B /* TestVersionComparison.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestVersionComparison.h; sourceTree = "<group>"; };
    1.14  		31E185E41084A9780011C78B /* TestVersionComparison.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestVersionComparison.m; sourceTree = "<group>"; };
    1.15 +		31E1863D1084B7500011C78B /* TestVersionComparisonBetweenStrings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestVersionComparisonBetweenStrings.h; sourceTree = "<group>"; };
    1.16 +		31E1863E1084B7500011C78B /* TestVersionComparisonBetweenStrings.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestVersionComparisonBetweenStrings.m; sourceTree = "<group>"; };
    1.17  		32DBCFA20370C41700C91783 /* Growl_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Growl_Prefix.pch; path = Core/Source/Growl_Prefix.pch; sourceTree = "<group>"; };
    1.18  		342157BD0C2AE377004003BB /* PriorityTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PriorityTransformer.h; path = Core/Source/PriorityTransformer.h; sourceTree = "<group>"; };
    1.19  		342157BE0C2AE377004003BB /* PriorityTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PriorityTransformer.m; path = Core/Source/PriorityTransformer.m; sourceTree = "<group>"; };
    1.20 @@ -1731,6 +1734,8 @@
    1.21  				31E18502108463E60011C78B /* TestVersionParsing.m */,
    1.22  				31E185E31084A9780011C78B /* TestVersionComparison.h */,
    1.23  				31E185E41084A9780011C78B /* TestVersionComparison.m */,
    1.24 +				31E1863D1084B7500011C78B /* TestVersionComparisonBetweenStrings.h */,
    1.25 +				31E1863E1084B7500011C78B /* TestVersionComparisonBetweenStrings.m */,
    1.26  			);
    1.27  			path = "Unit tests";
    1.28  			sourceTree = "<group>";
    1.29 @@ -2858,6 +2863,7 @@
    1.30  				31E18503108463E60011C78B /* TestVersionParsing.m in Sources */,
    1.31  				31E18504108465590011C78B /* GrowlVersionUtilities.c in Sources */,
    1.32  				31E185E51084A9780011C78B /* TestVersionComparison.m in Sources */,
    1.33 +				31E1863F1084B7500011C78B /* TestVersionComparisonBetweenStrings.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/TestVersionComparisonBetweenStrings.h	Tue Oct 13 06:31:59 2009 -0700
     2.3 @@ -0,0 +1,45 @@
     2.4 +//
     2.5 +//  TestVersionComparisonBetweenStrings.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 TestVersionComparisonBetweenStrings : 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 +@end
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Unit tests/TestVersionComparisonBetweenStrings.m	Tue Oct 13 06:31:59 2009 -0700
     3.3 @@ -0,0 +1,238 @@
     3.4 +//
     3.5 +//  TestVersionComparisonBetweenStrings.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 "TestVersionComparisonBetweenStrings.h"
    3.13 +
    3.14 +#import "GrowlVersionUtilities.h"
    3.15 +
    3.16 +@implementation TestVersionComparisonBetweenStrings
    3.17 +
    3.18 +- (void) testSVNVersionNewerThanSVNVersion {
    3.19 +	NSString *olderString = @"1.0svn1000", *newerString = @"1.0svn1009";
    3.20 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.21 +	STAssertEquals(compareVersionStrings(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(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.26 +	STAssertEquals(compareVersionStrings(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(compareVersionStrings(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(compareVersionStrings(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(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.41 +	STAssertEquals(compareVersionStrings(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(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.47 +	STAssertEquals(compareVersionStrings(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(compareVersionStrings(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(compareVersionStrings(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(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.62 +	STAssertEquals(compareVersionStrings(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(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.68 +	STAssertEquals(compareVersionStrings(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(compareVersionStrings(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(compareVersionStrings(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(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.83 +	STAssertEquals(compareVersionStrings(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(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
    3.89 +	STAssertEquals(compareVersionStrings(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(compareVersionStrings(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(compareVersionStrings(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(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
   3.104 +	STAssertEquals(compareVersionStrings(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(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
   3.109 +	STAssertEquals(compareVersionStrings(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(compareVersionStrings(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
   3.114 +
   3.115 +	//Version-equal, but not string-equal.
   3.116 +	NSString *stringA = @"01.00.0";
   3.117 +	NSString *stringB =  @"1.0";
   3.118 +	STAssertEquals(compareVersionStrings(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Version from string %@ must be equal to version from string %@", stringA, stringB);
   3.119 +}
   3.120 +
   3.121 +#pragma mark -
   3.122 +
   3.123 +- (void) testReleaseNewerThanBeta {
   3.124 +	NSString *olderString = @"1.0b5", *newerString = @"1.0";
   3.125 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Beta (%@) must be less than release (%@)", olderString, newerString);
   3.126 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than beta (%@)", newerString, olderString);
   3.127 +
   3.128 +	//Inverse: Make sure an earlier beta of a later release compares as newer.
   3.129 +	olderString = newerString;
   3.130 +	newerString = @"2.0b2";
   3.131 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Beta (%@) must be less than release (%@)", olderString, newerString);
   3.132 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than beta (%@)", newerString, olderString);
   3.133 +}
   3.134 +- (void) testReleaseNewerThanAlpha {
   3.135 +	NSString *olderString = @"1.0a5", *newerString = @"1.0";
   3.136 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Alpha (%@) must be less than release (%@)", olderString, newerString);
   3.137 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than alpha (%@)", newerString, olderString);
   3.138 +
   3.139 +	//Inverse: Make sure an earlier alpha of a later release compares as newer.
   3.140 +	olderString = newerString;
   3.141 +	newerString = @"2.0a2";
   3.142 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Beta (%@) must be less than release (%@)", olderString, newerString);
   3.143 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than beta (%@)", newerString, olderString);
   3.144 +}
   3.145 +- (void) testReleaseNewerThanDevelopmentVersion {
   3.146 +	NSString *olderString = @"1.0d5", *newerString = @"1.0";
   3.147 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than release (%@)", olderString, newerString);
   3.148 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than development version (%@)", newerString, olderString);
   3.149 +
   3.150 +	//Inverse: Make sure an earlier development version of a later release compares as newer.
   3.151 +	olderString = newerString;
   3.152 +	newerString = @"2.0d2";
   3.153 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than release (%@)", olderString, newerString);
   3.154 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than development version (%@)", newerString, olderString);
   3.155 +}
   3.156 +- (void) testReleaseNewerThanSVNVersion {
   3.157 +	NSString *olderString = @"1.0svn500", *newerString = @"1.0";
   3.158 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than release (%@)", olderString, newerString);
   3.159 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.160 +
   3.161 +	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
   3.162 +	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
   3.163 +	olderString = newerString;
   3.164 +	newerString = @"2.0svn200";
   3.165 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than release (%@)", olderString, newerString);
   3.166 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.167 +}
   3.168 +
   3.169 +- (void) testBetaNewerThanAlpha {
   3.170 +	NSString *olderString = @"1.0a5", *newerString = @"1.0b4";
   3.171 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Alpha (%@) must be less than beta (%@)", olderString, newerString);
   3.172 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than alpha (%@)", newerString, olderString);
   3.173 +
   3.174 +	//Inverse: Make sure an earlier alpha of a later release compares as newer.
   3.175 +	olderString = newerString;
   3.176 +	newerString = @"2.0a2";
   3.177 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Alpha (%@) must be less than beta (%@)", olderString, newerString);
   3.178 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than alpha (%@)", newerString, olderString);
   3.179 +}
   3.180 +- (void) testBetaNewerThanDevelopmentVersion {
   3.181 +	NSString *olderString = @"1.0d5", *newerString = @"1.0b4";
   3.182 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than beta (%@)", olderString, newerString);
   3.183 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than development version (%@)", newerString, olderString);
   3.184 +
   3.185 +	//Inverse: Make sure an earlier development version of a later release compares as newer.
   3.186 +	olderString = newerString;
   3.187 +	newerString = @"2.0d2";
   3.188 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than beta (%@)", olderString, newerString);
   3.189 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than development version (%@)", newerString, olderString);
   3.190 +}
   3.191 +- (void) testBetaNewerThanSVNVersion {
   3.192 +	NSString *olderString = @"1.0svn500", *newerString = @"1.0b4";
   3.193 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than beta (%@)", olderString, newerString);
   3.194 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.195 +
   3.196 +	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
   3.197 +	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
   3.198 +	olderString = newerString;
   3.199 +	newerString = @"2.0svn200";
   3.200 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than beta (%@)", olderString, newerString);
   3.201 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.202 +}
   3.203 +
   3.204 +- (void) testAlphaNewerThanDevelopmentVersion {
   3.205 +	NSString *olderString = @"1.0d5", *newerString = @"1.0a4";
   3.206 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than alpha (%@)", olderString, newerString);
   3.207 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than development version (%@)", newerString, olderString);
   3.208 +
   3.209 +	//Inverse: Make sure an earlier development version of a later release compares as newer.
   3.210 +	olderString = newerString;
   3.211 +	newerString = @"2.0d2";
   3.212 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than alpha (%@)", olderString, newerString);
   3.213 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than development version (%@)", newerString, olderString);
   3.214 +}
   3.215 +- (void) testAlphaNewerThanSVNVersion {
   3.216 +	NSString *olderString = @"1.0svn500", *newerString = @"1.0a4";
   3.217 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than alpha (%@)", olderString, newerString);
   3.218 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.219 +
   3.220 +	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
   3.221 +	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
   3.222 +	olderString = newerString;
   3.223 +	newerString = @"2.0svn200";
   3.224 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than alpha (%@)", olderString, newerString);
   3.225 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.226 +}
   3.227 +
   3.228 +- (void) testDevelopmentVersionNewerThanSVNVersion {
   3.229 +	NSString *olderString = @"1.0svn500", *newerString = @"1.0d4";
   3.230 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than development version (%@)", olderString, newerString);
   3.231 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Development version (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.232 +
   3.233 +	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
   3.234 +	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
   3.235 +	olderString = newerString;
   3.236 +	newerString = @"2.0svn200";
   3.237 +	STAssertEquals(compareVersionStrings(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than Development version (%@)", olderString, newerString);
   3.238 +	STAssertEquals(compareVersionStrings(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than SVN version (%@)", newerString, olderString);
   3.239 +}
   3.240 +
   3.241 +@end