diff options
author | Jose <jose@zeroc.com> | 2019-06-22 00:29:53 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2019-06-22 00:29:53 +0200 |
commit | c5959fd09de61604bedd75354401df6a57395d65 (patch) | |
tree | 3b0227f631c8b20fb1a1a274b92f63f52f34af2c /objective-c/test | |
parent | Small fix (diff) | |
parent | Enable -Wconversion with clang - Close #363 (diff) | |
download | ice-c5959fd09de61604bedd75354401df6a57395d65.tar.bz2 ice-c5959fd09de61604bedd75354401df6a57395d65.tar.xz ice-c5959fd09de61604bedd75354401df6a57395d65.zip |
Merge remote-tracking branch 'origin/3.7' into swift
Diffstat (limited to 'objective-c/test')
-rw-r--r-- | objective-c/test/Ice/admin/AllTests.m | 2 | ||||
-rw-r--r-- | objective-c/test/Ice/binding/AllTests.m | 10 | ||||
-rw-r--r-- | objective-c/test/Ice/enums/AllTests.m | 48 | ||||
-rw-r--r-- | objective-c/test/Ice/exceptions/TestI.m | 2 | ||||
-rw-r--r-- | objective-c/test/Ice/hash/AllTests.m | 6 | ||||
-rw-r--r-- | objective-c/test/Ice/hold/TestI.m | 2 | ||||
-rw-r--r-- | objective-c/test/Ice/operations/TestI.m | 6 | ||||
-rw-r--r-- | objective-c/test/Ice/operations/Twoways.m | 10 | ||||
-rw-r--r-- | objective-c/test/Ice/operations/TwowaysAMI.m | 13 | ||||
-rw-r--r-- | objective-c/test/Ice/proxy/AllTests.m | 2 | ||||
-rw-r--r-- | objective-c/test/Ice/slicing/objects/AllTests.m | 16 | ||||
-rw-r--r-- | objective-c/test/Ice/stream/Client.m | 4 |
12 files changed, 61 insertions, 60 deletions
diff --git a/objective-c/test/Ice/admin/AllTests.m b/objective-c/test/Ice/admin/AllTests.m index 01b223f8ccd..41e6c9a4c7b 100644 --- a/objective-c/test/Ice/admin/AllTests.m +++ b/objective-c/test/Ice/admin/AllTests.m @@ -392,7 +392,7 @@ adminAllTests(id<ICECommunicator> communicator) test([logMessages count] == 4); test([prefix isEqual:@"NullLogger"]); - int i = 0; + NSUInteger i = 0; test([((ICELogMessage*)[logMessages objectAtIndex:i]).traceCategory isEqual:@"testCat"] && [((ICELogMessage*)[logMessages objectAtIndex:i++]).message isEqual:@"trace"]); test([((ICELogMessage*)[logMessages objectAtIndex:i++]).message isEqual:@"warning"]); diff --git a/objective-c/test/Ice/binding/AllTests.m b/objective-c/test/Ice/binding/AllTests.m index e3df5180c1e..909ccb6132f 100644 --- a/objective-c/test/Ice/binding/AllTests.m +++ b/objective-c/test/Ice/binding/AllTests.m @@ -89,11 +89,11 @@ getEndpoints(id<TestBindingTestIntfPrx> proxy) { NSMutableArray* edpts = [NSMutableArray array]; bool escape = NO; - int beg = 0; - int length = 0; + NSUInteger beg = 0; + NSUInteger length = 0; NSString* s = [proxy ice_toString]; - int index; - for(index = 0; index < (int)[s length]; ++index) + NSUInteger index; + for(index = 0; index < [s length]; ++index) { unichar c = [s characterAtIndex:index]; if(c == '"') @@ -156,7 +156,7 @@ random_shuffle(NSMutableArray* array) NSUInteger count = [array count]; while(count--) { - [array exchangeObjectAtIndex:count withObjectAtIndex:(random() % (count + 1))]; + [array exchangeObjectAtIndex:count withObjectAtIndex:(NSUInteger)random() % (count + 1)]; } } diff --git a/objective-c/test/Ice/enums/AllTests.m b/objective-c/test/Ice/enums/AllTests.m index dd8c8477a64..b116c9ec60d 100644 --- a/objective-c/test/Ice/enums/AllTests.m +++ b/objective-c/test/Ice/enums/AllTests.m @@ -94,9 +94,9 @@ enumAllTests(id<ICECommunicator> communicator) TestEnumbenum6, TestEnumbenum7, TestEnumbenum8, TestEnumbenum9, TestEnumbenum10, TestEnumbenum11}; - int enumSize = sizeof(TestEnumByteEnum); - int length = sizeof(values); - int elements = length/enumSize; + NSUInteger enumSize = sizeof(TestEnumByteEnum); + NSUInteger length = sizeof(values); + NSUInteger elements = length / enumSize; TestEnumMutableByteEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length]; TestEnumMutableByteEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length]; @@ -106,7 +106,7 @@ enumAllTests(id<ICECommunicator> communicator) ICEByte* p2 = (ICEByte *)[enumSeq2 bytes]; ICEByte* p3 = (ICEByte *)[enumSeq3 bytes]; - for(int i = 0; i < elements; ++i) + for(NSUInteger i = 0; i < elements; ++i) { test(*p1 == *p2); test(*p1 == *p3); @@ -121,9 +121,9 @@ enumAllTests(id<ICECommunicator> communicator) TestEnumsenum6, TestEnumsenum7, TestEnumsenum8, TestEnumsenum9, TestEnumsenum10, TestEnumsenum11}; - int enumSize = sizeof(TestEnumShortEnum); - int length = sizeof(values); - int elements = length/enumSize; + NSUInteger enumSize = sizeof(TestEnumShortEnum); + NSUInteger length = sizeof(values); + NSUInteger elements = length / enumSize; TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length]; TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length]; @@ -133,7 +133,7 @@ enumAllTests(id<ICECommunicator> communicator) ICEByte* p2 = (ICEByte *)[enumSeq2 bytes]; ICEByte* p3 = (ICEByte *)[enumSeq3 bytes]; - for(int i = 0; i < elements; ++i) + for(NSUInteger i = 0; i < elements; ++i) { test(*p1 == *p2); test(*p1 == *p3); @@ -149,9 +149,9 @@ enumAllTests(id<ICECommunicator> communicator) TestEnumienum6, TestEnumienum7, TestEnumienum8, TestEnumienum9, TestEnumienum10, TestEnumienum11}; - int enumSize = sizeof(TestEnumShortEnum); - int length = sizeof(values); - int elements = length/enumSize; + NSUInteger enumSize = sizeof(TestEnumShortEnum); + NSUInteger length = sizeof(values); + NSUInteger elements = length / enumSize; TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length]; TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length]; @@ -161,7 +161,7 @@ enumAllTests(id<ICECommunicator> communicator) ICEByte* p2 = (ICEByte *)[enumSeq2 bytes]; ICEByte* p3 = (ICEByte *)[enumSeq3 bytes]; - for(int i = 0; i < elements; ++i) + for(NSUInteger i = 0; i < elements; ++i) { test(*p1 == *p2); test(*p1 == *p3); @@ -175,9 +175,9 @@ enumAllTests(id<ICECommunicator> communicator) TestEnumSimpleEnum values[] = {TestEnumred, TestEnumgreen, TestEnumblue}; - int enumSize = sizeof(TestEnumShortEnum); - int length = sizeof(values); - int elements = length/enumSize; + NSUInteger enumSize = sizeof(TestEnumShortEnum); + NSUInteger length = sizeof(values); + NSUInteger elements = length / enumSize; TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length]; TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length]; @@ -187,7 +187,7 @@ enumAllTests(id<ICECommunicator> communicator) ICEByte* p2 = (ICEByte *)[enumSeq2 bytes]; ICEByte* p3 = (ICEByte *)[enumSeq3 bytes]; - for(int i = 0; i < elements; ++i) + for(NSUInteger i = 0; i < elements; ++i) { test(*p1 == *p2); test(*p1 == *p3); @@ -260,11 +260,11 @@ enumAllTests(id<ICECommunicator> communicator) TestEnumbenum6, (TestEnumByteEnum)-1, TestEnumbenum8, TestEnumbenum9, TestEnumbenum10, TestEnumbenum11}; // Negative enumerators are not supported - int length = sizeof(values); + NSUInteger length = sizeof(values); TestEnumMutableByteEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length]; TestEnumMutableByteEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length]; - @try + @try { [proxy opByteSeq:enumSeq1 b2:&enumSeq2]; test(NO); @@ -279,11 +279,11 @@ enumAllTests(id<ICECommunicator> communicator) TestEnumbenum6, (TestEnumByteEnum)127, TestEnumbenum8, TestEnumbenum9, TestEnumbenum10, TestEnumbenum11}; // Invalid enumerator - int length = sizeof(values); + NSUInteger length = sizeof(values); TestEnumMutableByteEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length]; TestEnumMutableByteEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length]; - @try + @try { [proxy opByteSeq:enumSeq1 b2:&enumSeq2]; test(NO); @@ -299,7 +299,7 @@ enumAllTests(id<ICECommunicator> communicator) (TestEnumShortEnum)-1, TestEnumsenum7, TestEnumsenum8, TestEnumsenum9, TestEnumsenum10, TestEnumsenum11}; // Negative enumerators are not supported - int length = sizeof(values); + NSUInteger length = sizeof(values); TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length]; TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length]; @@ -319,7 +319,7 @@ enumAllTests(id<ICECommunicator> communicator) (TestEnumShortEnum)0, TestEnumsenum7, TestEnumsenum8, TestEnumsenum9, TestEnumsenum10, TestEnumsenum11}; // Invalid enumerator - int length = sizeof(values); + NSUInteger length = sizeof(values); TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length]; TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length]; @@ -339,7 +339,7 @@ enumAllTests(id<ICECommunicator> communicator) (TestEnumShortEnum)32767, TestEnumsenum7, TestEnumsenum8, TestEnumsenum9, TestEnumsenum10, TestEnumsenum11}; // Invalid enumerator - int length = sizeof(values); + NSUInteger length = sizeof(values); TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length]; TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length]; @@ -359,7 +359,7 @@ enumAllTests(id<ICECommunicator> communicator) (TestEnumIntEnum)-1, TestEnumienum7, TestEnumienum8, TestEnumienum9, TestEnumienum10, TestEnumienum11}; // Negative enumerators are not supported - int length = sizeof(values); + NSUInteger length = sizeof(values); TestEnumMutableShortEnumSeq* enumSeq1 = [NSMutableData dataWithBytes:values length:length]; TestEnumMutableShortEnumSeq* enumSeq2 = [NSMutableData dataWithLength:length]; diff --git a/objective-c/test/Ice/exceptions/TestI.m b/objective-c/test/Ice/exceptions/TestI.m index 17463a7d8d4..bcfceb948db 100644 --- a/objective-c/test/Ice/exceptions/TestI.m +++ b/objective-c/test/Ice/exceptions/TestI.m @@ -109,7 +109,7 @@ -(ICEByteSeq*) throwMemoryLimitException:(ICEMutableByteSeq*)__unused bs current:(ICECurrent*)__unused current { - int limit = 20 * 1024; + NSUInteger limit = 20 * 1024; ICEMutableByteSeq *r = [NSMutableData dataWithLength:limit]; ICEByte *p = (ICEByte *)[r bytes]; while(--limit > 0) diff --git a/objective-c/test/Ice/hash/AllTests.m b/objective-c/test/Ice/hash/AllTests.m index c5da614c8b4..8533410f39b 100644 --- a/objective-c/test/Ice/hash/AllTests.m +++ b/objective-c/test/Ice/hash/AllTests.m @@ -89,9 +89,9 @@ hashAllTests() NSMutableDictionary* seenObject = [[NSMutableDictionary alloc] init]; for(int i = 0; collisions < maxCollisions && i < maxIterations; ++i) { - TestHashPointF* obj = [TestHashPointF pointF:(arc4random() % 1000)/3.0 - y:(arc4random() % 1000)/5.0 - z:(arc4random() % 1000)/7.0]; + TestHashPointF* obj = [TestHashPointF pointF:(arc4random() % 1000) / 3.0f + y:(arc4random() % 1000) / 5.0f + z:(arc4random() % 1000) / 7.0f]; NSNumber* hash = [NSNumber numberWithUnsignedInteger:[obj hash]]; if([seenObject objectForKey:hash]) diff --git a/objective-c/test/Ice/hold/TestI.m b/objective-c/test/Ice/hold/TestI.m index 0213fb0d165..c1e5a4e5f1d 100644 --- a/objective-c/test/Ice/hold/TestI.m +++ b/objective-c/test/Ice/hold/TestI.m @@ -28,7 +28,7 @@ -(void) schedule:(void(^)(void))callback timeout:(ICEInt)t { dispatch_source_t timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); - dispatch_source_set_timer(timer, dispatch_time(DISPATCH_TIME_NOW, t * NSEC_PER_MSEC), DISPATCH_TIME_FOREVER, 0); + dispatch_source_set_timer(timer, dispatch_time(DISPATCH_TIME_NOW, t * (ICEInt)NSEC_PER_MSEC), DISPATCH_TIME_FOREVER, 0); dispatch_source_set_event_handler(timer, ^{ callback(); dispatch_source_cancel(timer); diff --git a/objective-c/test/Ice/operations/TestI.m b/objective-c/test/Ice/operations/TestI.m index a61bf84f388..c5e7a9b6e4d 100644 --- a/objective-c/test/Ice/operations/TestI.m +++ b/objective-c/test/Ice/operations/TestI.m @@ -145,8 +145,8 @@ *p5 = [TestOperationsMutableIntS dataWithLength:[p2 length]]; ICEInt *target = (ICEInt *)[*p5 bytes]; ICEInt *src = (ICEInt *)([p2 bytes] + [p2 length]); - int i; - for(i = 0; i != (int)[p2 length] / sizeof(ICEInt); ++i) + NSUInteger i; + for(i = 0; i != [p2 length] / sizeof(ICEInt); ++i) { *target++ = *--src; } @@ -855,8 +855,6 @@ } @end - - @implementation TestOperationsBI -(void) opB:(ICECurrent*)__unused current diff --git a/objective-c/test/Ice/operations/Twoways.m b/objective-c/test/Ice/operations/Twoways.m index 8cc9825a59a..40c74784603 100644 --- a/objective-c/test/Ice/operations/Twoways.m +++ b/objective-c/test/Ice/operations/Twoways.m @@ -1460,7 +1460,7 @@ twoways(id<ICECommunicator> communicator, id<TestOperationsMyClassPrx> p, id<Tes ICEFloat buf1[] = { -1.1f, 123123.2f, 100.0f }; ICEFloat buf2[] = { 42.24f, -1.61f }; - ICEFloat buf3[] = { -3.14, 3.14 }; + ICEFloat buf3[] = { -3.14f, 3.14f }; TestOperationsMutableFloatS *si1 = [TestOperationsMutableFloatS data]; TestOperationsMutableFloatS *si2 = [TestOperationsMutableFloatS data]; @@ -1629,17 +1629,17 @@ twoways(id<ICECommunicator> communicator, id<TestOperationsMyClassPrx> p, id<Tes } { - const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; + const NSUInteger lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; - int l; + NSUInteger l; for(l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l) { TestOperationsMutableIntS *s = [TestOperationsMutableIntS dataWithLength:(lengths[l] * sizeof(ICEInt))]; ICEInt *ip = (ICEInt *)[s bytes]; - int i; + NSUInteger i; for(i = 0; i < lengths[l]; ++i) { - *ip++ = i; + *ip++ = (ICEInt)i; } TestOperationsIntS *r = [p opIntS:s]; test([r length] == lengths[l] * sizeof(ICEInt)); diff --git a/objective-c/test/Ice/operations/TwowaysAMI.m b/objective-c/test/Ice/operations/TwowaysAMI.m index 1a111534990..a2b1b886129 100644 --- a/objective-c/test/Ice/operations/TwowaysAMI.m +++ b/objective-c/test/Ice/operations/TwowaysAMI.m @@ -1813,7 +1813,7 @@ twowaysAMI(id<ICECommunicator> communicator, id<TestOperationsMyClassPrx> p) ICEFloat buf1[] = { -1.1f, 123123.2f, 100.0f }; ICEFloat buf2[] = { 42.24f, -1.61f }; - ICEFloat buf3[] = { -3.14, 3.14 }; + ICEFloat buf3[] = { -3.14f, 3.14f }; TestOperationsMutableFloatS *si1 = [TestOperationsMutableFloatS data]; TestOperationsMutableFloatS *si2 = [TestOperationsMutableFloatS data]; @@ -1928,17 +1928,18 @@ twowaysAMI(id<ICECommunicator> communicator, id<TestOperationsMyClassPrx> p) } { - const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; + const NSUInteger lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 }; - int l; + NSUInteger l; for(l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l) { - TestOperationsMutableIntS *s = [TestOperationsMutableIntS dataWithLength:(lengths[l] * sizeof(ICEInt))]; + TestOperationsMutableIntS *s = + [TestOperationsMutableIntS dataWithLength:(lengths[l] * sizeof(ICEInt))]; ICEInt *ip = (ICEInt *)[s bytes]; - int i; + NSUInteger i; for(i = 0; i < lengths[l]; ++i) { - *ip++ = i; + *ip++ = (ICEInt)i; } TestAMIOperationsCallback* cb = [TestAMIOperationsCallback create]; diff --git a/objective-c/test/Ice/proxy/AllTests.m b/objective-c/test/Ice/proxy/AllTests.m index 50fc2cbb7bd..8519772a1b3 100644 --- a/objective-c/test/Ice/proxy/AllTests.m +++ b/objective-c/test/Ice/proxy/AllTests.m @@ -714,6 +714,8 @@ proxyAllTests(id<ICECommunicator> communicator) id<ICEConnection> connection = [cl ice_getConnection]; if(connection != nil) { + test(![cl ice_isFixed]); + test([[cl ice_fixed:connection] ice_isFixed]); [[cl ice_fixed:connection] getContext]; test([[[cl ice_secure:YES] ice_fixed:connection] ice_isSecure]); test([[[[cl ice_facet:@"facet"] ice_fixed:connection] ice_getFacet] isEqualToString:@"facet"]); diff --git a/objective-c/test/Ice/slicing/objects/AllTests.m b/objective-c/test/Ice/slicing/objects/AllTests.m index 0dc911dfbbe..f41db004813 100644 --- a/objective-c/test/Ice/slicing/objects/AllTests.m +++ b/objective-c/test/Ice/slicing/objects/AllTests.m @@ -680,13 +680,13 @@ static void breakCycles(id o) test([res isKindOfClass:[TestSlicingObjectsClientPCDerived3 class]]); TestSlicingObjectsClientPCDerived3* p3 = (TestSlicingObjectsClientPCDerived3*)res; test(p3.pi == 3); - for(int i = 0; i < 300; ++i) + for(NSUInteger i = 0; i < 300; ++i) { TestSlicingObjectsClientPCDerived2* p2 = (TestSlicingObjectsClientPCDerived2*)[p3.pbs objectAtIndex:i]; - test(p2.pi == i); + test(p2.pi == (ICEInt)i); test([p2.pbs count] == 1); test([[p2.pbs objectAtIndex:0] isEqual:[NSNull null]]); - test(p2.pcd2 == i); + test(p2.pcd2 == (ICEInt)i); } test(p3.pcd2 == p3.pi); test([p3.pcd3 isEqual:[p3.pbs objectAtIndex:10]]); @@ -2293,14 +2293,14 @@ slicingObjectsAllTests(id<ICECommunicator> communicator) // // Sending more than 254 objects exercises the encoding for object ids. // - int i; + NSUInteger i; pcd.pbs = [NSArray array]; for(i = 0; i < 300; ++i) { TestSlicingObjectsClientPCDerived2* p2 = [TestSlicingObjectsClientPCDerived2 pcDerived2]; - p2.pi = i; + p2.pi = (ICEInt)i; p2.pbs = [NSArray arrayWithObjects:[NSNull null], nil]; // Nil reference. This slice should not have an indirection table. - p2.pcd2 = i; + p2.pcd2 = (ICEInt)i; pcd.pbs = [pcd.pbs arrayByAddingObject:p2]; } pcd.pcd2 = pcd.pi; @@ -2321,10 +2321,10 @@ slicingObjectsAllTests(id<ICECommunicator> communicator) for(i = 0; i < 300; ++i) { TestSlicingObjectsClientPCDerived2* p2 = (TestSlicingObjectsClientPCDerived2*)[p3.pbs objectAtIndex:i]; - test(p2.pi == i); + test(p2.pi == (ICEInt)i); test([p2.pbs count] == 1); test([[p2.pbs objectAtIndex:0] isEqual:[NSNull null]]); - test(p2.pcd2 == i); + test(p2.pcd2 == (ICEInt)i); } test(p3.pcd2 == p3.pi); test(p3.pcd3 == [p3.pbs objectAtIndex:10]); diff --git a/objective-c/test/Ice/stream/Client.m b/objective-c/test/Ice/stream/Client.m index 0fd785433d8..b51a3b43f29 100644 --- a/objective-c/test/Ice/stream/Client.m +++ b/objective-c/test/Ice/stream/Client.m @@ -477,7 +477,7 @@ run(id<ICECommunicator> communicator) TestStreamSmallStructS* arr2 = [TestStreamSmallStructSHelper read:in]; [in readPendingValues]; test([arr2 count] == [arr count]); - for(int j = 0; j < (int)[arr2 count]; ++j) + for(NSUInteger j = 0; j < [arr2 count]; ++j) { test([[arr objectAtIndex:j] isEqual:[arr2 objectAtIndex:j]]); } @@ -548,7 +548,7 @@ run(id<ICECommunicator> communicator) [in readPendingValues]; test([arr2 count] > 0); test([arr2 count] == [arr count]); - for(int j = 0; j < (int)[arr2 count]; ++j) + for(NSUInteger j = 0; j < [arr2 count]; ++j) { TestStreamMyClass* e = [arr2 objectAtIndex:j]; TestStreamMyClass* f = [arr objectAtIndex:j]; |