Test cases for version unparsing. 28 failures across all both architectures and GC states.
authorPeter Hosey <hg@boredzo.org>
Thu Oct 15 21:27:37 2009 -0700 (2009-10-15)
changeset 45284a9574d9aaa9
parent 4526 990a94a64eb6
child 4529 40f6776be4ce
Test cases for version unparsing. 28 failures across all both architectures and GC states.
Growl.xcodeproj/project.pbxproj
Unit tests/TestVersionUnparsing.h
Unit tests/TestVersionUnparsing.m
     1.1 --- a/Growl.xcodeproj/project.pbxproj	Thu Oct 15 16:16:29 2009 -0700
     1.2 +++ b/Growl.xcodeproj/project.pbxproj	Thu Oct 15 21:27:37 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 +		318984C5108825F10086E973 /* TestVersionUnparsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 318984C4108825F10086E973 /* TestVersionUnparsing.m */; };
     1.8  		31B9BA5C1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m in Sources */ = {isa = PBXBuildFile; fileRef = 31B9BA5B1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m */; };
     1.9  		31C7594B1047202B008547BF /* simple-mailer.py in Resources */ = {isa = PBXBuildFile; fileRef = 31C7594A1047202B008547BF /* simple-mailer.py */; };
    1.10  		31E184E0108462F30011C78B /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 31E184DF108462F30011C78B /* SenTestingKit.framework */; };
    1.11 @@ -693,6 +694,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 +		318984C3108825F10086E973 /* TestVersionUnparsing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestVersionUnparsing.h; sourceTree = "<group>"; };
    1.16 +		318984C4108825F10086E973 /* TestVersionUnparsing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestVersionUnparsing.m; sourceTree = "<group>"; };
    1.17  		31B9BA5A1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestVersionComparisonBetweenStringsConverting1_0To0_5.h; sourceTree = "<group>"; };
    1.18  		31B9BA5B1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestVersionComparisonBetweenStringsConverting1_0To0_5.m; sourceTree = "<group>"; };
    1.19  		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.20 @@ -1741,6 +1744,8 @@
    1.21  				31E1863E1084B7500011C78B /* TestVersionComparisonBetweenStrings.m */,
    1.22  				31B9BA5A1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.h */,
    1.23  				31B9BA5B1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m */,
    1.24 +				318984C3108825F10086E973 /* TestVersionUnparsing.h */,
    1.25 +				318984C4108825F10086E973 /* TestVersionUnparsing.m */,
    1.26  			);
    1.27  			path = "Unit tests";
    1.28  			sourceTree = "<group>";
    1.29 @@ -2870,6 +2875,7 @@
    1.30  				31E185E51084A9780011C78B /* TestVersionComparison.m in Sources */,
    1.31  				31E1863F1084B7500011C78B /* TestVersionComparisonBetweenStrings.m in Sources */,
    1.32  				31B9BA5C1086C4CA007DA1E2 /* TestVersionComparisonBetweenStringsConverting1_0To0_5.m in Sources */,
    1.33 +				318984C5108825F10086E973 /* TestVersionUnparsing.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/TestVersionUnparsing.h	Thu Oct 15 21:27:37 2009 -0700
     2.3 @@ -0,0 +1,29 @@
     2.4 +//
     2.5 +//  TestVersionUnparsing.h
     2.6 +//  Growl
     2.7 +//
     2.8 +//  Created by Peter Hosey on 2009-10-15.
     2.9 +//  Copyright 2009 Peter Hosey. All rights reserved.
    2.10 +//
    2.11 +
    2.12 +#import <SenTestingKit/SenTestingKit.h>
    2.13 +
    2.14 +@interface TestVersionUnparsing : SenTestCase {
    2.15 +
    2.16 +}
    2.17 +
    2.18 +- (void) testUnparsingTwoComponentHgVersion;
    2.19 +- (void) testUnparsingTwoComponentDevelopmentVersion;
    2.20 +- (void) testUnparsingTwoComponentAlphaVersion;
    2.21 +- (void) testUnparsingTwoComponentBetaVersion;
    2.22 +- (void) testUnparsingTwoComponentReleaseVersion;
    2.23 +
    2.24 +- (void) testUnparsingThreeComponentHgVersion;
    2.25 +- (void) testUnparsingThreeComponentDevelopmentVersion;
    2.26 +- (void) testUnparsingThreeComponentAlphaVersion;
    2.27 +- (void) testUnparsingThreeComponentBetaVersion;
    2.28 +- (void) testUnparsingThreeComponentReleaseVersion;
    2.29 +
    2.30 +- (void) testUnparsingVersionWithBogusReleaseType;
    2.31 +
    2.32 +@end
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Unit tests/TestVersionUnparsing.m	Thu Oct 15 21:27:37 2009 -0700
     3.3 @@ -0,0 +1,180 @@
     3.4 +//
     3.5 +//  TestVersionUnparsing.m
     3.6 +//  Growl
     3.7 +//
     3.8 +//  Created by Peter Hosey on 2009-10-15.
     3.9 +//  Copyright 2009 Peter Hosey. All rights reserved.
    3.10 +//
    3.11 +
    3.12 +#import "TestVersionUnparsing.h"
    3.13 +
    3.14 +#import "GrowlVersionUtilities.h"
    3.15 +
    3.16 +@implementation TestVersionUnparsing
    3.17 +
    3.18 +- (void) testUnparsingTwoComponentHgVersion {
    3.19 +	struct Version version = {
    3.20 +		1U,
    3.21 +		3U,
    3.22 +		0U,
    3.23 +		releaseType_svn,
    3.24 +		4000U
    3.25 +	};
    3.26 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
    3.27 +
    3.28 +	STAssertNotNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned nil", version.major, version.minor, version.incremental, version.releaseType, version.development);
    3.29 +
    3.30 +	NSString *correctVersionString = @"1.3hg4000";
    3.31 +	STAssertEqualObjects(versionString, correctVersionString, @"Version string for %@ was %@", correctVersionString, versionString);
    3.32 +}
    3.33 +- (void) testUnparsingTwoComponentDevelopmentVersion {
    3.34 +	struct Version version = {
    3.35 +		1U,
    3.36 +		3U,
    3.37 +		0U,
    3.38 +		releaseType_development,
    3.39 +		7U
    3.40 +	};
    3.41 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
    3.42 +
    3.43 +	STAssertNotNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned nil", version.major, version.minor, version.incremental, version.releaseType, version.development);
    3.44 +
    3.45 +	NSString *correctVersionString = @"1.3d7";
    3.46 +	STAssertEqualObjects(versionString, correctVersionString, @"Version string for %@ was %@", correctVersionString, versionString);
    3.47 +}
    3.48 +- (void) testUnparsingTwoComponentAlphaVersion {
    3.49 +	struct Version version = {
    3.50 +		1U,
    3.51 +		3U,
    3.52 +		0U,
    3.53 +		releaseType_alpha,
    3.54 +		7U
    3.55 +	};
    3.56 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
    3.57 +
    3.58 +	STAssertNotNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned nil", version.major, version.minor, version.incremental, version.releaseType, version.development);
    3.59 +
    3.60 +	NSString *correctVersionString = @"1.3a7";
    3.61 +	STAssertEqualObjects(versionString, correctVersionString, @"Version string for %@ was %@", correctVersionString, versionString);
    3.62 +}
    3.63 +- (void) testUnparsingTwoComponentBetaVersion {
    3.64 +	struct Version version = {
    3.65 +		1U,
    3.66 +		3U,
    3.67 +		0U,
    3.68 +		releaseType_beta,
    3.69 +		7U
    3.70 +	};
    3.71 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
    3.72 +
    3.73 +	STAssertNotNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned nil", version.major, version.minor, version.incremental, version.releaseType, version.development);
    3.74 +
    3.75 +	NSString *correctVersionString = @"1.3b7";
    3.76 +	STAssertEqualObjects(versionString, correctVersionString, @"Version string for %@ was %@", correctVersionString, versionString);
    3.77 +}
    3.78 +- (void) testUnparsingTwoComponentReleaseVersion {
    3.79 +	struct Version version = {
    3.80 +		1U,
    3.81 +		3U,
    3.82 +		0U,
    3.83 +		releaseType_release,
    3.84 +		0U
    3.85 +	};
    3.86 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
    3.87 +
    3.88 +	STAssertNotNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned nil", version.major, version.minor, version.incremental, version.releaseType, version.development);
    3.89 +
    3.90 +	NSString *correctVersionString = @"1.3";
    3.91 +	STAssertEqualObjects(versionString, correctVersionString, @"Version string for %@ was %@", correctVersionString, versionString);
    3.92 +}
    3.93 +
    3.94 +- (void) testUnparsingThreeComponentHgVersion {
    3.95 +	struct Version version = {
    3.96 +		1U,
    3.97 +		3U,
    3.98 +		5U,
    3.99 +		releaseType_svn,
   3.100 +		4000U
   3.101 +	};
   3.102 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
   3.103 +
   3.104 +	STAssertNotNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned nil", version.major, version.minor, version.incremental, version.releaseType, version.development);
   3.105 +
   3.106 +	NSString *correctVersionString = @"1.3.5hg4000";
   3.107 +	STAssertEqualObjects(versionString, correctVersionString, @"Version string for %@ was %@", correctVersionString, versionString);
   3.108 +}
   3.109 +- (void) testUnparsingThreeComponentDevelopmentVersion {
   3.110 +	struct Version version = {
   3.111 +		1U,
   3.112 +		3U,
   3.113 +		5U,
   3.114 +		releaseType_development,
   3.115 +		7U
   3.116 +	};
   3.117 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
   3.118 +
   3.119 +	STAssertNotNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned nil", version.major, version.minor, version.incremental, version.releaseType, version.development);
   3.120 +
   3.121 +	NSString *correctVersionString = @"1.3.5d7";
   3.122 +	STAssertEqualObjects(versionString, correctVersionString, @"Version string for %@ was %@", correctVersionString, versionString);
   3.123 +}
   3.124 +- (void) testUnparsingThreeComponentAlphaVersion {
   3.125 +	struct Version version = {
   3.126 +		1U,
   3.127 +		3U,
   3.128 +		5U,
   3.129 +		releaseType_alpha,
   3.130 +		7U
   3.131 +	};
   3.132 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
   3.133 +
   3.134 +	STAssertNotNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned nil", version.major, version.minor, version.incremental, version.releaseType, version.development);
   3.135 +
   3.136 +	NSString *correctVersionString = @"1.3.5a7";
   3.137 +	STAssertEqualObjects(versionString, correctVersionString, @"Version string for %@ was %@", correctVersionString, versionString);
   3.138 +}
   3.139 +- (void) testUnparsingThreeComponentBetaVersion {
   3.140 +	struct Version version = {
   3.141 +		1U,
   3.142 +		3U,
   3.143 +		5U,
   3.144 +		releaseType_beta,
   3.145 +		7U
   3.146 +	};
   3.147 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
   3.148 +
   3.149 +	STAssertNotNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned nil", version.major, version.minor, version.incremental, version.releaseType, version.development);
   3.150 +
   3.151 +	NSString *correctVersionString = @"1.3.5b7";
   3.152 +	STAssertEqualObjects(versionString, correctVersionString, @"Version string for %@ was %@", correctVersionString, versionString);
   3.153 +}
   3.154 +- (void) testUnparsingThreeComponentReleaseVersion {
   3.155 +	struct Version version = {
   3.156 +		1U,
   3.157 +		3U,
   3.158 +		5U,
   3.159 +		releaseType_release,
   3.160 +		0U
   3.161 +	};
   3.162 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
   3.163 +
   3.164 +	STAssertNotNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned nil", version.major, version.minor, version.incremental, version.releaseType, version.development);
   3.165 +
   3.166 +	NSString *correctVersionString = @"1.3.5";
   3.167 +	STAssertEqualObjects(versionString, correctVersionString, @"Version string for %@ was %@", correctVersionString, versionString);
   3.168 +}
   3.169 +
   3.170 +- (void) testUnparsingVersionWithBogusReleaseType {
   3.171 +	struct Version version = {
   3.172 +		1U,
   3.173 +		3U,
   3.174 +		5U,
   3.175 +		numberOfReleaseTypes,
   3.176 +		0U
   3.177 +	};
   3.178 +	NSString *versionString = [NSMakeCollectable(createVersionDescription(version)) autorelease];
   3.179 +
   3.180 +	STAssertNil(versionString, @"createVersionDescription((struct Version){ %hu, %hu, %hhu, %hhu, %hhu }) returned %@", version.major, version.minor, version.incremental, version.releaseType, version.development, versionString);
   3.181 +}
   3.182 +
   3.183 +@end