Test spaces around the release type, and an r before the revision number, and the combination thereof. GVU test coverage now 89.3%.
authorPeter Hosey <hg@boredzo.org>
Wed Oct 14 17:55:37 2009 -0700 (2009-10-14)
changeset 45225fa478e3475a
parent 4521 273618d372b1
child 4523 987556ed56e3
Test spaces around the release type, and an r before the revision number, and the combination thereof. GVU test coverage now 89.3%.
Unit tests/TestVersionParsing.h
Unit tests/TestVersionParsing.m
     1.1 --- a/Unit tests/TestVersionParsing.h	Wed Oct 14 17:44:50 2009 -0700
     1.2 +++ b/Unit tests/TestVersionParsing.h	Wed Oct 14 17:55:37 2009 -0700
     1.3 @@ -31,4 +31,8 @@
     1.4  - (void) testParseVersionStringSuffixedBySpaces;
     1.5  - (void) testParseVersionStringSuffixedByLineFeed;
     1.6  
     1.7 +- (void) testParseTwoComponentSVNVersionWithSpacesAroundReleaseType;
     1.8 +- (void) testParseTwoComponentSVNVersionWithSmallLetterRBeforeRevisionNumber;
     1.9 +- (void) testParseTwoComponentSVNVersionWithSpacesAroundReleaseTypeAndSmallLetterRBeforeRevisionNumber;
    1.10 +
    1.11  @end
     2.1 --- a/Unit tests/TestVersionParsing.m	Wed Oct 14 17:44:50 2009 -0700
     2.2 +++ b/Unit tests/TestVersionParsing.m	Wed Oct 14 17:55:37 2009 -0700
     2.3 @@ -310,4 +310,80 @@
     2.4  	STAssertTrue(parseVersionString(string, &version), @"Could not parse a version string followed by a line feed");
     2.5  }
     2.6  
     2.7 +- (void) testParseTwoComponentSVNVersionWithSpacesAroundReleaseType {
     2.8 +	struct Version version;
     2.9 +	NSString *string = @"1.3 svn 1400";
    2.10 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    2.11 +	STAssertEquals(
    2.12 +		version.major, (u_int16_t)1,
    2.13 +		@"Major component was %u, not %u",
    2.14 +		version.major, (u_int16_t)1);
    2.15 +	STAssertEquals(
    2.16 +		version.minor, (u_int16_t)3,
    2.17 +		@"Minor component was %u, not %u",
    2.18 +		version.minor, (u_int16_t)3);
    2.19 +	STAssertEquals(
    2.20 +		version.incremental, (u_int8_t)0,
    2.21 +		@"Incremental component was %u, not %u",
    2.22 +		version.incremental, (u_int8_t)0);
    2.23 +	STAssertEquals(
    2.24 +		version.releaseType, (u_int8_t)releaseType_svn,
    2.25 +		@"Release-type component was %u, not %u",
    2.26 +		version.releaseType, (u_int8_t)releaseType_svn);
    2.27 +	STAssertEquals(
    2.28 +		version.development, (u_int32_t)1400,
    2.29 +		@"Development component (SVN revision) was %u, not %u",
    2.30 +		version.development, (u_int32_t)1400);
    2.31 +}
    2.32 +- (void) testParseTwoComponentSVNVersionWithSmallLetterRBeforeRevisionNumber{
    2.33 +	struct Version version;
    2.34 +	NSString *string = @"1.3svnr1400";
    2.35 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    2.36 +	STAssertEquals(
    2.37 +				   version.major, (u_int16_t)1,
    2.38 +				   @"Major component was %u, not %u",
    2.39 +				   version.major, (u_int16_t)1);
    2.40 +	STAssertEquals(
    2.41 +				   version.minor, (u_int16_t)3,
    2.42 +				   @"Minor component was %u, not %u",
    2.43 +				   version.minor, (u_int16_t)3);
    2.44 +	STAssertEquals(
    2.45 +				   version.incremental, (u_int8_t)0,
    2.46 +				   @"Incremental component was %u, not %u",
    2.47 +				   version.incremental, (u_int8_t)0);
    2.48 +	STAssertEquals(
    2.49 +				   version.releaseType, (u_int8_t)releaseType_svn,
    2.50 +				   @"Release-type component was %u, not %u",
    2.51 +				   version.releaseType, (u_int8_t)releaseType_svn);
    2.52 +	STAssertEquals(
    2.53 +				   version.development, (u_int32_t)1400,
    2.54 +				   @"Development component (SVN revision) was %u, not %u",
    2.55 +				   version.development, (u_int32_t)1400);
    2.56 +}
    2.57 +- (void) testParseTwoComponentSVNVersionWithSpacesAroundReleaseTypeAndSmallLetterRBeforeRevisionNumber {
    2.58 +	struct Version version;
    2.59 +	NSString *string = @"1.3 svn r1400";
    2.60 +	STAssertTrue(parseVersionString(string, &version), @"Parse of %@ failed", string);
    2.61 +	STAssertEquals(
    2.62 +		version.major, (u_int16_t)1,
    2.63 +		@"Major component was %u, not %u",
    2.64 +		version.major, (u_int16_t)1);
    2.65 +	STAssertEquals(
    2.66 +		version.minor, (u_int16_t)3,
    2.67 +		@"Minor component was %u, not %u",
    2.68 +		version.minor, (u_int16_t)3);
    2.69 +	STAssertEquals(
    2.70 +		version.incremental, (u_int8_t)0,
    2.71 +		@"Incremental component was %u, not %u",
    2.72 +		version.incremental, (u_int8_t)0);
    2.73 +	STAssertEquals(
    2.74 +		version.releaseType, (u_int8_t)releaseType_svn,
    2.75 +		@"Release-type component was %u, not %u",
    2.76 +		version.releaseType, (u_int8_t)releaseType_svn);
    2.77 +	STAssertEquals(
    2.78 +		version.development, (u_int32_t)1400,
    2.79 +		@"Development component (SVN revision) was %u, not %u",
    2.80 +		version.development, (u_int32_t)1400);
    2.81 +}
    2.82 +
    2.83  @end