Renaming TestVersionUtilities to TestVersionParsing, in order that this class represents one complete test suite.
authorPeter Hosey <hg@boredzo.org>
Tue Oct 13 05:24:15 2009 -0700 (2009-10-13)
changeset 45174afa80e74a25
parent 4516 dac1afb94166
child 4518 cf3cc57fd5f7
Renaming TestVersionUtilities to TestVersionParsing, in order that this class represents one complete test suite.
Growl.xcodeproj/project.pbxproj
Unit tests/TestVersionParsing.h
Unit tests/TestVersionParsing.m
Unit tests/TestVersionUtilities.h
Unit tests/TestVersionUtilities.m
     1.1 --- a/Growl.xcodeproj/project.pbxproj	Tue Oct 13 02:34:28 2009 -0700
     1.2 +++ b/Growl.xcodeproj/project.pbxproj	Tue Oct 13 05:24:15 2009 -0700
     1.3 @@ -99,7 +99,7 @@
     1.4  		31C7594B1047202B008547BF /* simple-mailer.py in Resources */ = {isa = PBXBuildFile; fileRef = 31C7594A1047202B008547BF /* simple-mailer.py */; };
     1.5  		31E184E0108462F30011C78B /* SenTestingKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 31E184DF108462F30011C78B /* SenTestingKit.framework */; };
     1.6  		31E184F51084632C0011C78B /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 83282741073A6BD70044A959 /* Cocoa.framework */; };
     1.7 -		31E18503108463E60011C78B /* TestVersionUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 31E18502108463E60011C78B /* TestVersionUtilities.m */; };
     1.8 +		31E18503108463E60011C78B /* TestVersionParsing.m in Sources */ = {isa = PBXBuildFile; fileRef = 31E18502108463E60011C78B /* TestVersionParsing.m */; };
     1.9  		31E18504108465590011C78B /* GrowlVersionUtilities.c in Sources */ = {isa = PBXBuildFile; fileRef = 0790135507D9321B0023B640 /* GrowlVersionUtilities.c */; };
    1.10  		342157C00C2AE377004003BB /* PriorityTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 342157BE0C2AE377004003BB /* PriorityTransformer.m */; };
    1.11  		3433456E0790E39200C84B15 /* Bubbles.growlView in CopyFiles */ = {isa = PBXBuildFile; fileRef = 0AB508AE0767C87B006EA5CB /* Bubbles.growlView */; };
    1.12 @@ -694,8 +694,8 @@
    1.13  		31E184D61084628D0011C78B /* Unit tests.octest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Unit tests.octest"; sourceTree = BUILT_PRODUCTS_DIR; };
    1.14  		31E184D71084628D0011C78B /* Unit tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "Unit tests-Info.plist"; path = "Unit tests/Unit tests-Info.plist"; sourceTree = "<group>"; };
    1.15  		31E184DF108462F30011C78B /* SenTestingKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SenTestingKit.framework; path = Library/Frameworks/SenTestingKit.framework; sourceTree = DEVELOPER_DIR; };
    1.16 -		31E18501108463E60011C78B /* TestVersionUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestVersionUtilities.h; path = "Unit tests/TestVersionUtilities.h"; sourceTree = "<group>"; };
    1.17 -		31E18502108463E60011C78B /* TestVersionUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TestVersionUtilities.m; path = "Unit tests/TestVersionUtilities.m"; sourceTree = "<group>"; };
    1.18 +		31E18501108463E60011C78B /* TestVersionParsing.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TestVersionParsing.h; path = "Unit tests/TestVersionParsing.h"; sourceTree = "<group>"; };
    1.19 +		31E18502108463E60011C78B /* TestVersionParsing.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TestVersionParsing.m; path = "Unit tests/TestVersionParsing.m"; sourceTree = "<group>"; };
    1.20  		31E1852A108469460011C78B /* UnitTests-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UnitTests-Prefix.pch"; path = "Unit tests/UnitTests-Prefix.pch"; sourceTree = "<group>"; };
    1.21  		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.22  		342157BD0C2AE377004003BB /* PriorityTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PriorityTransformer.h; path = Core/Source/PriorityTransformer.h; sourceTree = "<group>"; };
    1.23 @@ -1724,8 +1724,8 @@
    1.24  			children = (
    1.25  				31E184D71084628D0011C78B /* Unit tests-Info.plist */,
    1.26  				31E1852A108469460011C78B /* UnitTests-Prefix.pch */,
    1.27 -				31E18501108463E60011C78B /* TestVersionUtilities.h */,
    1.28 -				31E18502108463E60011C78B /* TestVersionUtilities.m */,
    1.29 +				31E18501108463E60011C78B /* TestVersionParsing.h */,
    1.30 +				31E18502108463E60011C78B /* TestVersionParsing.m */,
    1.31  			);
    1.32  			name = "Test cases";
    1.33  			sourceTree = "<group>";
    1.34 @@ -2850,7 +2850,7 @@
    1.35  			isa = PBXSourcesBuildPhase;
    1.36  			buildActionMask = 2147483647;
    1.37  			files = (
    1.38 -				31E18503108463E60011C78B /* TestVersionUtilities.m in Sources */,
    1.39 +				31E18503108463E60011C78B /* TestVersionParsing.m in Sources */,
    1.40  				31E18504108465590011C78B /* GrowlVersionUtilities.c in Sources */,
    1.41  			);
    1.42  			runOnlyForDeploymentPostprocessing = 0;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/Unit tests/TestVersionParsing.h	Tue Oct 13 05:24:15 2009 -0700
     2.3 @@ -0,0 +1,29 @@
     2.4 +//
     2.5 +//  TestVersionParsing.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 TestVersionParsing : SenTestCase {
    2.15 +}
    2.16 +
    2.17 +- (void) testParseNil;
    2.18 +- (void) testParseTwoComponentSVNVersion;
    2.19 +- (void) testParseTwoComponentDevelopmentVersion;
    2.20 +- (void) testParseTwoComponentAlphaVersion;
    2.21 +- (void) testParseTwoComponentBetaVersion;
    2.22 +- (void) testParseTwoComponentReleaseVersion;
    2.23 +- (void) testParseThreeComponentSVNVersion;
    2.24 +- (void) testParseThreeComponentDevelopmentVersion;
    2.25 +- (void) testParseThreeComponentAlphaVersion;
    2.26 +- (void) testParseThreeComponentBetaVersion;
    2.27 +- (void) testParseThreeComponentReleaseVersion;
    2.28 +- (void) testParseWord;
    2.29 +- (void) testParseWordFollowedByReleaseVersion;
    2.30 +- (void) testParseReleaseVersionFollowedByWord;
    2.31 +
    2.32 +@end
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/Unit tests/TestVersionParsing.m	Tue Oct 13 05:24:15 2009 -0700
     3.3 @@ -0,0 +1,292 @@
     3.4 +//
     3.5 +//  TestVersionParsing.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 "TestVersionParsing.h"
    3.13 +
    3.14 +#import "GrowlVersionUtilities.h"
    3.15 +
    3.16 +@implementation TestVersionParsing
    3.17 +
    3.18 +#pragma mark Things that should work
    3.19 +
    3.20 +- (void) testParseTwoComponentSVNVersion {
    3.21 +	struct Version version;
    3.22 +	NSString *string = @"1.3svn1400";
    3.23 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    3.24 +	STAssertEquals(
    3.25 +		version.major, (u_int16_t)1,
    3.26 +		@"Major component was %u, not %u",
    3.27 +		version.major, (u_int16_t)1);
    3.28 +	STAssertEquals(
    3.29 +		version.minor, (u_int16_t)3,
    3.30 +		@"Minor component was %u, not %u",
    3.31 +		version.minor, (u_int16_t)3);
    3.32 +	STAssertEquals(
    3.33 +		version.incremental, (u_int8_t)0,
    3.34 +		@"Incremental component was %u, not %u",
    3.35 +		version.incremental, (u_int8_t)0);
    3.36 +	STAssertEquals(
    3.37 +		version.releaseType, (u_int8_t)releaseType_svn,
    3.38 +		@"Release-type component was %u, not %u",
    3.39 +		version.releaseType, (u_int8_t)releaseType_svn);
    3.40 +	STAssertEquals(
    3.41 +		version.development, (u_int32_t)1400,
    3.42 +		@"Development component (SVN revision) was %u, not %u",
    3.43 +		version.development, (u_int32_t)1400);
    3.44 +}
    3.45 +- (void) testParseTwoComponentDevelopmentVersion {
    3.46 +	struct Version version;
    3.47 +	NSString *string = @"1.3d1";
    3.48 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    3.49 +	STAssertEquals(
    3.50 +		version.major, (u_int16_t)1,
    3.51 +		@"Major component was %u, not %u",
    3.52 +		version.major, (u_int16_t)1);
    3.53 +	STAssertEquals(
    3.54 +		version.minor, (u_int16_t)3,
    3.55 +		@"Minor component was %u, not %u",
    3.56 +		version.minor, (u_int16_t)3);
    3.57 +	STAssertEquals(
    3.58 +		version.incremental, (u_int8_t)0,
    3.59 +		@"Incremental component was %u, not %u",
    3.60 +		version.incremental, (u_int8_t)0);
    3.61 +	STAssertEquals(
    3.62 +		version.releaseType, (u_int8_t)releaseType_development,
    3.63 +		@"Release-type component was %u, not %u",
    3.64 +		version.releaseType, (u_int8_t)releaseType_development);
    3.65 +	STAssertEquals(
    3.66 +		version.development, (u_int32_t)1,
    3.67 +		@"Development component was %u, not %u",
    3.68 +		version.development, (u_int32_t)1);
    3.69 +}
    3.70 +- (void) testParseTwoComponentAlphaVersion {
    3.71 +	struct Version version;
    3.72 +	NSString *string = @"1.3a1";
    3.73 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    3.74 +	STAssertEquals(
    3.75 +		version.major, (u_int16_t)1,
    3.76 +		@"Major component was %u, not %u",
    3.77 +		version.major, (u_int16_t)1);
    3.78 +	STAssertEquals(
    3.79 +		version.minor, (u_int16_t)3,
    3.80 +		@"Minor component was %u, not %u",
    3.81 +		version.minor, (u_int16_t)3);
    3.82 +	STAssertEquals(
    3.83 +		version.incremental, (u_int8_t)0,
    3.84 +		@"Incremental component was %u, not %u",
    3.85 +		version.incremental, (u_int8_t)0);
    3.86 +	STAssertEquals(
    3.87 +		version.releaseType, (u_int8_t)releaseType_alpha,
    3.88 +		@"Release-type component was %u, not %u",
    3.89 +		version.releaseType, (u_int8_t)releaseType_alpha);
    3.90 +	STAssertEquals(
    3.91 +		version.development, (u_int32_t)1,
    3.92 +		@"Development component was %u, not %u",
    3.93 +		version.development, (u_int32_t)1);
    3.94 +}
    3.95 +- (void) testParseTwoComponentBetaVersion {
    3.96 +	struct Version version;
    3.97 +	NSString *string = @"1.3b1";
    3.98 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    3.99 +	STAssertEquals(
   3.100 +		version.major, (u_int16_t)1,
   3.101 +		@"Major component was %u, not %u",
   3.102 +		version.major, (u_int16_t)1);
   3.103 +	STAssertEquals(
   3.104 +		version.minor, (u_int16_t)3,
   3.105 +		@"Minor component was %u, not %u",
   3.106 +		version.minor, (u_int16_t)3);
   3.107 +	STAssertEquals(
   3.108 +		version.incremental, (u_int8_t)0,
   3.109 +		@"Incremental component was %u, not %u",
   3.110 +		version.incremental, (u_int8_t)0);
   3.111 +	STAssertEquals(
   3.112 +		version.releaseType, (u_int8_t)releaseType_beta,
   3.113 +		@"Release-type component was %u, not %u",
   3.114 +		version.releaseType, (u_int8_t)releaseType_beta);
   3.115 +	STAssertEquals(
   3.116 +		version.development, (u_int32_t)1,
   3.117 +		@"Development component was %u, not %u",
   3.118 +		version.development, (u_int32_t)1);
   3.119 +}
   3.120 +- (void) testParseTwoComponentReleaseVersion {
   3.121 +	struct Version version;
   3.122 +	NSString *string = @"1.3";
   3.123 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   3.124 +	STAssertEquals(
   3.125 +		version.major, (u_int16_t)1,
   3.126 +		@"Major component was %u, not %u",
   3.127 +		version.major, (u_int16_t)1);
   3.128 +	STAssertEquals(
   3.129 +		version.minor, (u_int16_t)3,
   3.130 +		@"Minor component was %u, not %u",
   3.131 +		version.minor, (u_int16_t)3);
   3.132 +	STAssertEquals(
   3.133 +		version.incremental, (u_int8_t)0,
   3.134 +		@"Incremental component was %u, not %u",
   3.135 +		version.incremental, (u_int8_t)0);
   3.136 +	STAssertEquals(
   3.137 +		version.releaseType, (u_int8_t)releaseType_release,
   3.138 +		@"Release-type component was %u, not %u",
   3.139 +		version.releaseType, (u_int8_t)releaseType_alpha);
   3.140 +	STAssertEquals(
   3.141 +		version.development, (u_int32_t)0,
   3.142 +		@"Development component was %u, not %u",
   3.143 +		version.development, (u_int32_t)0);
   3.144 +}
   3.145 +
   3.146 +- (void) testParseThreeComponentSVNVersion {
   3.147 +	struct Version version;
   3.148 +	NSString *string = @"1.3.4svn1400";
   3.149 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   3.150 +	STAssertEquals(
   3.151 +		version.major, (u_int16_t)1,
   3.152 +		@"Major component was %u, not %u",
   3.153 +		version.major, (u_int16_t)1);
   3.154 +	STAssertEquals(
   3.155 +		version.minor, (u_int16_t)3,
   3.156 +		@"Minor component was %u, not %u",
   3.157 +		version.minor, (u_int16_t)3);
   3.158 +	STAssertEquals(
   3.159 +		version.incremental, (u_int8_t)4,
   3.160 +		@"Incremental component was %u, not %u",
   3.161 +		version.incremental, (u_int8_t)4);
   3.162 +	STAssertEquals(
   3.163 +		version.releaseType, (u_int8_t)releaseType_svn,
   3.164 +		@"Release-type component was %u, not %u",
   3.165 +		version.releaseType, (u_int8_t)releaseType_svn);
   3.166 +	STAssertEquals(
   3.167 +		version.development, (u_int32_t)1400,
   3.168 +		@"Development component (SVN revision) was %u, not %u",
   3.169 +		version.development, (u_int32_t)1400);
   3.170 +}
   3.171 +- (void) testParseThreeComponentDevelopmentVersion {
   3.172 +	struct Version version;
   3.173 +	NSString *string = @"1.3.4d1";
   3.174 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   3.175 +	STAssertEquals(
   3.176 +		version.major, (u_int16_t)1,
   3.177 +		@"Major component was %u, not %u",
   3.178 +		version.major, (u_int16_t)1);
   3.179 +	STAssertEquals(
   3.180 +		version.minor, (u_int16_t)3,
   3.181 +		@"Minor component was %u, not %u",
   3.182 +		version.minor, (u_int16_t)3);
   3.183 +	STAssertEquals(
   3.184 +		version.incremental, (u_int8_t)4,
   3.185 +		@"Incremental component was %u, not %u",
   3.186 +		version.incremental, (u_int8_t)4);
   3.187 +	STAssertEquals(
   3.188 +		version.releaseType, (u_int8_t)releaseType_development,
   3.189 +		@"Release-type component was %u, not %u",
   3.190 +		version.releaseType, (u_int8_t)releaseType_development);
   3.191 +	STAssertEquals(
   3.192 +		version.development, (u_int32_t)1,
   3.193 +		@"Development component was %u, not %u",
   3.194 +		version.development, (u_int32_t)1);
   3.195 +}
   3.196 +- (void) testParseThreeComponentAlphaVersion {
   3.197 +	struct Version version;
   3.198 +	NSString *string = @"1.3.4a1";
   3.199 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   3.200 +	STAssertEquals(
   3.201 +		version.major, (u_int16_t)1,
   3.202 +		@"Major component was %u, not %u",
   3.203 +		version.major, (u_int16_t)1);
   3.204 +	STAssertEquals(
   3.205 +		version.minor, (u_int16_t)3,
   3.206 +		@"Minor component was %u, not %u",
   3.207 +		version.minor, (u_int16_t)3);
   3.208 +	STAssertEquals(
   3.209 +		version.incremental, (u_int8_t)4,
   3.210 +		@"Incremental component was %u, not %u",
   3.211 +		version.incremental, (u_int8_t)4);
   3.212 +	STAssertEquals(
   3.213 +		version.releaseType, (u_int8_t)releaseType_alpha,
   3.214 +		@"Release-type component was %u, not %u",
   3.215 +		version.releaseType, (u_int8_t)releaseType_alpha);
   3.216 +	STAssertEquals(
   3.217 +		version.development, (u_int32_t)1,
   3.218 +		@"Development component was %u, not %u",
   3.219 +		version.development, (u_int32_t)1);
   3.220 +}
   3.221 +- (void) testParseThreeComponentBetaVersion {
   3.222 +	struct Version version;
   3.223 +	NSString *string = @"1.3.4b1";
   3.224 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   3.225 +	STAssertEquals(
   3.226 +		version.major, (u_int16_t)1,
   3.227 +		@"Major component was %u, not %u",
   3.228 +		version.major, (u_int16_t)1);
   3.229 +	STAssertEquals(
   3.230 +		version.minor, (u_int16_t)3,
   3.231 +		@"Minor component was %u, not %u",
   3.232 +		version.minor, (u_int16_t)3);
   3.233 +	STAssertEquals(
   3.234 +		version.incremental, (u_int8_t)4,
   3.235 +		@"Incremental component was %u, not %u",
   3.236 +		version.incremental, (u_int8_t)4);
   3.237 +	STAssertEquals(
   3.238 +		version.releaseType, (u_int8_t)releaseType_beta,
   3.239 +		@"Release-type component was %u, not %u",
   3.240 +		version.releaseType, (u_int8_t)releaseType_beta);
   3.241 +	STAssertEquals(
   3.242 +		version.development, (u_int32_t)1,
   3.243 +		@"Development component was %u, not %u",
   3.244 +		version.development, (u_int32_t)1);
   3.245 +}
   3.246 +- (void) testParseThreeComponentReleaseVersion {
   3.247 +	struct Version version;
   3.248 +	NSString *string = @"1.3.4";
   3.249 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   3.250 +	STAssertEquals(
   3.251 +		version.major, (u_int16_t)1,
   3.252 +		@"Major component was %u, not %u",
   3.253 +		version.major, (u_int16_t)1);
   3.254 +	STAssertEquals(
   3.255 +		version.minor, (u_int16_t)3,
   3.256 +		@"Minor component was %u, not %u",
   3.257 +		version.minor, (u_int16_t)3);
   3.258 +	STAssertEquals(
   3.259 +		version.incremental, (u_int8_t)4,
   3.260 +		@"Incremental component was %u, not %u",
   3.261 +		version.incremental, (u_int8_t)4);
   3.262 +	STAssertEquals(
   3.263 +		version.releaseType, (u_int8_t)releaseType_release,
   3.264 +		@"Release-type component was %u, not %u",
   3.265 +		version.releaseType, (u_int8_t)releaseType_alpha);
   3.266 +	STAssertEquals(
   3.267 +		version.development, (u_int32_t)0,
   3.268 +		@"Development component was %u, not %u",
   3.269 +		version.development, (u_int32_t)0);
   3.270 +}
   3.271 +
   3.272 +#pragma mark Things that should not work
   3.273 +
   3.274 +- (void) testParseNil {
   3.275 +	struct Version version;
   3.276 +	NSString *string = nil;
   3.277 +	STAssertFalse(parseVersionString(string, &version), @"Successfully parsed nil");
   3.278 +}
   3.279 +- (void) testParseWord {
   3.280 +	struct Version version;
   3.281 +	NSString *string = @"atychiphobia";
   3.282 +	STAssertFalse(parseVersionString(string, &version), @"Successfully parsed a word (%@); output version was %@", string, [NSMakeCollectable(createVersionDescription(version)) autorelease]);
   3.283 +}
   3.284 +- (void) testParseWordFollowedByReleaseVersion {
   3.285 +	struct Version version;
   3.286 +	NSString *string = @"Final 1.3";
   3.287 +	STAssertFalse(parseVersionString(string, &version), @"Successfully parsed a word followed by a version (%@) - this should have failed. Output version was %@", string, [NSMakeCollectable(createVersionDescription(version)) autorelease]);
   3.288 +}
   3.289 +- (void) testParseReleaseVersionFollowedByWord {
   3.290 +	struct Version version;
   3.291 +	NSString *string = @"1.3 final";
   3.292 +	STAssertFalse(parseVersionString(string, &version), @"Successfully parsed a version followed by a word (%@) - this should have failed. Output version was %@", string, [NSMakeCollectable(createVersionDescription(version)) autorelease]);
   3.293 +}
   3.294 +
   3.295 +@end
     4.1 --- a/Unit tests/TestVersionUtilities.h	Tue Oct 13 02:34:28 2009 -0700
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,29 +0,0 @@
     4.4 -//
     4.5 -//  TestVersionUtilities.h
     4.6 -//  Growl
     4.7 -//
     4.8 -//  Created by Peter Hosey on 2009-10-13.
     4.9 -//  Copyright 2009 Peter Hosey. All rights reserved.
    4.10 -//
    4.11 -
    4.12 -#import <SenTestingKit/SenTestingKit.h>
    4.13 -
    4.14 -@interface TestVersionUtilities : SenTestCase {
    4.15 -}
    4.16 -
    4.17 -- (void) testParseNil;
    4.18 -- (void) testParseTwoComponentSVNVersion;
    4.19 -- (void) testParseTwoComponentDevelopmentVersion;
    4.20 -- (void) testParseTwoComponentAlphaVersion;
    4.21 -- (void) testParseTwoComponentBetaVersion;
    4.22 -- (void) testParseTwoComponentReleaseVersion;
    4.23 -- (void) testParseThreeComponentSVNVersion;
    4.24 -- (void) testParseThreeComponentDevelopmentVersion;
    4.25 -- (void) testParseThreeComponentAlphaVersion;
    4.26 -- (void) testParseThreeComponentBetaVersion;
    4.27 -- (void) testParseThreeComponentReleaseVersion;
    4.28 -- (void) testParseWord;
    4.29 -- (void) testParseWordFollowedByReleaseVersion;
    4.30 -- (void) testParseReleaseVersionFollowedByWord;
    4.31 -
    4.32 -@end
     5.1 --- a/Unit tests/TestVersionUtilities.m	Tue Oct 13 02:34:28 2009 -0700
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,292 +0,0 @@
     5.4 -//
     5.5 -//  TestVersionUtilities.m
     5.6 -//  Growl
     5.7 -//
     5.8 -//  Created by Peter Hosey on 2009-10-13.
     5.9 -//  Copyright 2009 Peter Hosey. All rights reserved.
    5.10 -//
    5.11 -
    5.12 -#import "TestVersionUtilities.h"
    5.13 -
    5.14 -#import "GrowlVersionUtilities.h"
    5.15 -
    5.16 -@implementation TestVersionUtilities
    5.17 -
    5.18 -#pragma mark Things that should work
    5.19 -
    5.20 -- (void) testParseTwoComponentSVNVersion {
    5.21 -	struct Version version;
    5.22 -	NSString *string = @"1.3svn1400";
    5.23 -	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    5.24 -	STAssertEquals(
    5.25 -		version.major, (u_int16_t)1,
    5.26 -		@"Major component was %u, not %u",
    5.27 -		version.major, (u_int16_t)1);
    5.28 -	STAssertEquals(
    5.29 -		version.minor, (u_int16_t)3,
    5.30 -		@"Minor component was %u, not %u",
    5.31 -		version.minor, (u_int16_t)3);
    5.32 -	STAssertEquals(
    5.33 -		version.incremental, (u_int8_t)0,
    5.34 -		@"Incremental component was %u, not %u",
    5.35 -		version.incremental, (u_int8_t)0);
    5.36 -	STAssertEquals(
    5.37 -		version.releaseType, (u_int8_t)releaseType_svn,
    5.38 -		@"Release-type component was %u, not %u",
    5.39 -		version.releaseType, (u_int8_t)releaseType_svn);
    5.40 -	STAssertEquals(
    5.41 -		version.development, (u_int32_t)1400,
    5.42 -		@"Development component (SVN revision) was %u, not %u",
    5.43 -		version.development, (u_int32_t)1400);
    5.44 -}
    5.45 -- (void) testParseTwoComponentDevelopmentVersion {
    5.46 -	struct Version version;
    5.47 -	NSString *string = @"1.3d1";
    5.48 -	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    5.49 -	STAssertEquals(
    5.50 -		version.major, (u_int16_t)1,
    5.51 -		@"Major component was %u, not %u",
    5.52 -		version.major, (u_int16_t)1);
    5.53 -	STAssertEquals(
    5.54 -		version.minor, (u_int16_t)3,
    5.55 -		@"Minor component was %u, not %u",
    5.56 -		version.minor, (u_int16_t)3);
    5.57 -	STAssertEquals(
    5.58 -		version.incremental, (u_int8_t)0,
    5.59 -		@"Incremental component was %u, not %u",
    5.60 -		version.incremental, (u_int8_t)0);
    5.61 -	STAssertEquals(
    5.62 -		version.releaseType, (u_int8_t)releaseType_development,
    5.63 -		@"Release-type component was %u, not %u",
    5.64 -		version.releaseType, (u_int8_t)releaseType_development);
    5.65 -	STAssertEquals(
    5.66 -		version.development, (u_int32_t)1,
    5.67 -		@"Development component was %u, not %u",
    5.68 -		version.development, (u_int32_t)1);
    5.69 -}
    5.70 -- (void) testParseTwoComponentAlphaVersion {
    5.71 -	struct Version version;
    5.72 -	NSString *string = @"1.3a1";
    5.73 -	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    5.74 -	STAssertEquals(
    5.75 -		version.major, (u_int16_t)1,
    5.76 -		@"Major component was %u, not %u",
    5.77 -		version.major, (u_int16_t)1);
    5.78 -	STAssertEquals(
    5.79 -		version.minor, (u_int16_t)3,
    5.80 -		@"Minor component was %u, not %u",
    5.81 -		version.minor, (u_int16_t)3);
    5.82 -	STAssertEquals(
    5.83 -		version.incremental, (u_int8_t)0,
    5.84 -		@"Incremental component was %u, not %u",
    5.85 -		version.incremental, (u_int8_t)0);
    5.86 -	STAssertEquals(
    5.87 -		version.releaseType, (u_int8_t)releaseType_alpha,
    5.88 -		@"Release-type component was %u, not %u",
    5.89 -		version.releaseType, (u_int8_t)releaseType_alpha);
    5.90 -	STAssertEquals(
    5.91 -		version.development, (u_int32_t)1,
    5.92 -		@"Development component was %u, not %u",
    5.93 -		version.development, (u_int32_t)1);
    5.94 -}
    5.95 -- (void) testParseTwoComponentBetaVersion {
    5.96 -	struct Version version;
    5.97 -	NSString *string = @"1.3b1";
    5.98 -	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    5.99 -	STAssertEquals(
   5.100 -		version.major, (u_int16_t)1,
   5.101 -		@"Major component was %u, not %u",
   5.102 -		version.major, (u_int16_t)1);
   5.103 -	STAssertEquals(
   5.104 -		version.minor, (u_int16_t)3,
   5.105 -		@"Minor component was %u, not %u",
   5.106 -		version.minor, (u_int16_t)3);
   5.107 -	STAssertEquals(
   5.108 -		version.incremental, (u_int8_t)0,
   5.109 -		@"Incremental component was %u, not %u",
   5.110 -		version.incremental, (u_int8_t)0);
   5.111 -	STAssertEquals(
   5.112 -		version.releaseType, (u_int8_t)releaseType_beta,
   5.113 -		@"Release-type component was %u, not %u",
   5.114 -		version.releaseType, (u_int8_t)releaseType_beta);
   5.115 -	STAssertEquals(
   5.116 -		version.development, (u_int32_t)1,
   5.117 -		@"Development component was %u, not %u",
   5.118 -		version.development, (u_int32_t)1);
   5.119 -}
   5.120 -- (void) testParseTwoComponentReleaseVersion {
   5.121 -	struct Version version;
   5.122 -	NSString *string = @"1.3";
   5.123 -	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   5.124 -	STAssertEquals(
   5.125 -		version.major, (u_int16_t)1,
   5.126 -		@"Major component was %u, not %u",
   5.127 -		version.major, (u_int16_t)1);
   5.128 -	STAssertEquals(
   5.129 -		version.minor, (u_int16_t)3,
   5.130 -		@"Minor component was %u, not %u",
   5.131 -		version.minor, (u_int16_t)3);
   5.132 -	STAssertEquals(
   5.133 -		version.incremental, (u_int8_t)0,
   5.134 -		@"Incremental component was %u, not %u",
   5.135 -		version.incremental, (u_int8_t)0);
   5.136 -	STAssertEquals(
   5.137 -		version.releaseType, (u_int8_t)releaseType_release,
   5.138 -		@"Release-type component was %u, not %u",
   5.139 -		version.releaseType, (u_int8_t)releaseType_alpha);
   5.140 -	STAssertEquals(
   5.141 -		version.development, (u_int32_t)0,
   5.142 -		@"Development component was %u, not %u",
   5.143 -		version.development, (u_int32_t)0);
   5.144 -}
   5.145 -
   5.146 -- (void) testParseThreeComponentSVNVersion {
   5.147 -	struct Version version;
   5.148 -	NSString *string = @"1.3.4svn1400";
   5.149 -	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   5.150 -	STAssertEquals(
   5.151 -		version.major, (u_int16_t)1,
   5.152 -		@"Major component was %u, not %u",
   5.153 -		version.major, (u_int16_t)1);
   5.154 -	STAssertEquals(
   5.155 -		version.minor, (u_int16_t)3,
   5.156 -		@"Minor component was %u, not %u",
   5.157 -		version.minor, (u_int16_t)3);
   5.158 -	STAssertEquals(
   5.159 -		version.incremental, (u_int8_t)4,
   5.160 -		@"Incremental component was %u, not %u",
   5.161 -		version.incremental, (u_int8_t)4);
   5.162 -	STAssertEquals(
   5.163 -		version.releaseType, (u_int8_t)releaseType_svn,
   5.164 -		@"Release-type component was %u, not %u",
   5.165 -		version.releaseType, (u_int8_t)releaseType_svn);
   5.166 -	STAssertEquals(
   5.167 -		version.development, (u_int32_t)1400,
   5.168 -		@"Development component (SVN revision) was %u, not %u",
   5.169 -		version.development, (u_int32_t)1400);
   5.170 -}
   5.171 -- (void) testParseThreeComponentDevelopmentVersion {
   5.172 -	struct Version version;
   5.173 -	NSString *string = @"1.3.4d1";
   5.174 -	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   5.175 -	STAssertEquals(
   5.176 -		version.major, (u_int16_t)1,
   5.177 -		@"Major component was %u, not %u",
   5.178 -		version.major, (u_int16_t)1);
   5.179 -	STAssertEquals(
   5.180 -		version.minor, (u_int16_t)3,
   5.181 -		@"Minor component was %u, not %u",
   5.182 -		version.minor, (u_int16_t)3);
   5.183 -	STAssertEquals(
   5.184 -		version.incremental, (u_int8_t)4,
   5.185 -		@"Incremental component was %u, not %u",
   5.186 -		version.incremental, (u_int8_t)4);
   5.187 -	STAssertEquals(
   5.188 -		version.releaseType, (u_int8_t)releaseType_development,
   5.189 -		@"Release-type component was %u, not %u",
   5.190 -		version.releaseType, (u_int8_t)releaseType_development);
   5.191 -	STAssertEquals(
   5.192 -		version.development, (u_int32_t)1,
   5.193 -		@"Development component was %u, not %u",
   5.194 -		version.development, (u_int32_t)1);
   5.195 -}
   5.196 -- (void) testParseThreeComponentAlphaVersion {
   5.197 -	struct Version version;
   5.198 -	NSString *string = @"1.3.4a1";
   5.199 -	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   5.200 -	STAssertEquals(
   5.201 -		version.major, (u_int16_t)1,
   5.202 -		@"Major component was %u, not %u",
   5.203 -		version.major, (u_int16_t)1);
   5.204 -	STAssertEquals(
   5.205 -		version.minor, (u_int16_t)3,
   5.206 -		@"Minor component was %u, not %u",
   5.207 -		version.minor, (u_int16_t)3);
   5.208 -	STAssertEquals(
   5.209 -		version.incremental, (u_int8_t)4,
   5.210 -		@"Incremental component was %u, not %u",
   5.211 -		version.incremental, (u_int8_t)4);
   5.212 -	STAssertEquals(
   5.213 -		version.releaseType, (u_int8_t)releaseType_alpha,
   5.214 -		@"Release-type component was %u, not %u",
   5.215 -		version.releaseType, (u_int8_t)releaseType_alpha);
   5.216 -	STAssertEquals(
   5.217 -		version.development, (u_int32_t)1,
   5.218 -		@"Development component was %u, not %u",
   5.219 -		version.development, (u_int32_t)1);
   5.220 -}
   5.221 -- (void) testParseThreeComponentBetaVersion {
   5.222 -	struct Version version;
   5.223 -	NSString *string = @"1.3.4b1";
   5.224 -	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   5.225 -	STAssertEquals(
   5.226 -		version.major, (u_int16_t)1,
   5.227 -		@"Major component was %u, not %u",
   5.228 -		version.major, (u_int16_t)1);
   5.229 -	STAssertEquals(
   5.230 -		version.minor, (u_int16_t)3,
   5.231 -		@"Minor component was %u, not %u",
   5.232 -		version.minor, (u_int16_t)3);
   5.233 -	STAssertEquals(
   5.234 -		version.incremental, (u_int8_t)4,
   5.235 -		@"Incremental component was %u, not %u",
   5.236 -		version.incremental, (u_int8_t)4);
   5.237 -	STAssertEquals(
   5.238 -		version.releaseType, (u_int8_t)releaseType_beta,
   5.239 -		@"Release-type component was %u, not %u",
   5.240 -		version.releaseType, (u_int8_t)releaseType_beta);
   5.241 -	STAssertEquals(
   5.242 -		version.development, (u_int32_t)1,
   5.243 -		@"Development component was %u, not %u",
   5.244 -		version.development, (u_int32_t)1);
   5.245 -}
   5.246 -- (void) testParseThreeComponentReleaseVersion {
   5.247 -	struct Version version;
   5.248 -	NSString *string = @"1.3.4";
   5.249 -	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
   5.250 -	STAssertEquals(
   5.251 -		version.major, (u_int16_t)1,
   5.252 -		@"Major component was %u, not %u",
   5.253 -		version.major, (u_int16_t)1);
   5.254 -	STAssertEquals(
   5.255 -		version.minor, (u_int16_t)3,
   5.256 -		@"Minor component was %u, not %u",
   5.257 -		version.minor, (u_int16_t)3);
   5.258 -	STAssertEquals(
   5.259 -		version.incremental, (u_int8_t)4,
   5.260 -		@"Incremental component was %u, not %u",
   5.261 -		version.incremental, (u_int8_t)4);
   5.262 -	STAssertEquals(
   5.263 -		version.releaseType, (u_int8_t)releaseType_release,
   5.264 -		@"Release-type component was %u, not %u",
   5.265 -		version.releaseType, (u_int8_t)releaseType_alpha);
   5.266 -	STAssertEquals(
   5.267 -		version.development, (u_int32_t)0,
   5.268 -		@"Development component was %u, not %u",
   5.269 -		version.development, (u_int32_t)0);
   5.270 -}
   5.271 -
   5.272 -#pragma mark Things that should not work
   5.273 -
   5.274 -- (void) testParseNil {
   5.275 -	struct Version version;
   5.276 -	NSString *string = nil;
   5.277 -	STAssertFalse(parseVersionString(string, &version), @"Successfully parsed nil");
   5.278 -}
   5.279 -- (void) testParseWord {
   5.280 -	struct Version version;
   5.281 -	NSString *string = @"atychiphobia";
   5.282 -	STAssertFalse(parseVersionString(string, &version), @"Successfully parsed a word (%@); output version was %@", string, [NSMakeCollectable(createVersionDescription(version)) autorelease]);
   5.283 -}
   5.284 -- (void) testParseWordFollowedByReleaseVersion {
   5.285 -	struct Version version;
   5.286 -	NSString *string = @"Final 1.3";
   5.287 -	STAssertFalse(parseVersionString(string, &version), @"Successfully parsed a word followed by a version (%@) - this should have failed. Output version was %@", string, [NSMakeCollectable(createVersionDescription(version)) autorelease]);
   5.288 -}
   5.289 -- (void) testParseReleaseVersionFollowedByWord {
   5.290 -	struct Version version;
   5.291 -	NSString *string = @"1.3 final";
   5.292 -	STAssertFalse(parseVersionString(string, &version), @"Successfully parsed a version followed by a word (%@) - this should have failed. Output version was %@", string, [NSMakeCollectable(createVersionDescription(version)) autorelease]);
   5.293 -}
   5.294 -
   5.295 -@end