IOSAD-172 Add 21st pass to the end, but remove at 0 IOSAD-172
authorDirk Zimmermann <dz@pep.security>
Thu, 25 Jun 2020 17:08:21 +0200
branchIOSAD-172
changeset 14588e31ce01a795
parent 1457 98e4f0837759
child 1459 a2d09a38d424
IOSAD-172 Add 21st pass to the end, but remove at 0
pEpObjCTests/PEPPassphraseCacheTest.m
     1.1 --- a/pEpObjCTests/PEPPassphraseCacheTest.m	Thu Jun 25 17:08:21 2020 +0200
     1.2 +++ b/pEpObjCTests/PEPPassphraseCacheTest.m	Thu Jun 25 17:08:21 2020 +0200
     1.3 @@ -68,18 +68,19 @@
     1.4  
     1.5  - (void)testTwentyOnePassphrases
     1.6  {
     1.7 -    NSMutableArray *passphrases = [NSMutableArray arrayWithCapacity:20];
     1.8 +    NSMutableArray *expectedPassphrases = [NSMutableArray arrayWithCapacity:20];
     1.9      for (NSUInteger i = 0; i < 20; ++i) {
    1.10          NSString *newPhrase = [NSString stringWithFormat:@"passphrase_%lu", (unsigned long) i];
    1.11 -        [passphrases addObject:newPhrase];
    1.12 +        [expectedPassphrases addObject:newPhrase];
    1.13          [self.cache addPassphrase:newPhrase];
    1.14      }
    1.15  
    1.16      NSString *latestPassphrase = @"theLatest";
    1.17 -    [passphrases replaceObjectAtIndex:0 withObject:latestPassphrase];
    1.18 +    [expectedPassphrases removeObjectAtIndex:0];
    1.19 +    [expectedPassphrases addObject:latestPassphrase];
    1.20  
    1.21 -    XCTAssertEqual(self.cache.passphrases.count, passphrases.count + 1);
    1.22 -    NSMutableArray *expected = [NSMutableArray arrayWithArray:passphrases];
    1.23 +    XCTAssertEqual(self.cache.passphrases.count, expectedPassphrases.count + 1);
    1.24 +    NSMutableArray *expected = [NSMutableArray arrayWithArray:expectedPassphrases];
    1.25      [expected insertObject:@"" atIndex:0];
    1.26      XCTAssertEqualObjects(self.cache.passphrases, expected);
    1.27  }