Commits

Peter Hosey committed e21dae3

Test cases for the version string comparator that converts "1.0" to 0.5. GVU test coverage is now 96.9%.

Comments (0)

Files changed (3)

Growl.xcodeproj/project.pbxproj

 		0A7F62600767C84E00E1C1E4 /* GrowlMusicVideoWindowView.m in Sources */ = {isa = PBXBuildFile; fileRef = 0A7F62570767C84E00E1C1E4 /* GrowlMusicVideoWindowView.m */; };
 		0AEE179D0702C4960024B1A0 /* ApplicationServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0AEE179C0702C4960024B1A0 /* ApplicationServices.framework */; };
 		31340CDD0D5B8E7100B9BEE0 /* GrowlPropertyListFilePathway.m in Sources */ = {isa = PBXBuildFile; fileRef = 31340CDB0D5B8E7100B9BEE0 /* GrowlPropertyListFilePathway.m */; };
+		31B9BA5C1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m in Sources */ = {isa = PBXBuildFile; fileRef = 31B9BA5B1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m */; };
 		31C7594B1047202B008547BF /* simple-mailer.py in Resources */ = {isa = PBXBuildFile; fileRef = 31C7594A1047202B008547BF /* simple-mailer.py */; };
 		31E184E0108462F30011C78B /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 31E184DF108462F30011C78B /* SenTestingKit.framework */; };
 		31E184F51084632C0011C78B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83282741073A6BD70044A959 /* Cocoa.framework */; };
 		31340CDA0D5B8E7100B9BEE0 /* GrowlPropertyListFilePathway.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GrowlPropertyListFilePathway.h; path = Core/Source/GrowlPropertyListFilePathway.h; sourceTree = "<group>"; };
 		31340CDB0D5B8E7100B9BEE0 /* GrowlPropertyListFilePathway.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = GrowlPropertyListFilePathway.m; path = Core/Source/GrowlPropertyListFilePathway.m; sourceTree = "<group>"; };
 		315C88BB1068F9A200880530 /* Localization.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Localization.xcconfig; path = xcconfig/Localization.xcconfig; sourceTree = "<group>"; };
+		31B9BA5A1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestVersionComparisonBetweenStringsConverting1_0To0_5.h; sourceTree = "<group>"; };
+		31B9BA5B1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestVersionComparisonBetweenStringsConverting1_0To0_5.m; sourceTree = "<group>"; };
 		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; };
 		31E184D61084628D0011C78B /* Unit tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Unit tests.octest"; sourceTree = BUILT_PRODUCTS_DIR; };
 		31E184D71084628D0011C78B /* Unit tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Unit tests-Info.plist"; sourceTree = "<group>"; };
 				31E185E41084A9780011C78B /* TestVersionComparison.m */,
 				31E1863D1084B7500011C78B /* TestVersionComparisonBetweenStrings.h */,
 				31E1863E1084B7500011C78B /* TestVersionComparisonBetweenStrings.m */,
+				31B9BA5A1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.h */,
+				31B9BA5B1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m */,
 			);
 			path = "Unit tests";
 			sourceTree = "<group>";
 				31E18504108465590011C78B /* GrowlVersionUtilities.c in Sources */,
 				31E185E51084A9780011C78B /* TestVersionComparison.m in Sources */,
 				31E1863F1084B7500011C78B /* TestVersionComparisonBetweenStrings.m in Sources */,
+				31B9BA5C1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Unit tests/TestVersionComparisonBetweenStringsConverting1_0To0_5.h

+//
+//  TestVersionComparisonBetweenStringsConverting1_0To0_5.h
+//  Growl
+//
+//  Created by Peter Hosey on 2009-10-13.
+//  Copyright 2009 Peter Hosey. All rights reserved.
+//
+
+#import <SenTestingKit/SenTestingKit.h>
+
+@interface TestVersionComparisonBetweenStringsConverting1_0To0_5 : SenTestCase
+{}
+
+- (void) testSVNVersionNewerThanSVNVersion;
+- (void) testSVNVersionEqualToSVNVersion;
+
+- (void) testDevelopmentVersionNewerThanDevelopmentVersion;
+- (void) testDevelopmentVersionEqualToDevelopmentVersion;
+
+- (void) testAlphaNewerThanAlpha;
+- (void) testAlphaEqualToAlpha;
+
+- (void) testBetaNewerThanBeta;
+- (void) testBetaEqualToBeta;
+
+- (void) testReleaseNewerThanRelease;
+- (void) testReleaseEqualToRelease;
+
+#pragma mark -
+
+- (void) testReleaseNewerThanBeta;
+- (void) testReleaseNewerThanAlpha;
+- (void) testReleaseNewerThanDevelopmentVersion;
+- (void) testReleaseNewerThanSVNVersion;
+
+- (void) testBetaNewerThanAlpha;
+- (void) testBetaNewerThanDevelopmentVersion;
+- (void) testBetaNewerThanSVNVersion;
+
+- (void) testAlphaNewerThanDevelopmentVersion;
+- (void) testAlphaNewerThanSVNVersion;
+
+- (void) testDevelopmentVersionNewerThanSVNVersion;
+
+#pragma mark Testing 1.0-to-0.5 conversion
+
+- (void) test1_0EqualTo0_5;
+- (void) test1_0NewerThan0_6;
+- (void) test1_0OlderThan0_4;
+
+@end

Unit tests/TestVersionComparisonBetweenStringsConverting1_0To0_5.m

+//
+//  TestVersionComparisonBetweenStringsConverting1_0To0_5.m
+//  Growl
+//
+//  Created by Peter Hosey on 2009-10-13.
+//  Copyright 2009 Peter Hosey. All rights reserved.
+//
+
+#import "TestVersionComparisonBetweenStringsConverting1_0To0_5.h"
+
+#import "GrowlVersionUtilities.h"
+
+@implementation TestVersionComparisonBetweenStringsConverting1_0To0_5
+
+- (void) testSVNVersionNewerThanSVNVersion {
+	NSString *olderString = @"1.0svn1000", *newerString = @"1.0svn1009";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
+
+	olderString = @"1.0svn1000";
+	newerString = @"2.5.1svn1009";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
+}
+- (void) testSVNVersionEqualToSVNVersion {
+	NSString *string = @"1.0svn1000";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
+
+	//Version-equal, but not string-equal.
+	NSString *stringA = @"01.00svn01000";
+	NSString *stringB =   @"1.0svn1000";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Version from string %@ must be equal to version from string %@", stringA, stringB);
+}
+
+- (void) testDevelopmentVersionNewerThanDevelopmentVersion {
+	NSString *olderString = @"1.0d10", *newerString = @"1.0d19";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
+
+	//Note that in this case, the development field is *lower*. Earlier development versions of newer releases should always compare newer.
+	olderString = @"1.0d10";
+	newerString = @"2.5.1d5";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
+}
+- (void) testDevelopmentVersionEqualToDevelopmentVersion {
+	NSString *string = @"1.0d10";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
+
+	//Version-equal, but not string-equal.
+	NSString *stringA = @"01.00d010";
+	NSString *stringB =   @"1.0d10";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Version from string %@ must be equal to version from string %@", stringA, stringB);
+}
+
+- (void) testAlphaNewerThanAlpha {
+	NSString *olderString = @"1.0a10", *newerString = @"1.0a19";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
+
+	//Note that in this case, the development field is *lower*. Earlier development versions of newer releases should always compare newer.
+	olderString = @"1.0a10";
+	newerString = @"2.5.1a5";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
+}
+- (void) testAlphaEqualToAlpha {
+	NSString *string = @"1.0a10";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
+
+	//Version-equal, but not string-equal.
+	NSString *stringA = @"01.00a010";
+	NSString *stringB =   @"1.0a10";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Version from string %@ must be equal to version from string %@", stringA, stringB);
+}
+
+- (void) testBetaNewerThanBeta {
+	NSString *olderString = @"1.0b10", *newerString = @"1.0b19";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
+
+	//Note that in this case, the development field is *lower*. Earlier development versions of newer releases should always compare newer.
+	olderString = @"1.0b10";
+	newerString = @"2.5.1b5";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
+}
+- (void) testBetaEqualToBeta {
+	NSString *string = @"1.0b10";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
+
+	//Version-equal, but not string-equal.
+	NSString *stringA = @"01.00b010";
+	NSString *stringB =   @"1.0b10";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Version from string %@ must be equal to version from string %@", stringA, stringB);
+}
+
+- (void) testReleaseNewerThanRelease {
+	NSString *olderString = @"1.0", *newerString = @"1.0.1";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
+
+	olderString = @"1.0";
+	newerString = @"2.5.1";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Older (%@) must be less than newer (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Newer (%@) must be greater than older (%@)", newerString, olderString);
+}
+- (void) testReleaseEqualToRelease {
+	NSString *string = @"1.0";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(string, string), (CFComparisonResult)kCFCompareEqualTo, @"Version string (%@) must be equal to itself", string);
+
+	//Version-equal, but not string-equal.
+	//Only "1.0" gets translated to 0.5. Other ways of expressing 1.0 remain verbatim.
+	NSString *stringA = @"01.00.0";
+	NSString *stringB =  @"1.0";
+	STAssertFalse(compareVersionStringsTranslating1_0To0_5(stringA, stringB) == kCFCompareEqualTo, @"Version from string %@ must be in equal to (translated 0.5) version from string %@", stringA, stringB);
+}
+
+#pragma mark -
+
+- (void) testReleaseNewerThanBeta {
+	NSString *olderString = @"2.0b5", *newerString = @"2.0";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Beta (%@) must be less than release (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than beta (%@)", newerString, olderString);
+
+	//Inverse: Make sure an earlier beta of a later release compares as newer.
+	olderString = newerString;
+	newerString = @"3.0b2";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Beta (%@) must be less than release (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than beta (%@)", newerString, olderString);
+}
+- (void) testReleaseNewerThanAlpha {
+	NSString *olderString = @"2.0a5", *newerString = @"2.0";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Alpha (%@) must be less than release (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than alpha (%@)", newerString, olderString);
+
+	//Inverse: Make sure an earlier alpha of a later release compares as newer.
+	olderString = newerString;
+	newerString = @"3.0a2";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Beta (%@) must be less than release (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than beta (%@)", newerString, olderString);
+}
+- (void) testReleaseNewerThanDevelopmentVersion {
+	NSString *olderString = @"2.0d5", *newerString = @"2.0";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than release (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than development version (%@)", newerString, olderString);
+
+	//Inverse: Make sure an earlier development version of a later release compares as newer.
+	olderString = newerString;
+	newerString = @"3.0d2";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than release (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than development version (%@)", newerString, olderString);
+}
+- (void) testReleaseNewerThanSVNVersion {
+	NSString *olderString = @"2.0svn500", *newerString = @"2.0";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than release (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than SVN version (%@)", newerString, olderString);
+
+	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
+	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
+	olderString = newerString;
+	newerString = @"3.0svn200";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than release (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than SVN version (%@)", newerString, olderString);
+}
+
+- (void) testBetaNewerThanAlpha {
+	NSString *olderString = @"1.0a5", *newerString = @"1.0b4";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Alpha (%@) must be less than beta (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than alpha (%@)", newerString, olderString);
+
+	//Inverse: Make sure an earlier alpha of a later release compares as newer.
+	olderString = newerString;
+	newerString = @"2.0a2";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Alpha (%@) must be less than beta (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than alpha (%@)", newerString, olderString);
+}
+- (void) testBetaNewerThanDevelopmentVersion {
+	NSString *olderString = @"1.0d5", *newerString = @"1.0b4";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than beta (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than development version (%@)", newerString, olderString);
+
+	//Inverse: Make sure an earlier development version of a later release compares as newer.
+	olderString = newerString;
+	newerString = @"2.0d2";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than beta (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than development version (%@)", newerString, olderString);
+}
+- (void) testBetaNewerThanSVNVersion {
+	NSString *olderString = @"1.0svn500", *newerString = @"1.0b4";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than beta (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than SVN version (%@)", newerString, olderString);
+
+	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
+	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
+	olderString = newerString;
+	newerString = @"2.0svn200";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than beta (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Beta (%@) must be greater than SVN version (%@)", newerString, olderString);
+}
+
+- (void) testAlphaNewerThanDevelopmentVersion {
+	NSString *olderString = @"1.0d5", *newerString = @"1.0a4";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than alpha (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than development version (%@)", newerString, olderString);
+
+	//Inverse: Make sure an earlier development version of a later release compares as newer.
+	olderString = newerString;
+	newerString = @"2.0d2";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Development version (%@) must be less than alpha (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than development version (%@)", newerString, olderString);
+}
+- (void) testAlphaNewerThanSVNVersion {
+	NSString *olderString = @"1.0svn500", *newerString = @"1.0a4";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than alpha (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than SVN version (%@)", newerString, olderString);
+
+	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
+	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
+	olderString = newerString;
+	newerString = @"2.0svn200";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than alpha (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Alpha (%@) must be greater than SVN version (%@)", newerString, olderString);
+}
+
+- (void) testDevelopmentVersionNewerThanSVNVersion {
+	NSString *olderString = @"1.0svn500", *newerString = @"1.0d4";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than development version (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Development version (%@) must be greater than SVN version (%@)", newerString, olderString);
+
+	//Inverse: Make sure an earlier SVN version of a later release compares as newer.
+	//(This can happen in the case of reviving a maintenance branch for an emergency fix.)
+	olderString = newerString;
+	newerString = @"2.0svn200";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"SVN version (%@) must be less than Development version (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Release (%@) must be greater than SVN version (%@)", newerString, olderString);
+}
+
+#pragma mark Testing 1.0-to-0.5 conversion
+
+- (void) test1_0EqualTo0_5 {
+	NSString *stringA = @"1.0", *stringB = @"0.5";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringA, stringB), (CFComparisonResult)kCFCompareEqualTo, @"Untranslated version number (%@) must be equal to translated 0.5 (%@)", stringA, stringB);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(stringB, stringA), (CFComparisonResult)kCFCompareEqualTo, @"Translated 0.5 (%@) must be equal to untranslated version number (%@)", stringB, stringA);
+}
+- (void) test1_0NewerThan0_6 {
+	NSString *olderString = @"1.0", *newerString = @"0.6";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Translated 0.5 (%@) must be greater than untranslated version number (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Untranslated version number (%@) must be less than translated 0.5 (%@)", newerString, olderString);
+}
+- (void) test1_0OlderThan0_4 {
+	NSString *olderString = @"0.4", *newerString = @"1.0";
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(olderString, newerString), (CFComparisonResult)kCFCompareLessThan, @"Untranslated version number (%@) must be less than translated 0.5 (%@)", olderString, newerString);
+	STAssertEquals(compareVersionStringsTranslating1_0To0_5(newerString, olderString), (CFComparisonResult)kCFCompareGreaterThan, @"Translated 0.5 (%@) must be greater than untranslated version number (%@)", newerString, olderString);
+}
+
+@end