pEpObjCTests/PEPPassphraseCacheTest.m
branchIOSAD-172
changeset 1544 4ebee94f06b2
parent 1543 674307ef48b9
child 1545 5ca27ed9f55b
     1.1 --- a/pEpObjCTests/PEPPassphraseCacheTest.m	Mon Jun 29 16:39:43 2020 +0200
     1.2 +++ b/pEpObjCTests/PEPPassphraseCacheTest.m	Mon Jun 29 16:39:43 2020 +0200
     1.3 @@ -61,10 +61,7 @@
     1.4          [self.cache addPassphrase:newPhrase];
     1.5      }
     1.6  
     1.7 -    NSMutableArray *expected = [NSMutableArray arrayWithCapacity:passphrases.count + 1];
     1.8 -    for (id obj in [passphrases reverseObjectEnumerator]) {
     1.9 -        [expected addObject:obj];
    1.10 -    }
    1.11 +    NSMutableArray *expected = [NSMutableArray arrayWithArray:[self reversedArray:passphrases]];
    1.12  
    1.13      XCTAssertEqual(self.cache.passphrases.count, expected.count + 1);
    1.14      [expected insertObject:@"" atIndex:0];
    1.15 @@ -108,4 +105,15 @@
    1.16      XCTAssertEqualObjects(ownCache.passphrases, @[@""]);
    1.17  }
    1.18  
    1.19 +#pragma mark - Helpers
    1.20 +
    1.21 +- (NSArray *)reversedArray:(NSArray *)array
    1.22 +{
    1.23 +    NSMutableArray *reversedArray = [NSMutableArray arrayWithCapacity:array.count];
    1.24 +    for (id obj in [array reverseObjectEnumerator]) {
    1.25 +        [reversedArray addObject:obj];
    1.26 +    }
    1.27 +    return [NSArray arrayWithArray:reversedArray];
    1.28 +}
    1.29 +
    1.30  @end