pEpObjCTests/PEPSessionTest.m
branchIOSAD-141
changeset 1246 9fc7a345f0a3
parent 1245 cd15ff3a40b9
child 1250 b6a4d30abd26
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Thu Sep 12 16:41:52 2019 +0200
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Fri Sep 13 06:48:34 2019 +0200
     1.3 @@ -1458,20 +1458,29 @@
     1.4                                                      session: nil];
     1.5      XCTAssertNotNil(bobIdent);
     1.6  
     1.7 -    for (int iOuter = 0; iOuter < 1000; ++iOuter) {
     1.8 +    NSInteger dataCount = 5 * 1024;
     1.9 +    NSMutableData *msgData = [NSMutableData dataWithLength:5 * 1024];
    1.10 +    for (NSInteger c = 0; c < dataCount; ++c) {
    1.11 +        const char *pStr = "H";
    1.12 +        [msgData appendBytes:pStr length:1];
    1.13 +    }
    1.14 +
    1.15 +    PEPMessage *msg = [PEPMessage new];
    1.16 +    msg.to = @[aliceIdent, bobIdent];
    1.17 +    msg.direction = PEPMsgDirectionOutgoing;
    1.18 +    msg.shortMessage = @"Subject";
    1.19 +    msg.longMessage = @"Just some message";
    1.20 +
    1.21 +    NSInteger loopCount = 200;
    1.22 +
    1.23 +    for (NSUInteger iOuter = 0; iOuter < 100; ++iOuter) {
    1.24          XCTestExpectation *expThread1Finished = [self expectationWithDescription:@"Thread1 finished"];
    1.25          NSThread *thread1 = [[NSThread alloc] initWithBlock:^{
    1.26              PEPSession *session1 = [PEPSession new];
    1.27              NSError *error1 = nil;
    1.28  
    1.29 -            PEPMessage *msg = [PEPMessage new];
    1.30 -            msg.to = @[aliceIdent, bobIdent];
    1.31 -            msg.direction = PEPMsgDirectionOutgoing;
    1.32 -            msg.shortMessage = @"Subject";
    1.33 -            msg.longMessage = @"Just some message";
    1.34 -
    1.35 -            for (int i = 0; i < 100; ++i) {
    1.36 -                NSLog(@"outgoingRatingForMessage %d\n", i);
    1.37 +            for (NSUInteger i = 0; i < loopCount; ++i) {
    1.38 +                NSLog(@"outgoingRatingForMessage %lu\n", (unsigned long) i);
    1.39  
    1.40                  NSError *error = nil;
    1.41                  NSNumber *num = [session1 outgoingRatingForMessage:msg error:&error1];
    1.42 @@ -1487,17 +1496,18 @@
    1.43              PEPSession *session2 = [PEPSession new];
    1.44              NSError *error2 = nil;
    1.45  
    1.46 -            for (int i = 0; i < 2000; ++i) {
    1.47 -                NSLog(@"getTrustwordsIdentity1 %d\n", i);
    1.48 +            for (NSUInteger i = 0; i < loopCount; ++i) {
    1.49 +                NSLog(@"encryptForSelf %lu\n", (unsigned long) i);
    1.50  
    1.51 -                NSString *trustwords = [session2
    1.52 -                                        getTrustwordsIdentity1:aliceIdent
    1.53 -                                        identity2:bobIdent
    1.54 -                                        language:@"en"
    1.55 -                                        full:YES
    1.56 -                                        error:&error2];
    1.57 -                XCTAssertNotNil(trustwords);
    1.58 -                XCTAssertNil(error);
    1.59 +                PEPStatus status;
    1.60 +                [session2
    1.61 +                 encryptMessage:msg
    1.62 +                 forSelf:identMe
    1.63 +                 extraKeys:@[]
    1.64 +                 status:&status
    1.65 +                 error:&error2];
    1.66 +                XCTAssertNil(error2);
    1.67 +                XCTAssertEqual(status, PEPStatusOK);
    1.68              }
    1.69              [expThread2Finished fulfill];
    1.70          }];