/
EDSemverLessThan.m
52 lines (46 loc) · 1.38 KB
/
EDSemverLessThan.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//
// EDSemverLessThan.m
// semver
//
// Created by Andrew Sliwinski on 7/4/13.
// Copyright (c) 2013 Andrew Sliwinski. All rights reserved.
//
#import "EDSemverHarness.h"
@interface EDSemverLessThan : SenTestCase
@end
@implementation EDSemverLessThan
- (void)testLessThan
{
NSArray *eq = @[
@"0.0.0", @"0.0.0-foo",
@"0.0.1", @"0.0.0",
@"1.0.0", @"0.9.9",
@"0.10.0", @"0.9.0",
@"0.99.0", @"0.10.0",
@"2.0.0", @"1.2.3",
@"v0.0.0", @"0.0.0-foo",
@"v0.0.1", @"0.0.0",
@"v1.0.0", @"0.9.9",
@"v0.10.0", @"0.9.0",
@"v0.99.0", @"0.10.0",
@"v2.0.0", @"1.2.3",
@"0.0.0", @"v0.0.0-foo",
@"0.0.1", @"v0.0.0",
@"1.0.0", @"v0.9.9",
@"0.10.0", @"v0.9.0",
@"0.99.0", @"v0.10.0",
@"2.0.0", @"v1.2.3",
@"1.2.3", @"1.2.3-asdf",
@"1.2.3", @"1.2.3-4",
@"1.2.3", @"1.2.3-4-foo",
@"1.2.3-5-foo", @"1.2.3-5",
@"1.2.3-5", @"1.2.3-4",
@"3.0.0", @"2.7.2+asdf"
];
for (NSUInteger i = 0; i < [eq count]; i+=2) {
EDSemver *left = [[EDSemver alloc] initWithString:[eq objectAtIndex:i]];
EDSemver *right = [[EDSemver alloc] initWithString:[eq objectAtIndex:i+1]];
STAssertEquals([right compare:left], NSOrderedAscending, [NSString stringWithFormat:@"Expected %@ to be less than %@", right, left]);
}
}
@end