Commit b0a4bf54 authored by Damien DeVille's avatar Damien DeVille Committed by Jacob Potter

Change djinni objc generator to generate immutable collections

parent c4171880
......@@ -641,25 +641,27 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
case MList => {
val copyName = "copiedValue_" + valueLevel
val currentName = "currentValue_" + valueLevel
w.wl(s"$to = [NSMutableArray arrayWithCapacity:[$from count]];")
w.wl(s"NSMutableArray *${to}TempArray = [NSMutableArray arrayWithCapacity:[$from count]];")
w.w(s"for (${toObjcTypeDef(tm.args.head, true)}$currentName in $from)").braced {
w.wl(s"id $copyName;")
f(copyName, currentName, tm.args.head, true, w, valueLevel + 1)
w.wl(s"[$to addObject:$copyName];")
w.wl(s"[${to}TempArray addObject:$copyName];")
}
w.wl(s"$to = ${to}TempArray;")
}
case MSet => {
val copyName = "copiedValue_" + valueLevel
val currentName = "currentValue_" + valueLevel
w.wl(s"$to = [NSMutableSet setWithCapacity:[$from count]];")
w.wl(s"NSMutableSet *${to}TempSet = [NSMutableSet setWithCapacity:[$from count]];")
w.w(s"for (${toObjcTypeDef(tm.args.head, true)}$currentName in $from)").braced {
w.wl(s"id $copyName;")
f(copyName, currentName, tm.args.head, true, w, valueLevel + 1)
w.wl(s"[$to addObject:$copyName];")
w.wl(s"[${to}TempSet addObject:$copyName];")
}
w.wl(s"$to = ${to}TempSet;")
}
case MMap => {
w.wl(s"$to = [NSMutableDictionary dictionaryWithCapacity:[$from count]];")
w.wl(s"NSMutableDictionary *${to}TempDictionary = [NSMutableDictionary dictionaryWithCapacity:[$from count]];")
val keyName = "key_" + valueLevel
val valueName = "value_" + valueLevel
val copiedKeyName = "copiedKey_" + valueLevel
......@@ -669,8 +671,9 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
f(copiedKeyName, keyName, tm.args.apply(0), true, w, valueLevel + 1)
w.wl(s"id $valueName = [$from objectForKey:$keyName];")
f(copiedValueName, valueName, tm.args.apply(1), true, w, valueLevel + 1)
w.wl(s"[$to setObject:$copiedValueName forKey:$copiedKeyName];")
w.wl(s"[${to}TempDictionary setObject:$copiedValueName forKey:$copiedKeyName];")
}
w.wl(s"$to = ${to}TempDictionary;")
}
case d: MDef => {
val typeName = d.name
......@@ -737,31 +740,34 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
case MList =>
val objcName = "objcValue_" + valueLevel
val cppName = "cppValue_" + valueLevel
w.wl(s"$objcType$objcIdent = [NSMutableArray arrayWithCapacity:${cppIdent}.size()];")
w.wl(s"NSMutableArray *${objcIdent}TempArray = [NSMutableArray arrayWithCapacity:${cppIdent}.size()];")
w.w(s"for (const auto & $cppName : ${cppIdent})")
w.braced {
f(objcName, cppName, tm.args.head, true, true, w, valueLevel + 1)
w.wl(s"[$objcIdent addObject:$objcName];")
w.wl(s"[${objcIdent}TempArray addObject:$objcName];")
}
w.wl(s"$objcType$objcIdent = ${objcIdent}TempArray;")
case MSet =>
val objcName = "objcValue_" + valueLevel
val cppName = "cppValue_" + valueLevel
w.wl(s"$objcType$objcIdent = [NSMutableSet setWithCapacity:${cppIdent}.size()];")
w.wl(s"NSMutableSet *${objcIdent}TempSet = [NSMutableSet setWithCapacity:${cppIdent}.size()];")
w.w(s"for (const auto & $cppName : ${cppIdent})")
w.braced {
f(objcName, cppName, tm.args.head, true, true, w, valueLevel + 1)
w.wl(s"[$objcIdent addObject:$objcName];")
w.wl(s"[${objcIdent}TempSet addObject:$objcName];")
}
w.wl(s"$objcType$objcIdent = ${objcIdent}TempSet;")
case MMap => {
val cppPairName = "cppPair_" + valueLevel
val objcKeyName = "objcKey_" + valueLevel
val objcValueName = "objcValue_" + valueLevel
w.wl(s"$objcType$objcIdent = [NSMutableDictionary dictionaryWithCapacity:${cppIdent}.size()];")
w.wl(s"NSMutableDictionary *${objcIdent}TempDictionary = [NSMutableDictionary dictionaryWithCapacity:${cppIdent}.size()];")
w.w(s"for (const auto & $cppPairName : ${cppIdent})").braced {
f(objcKeyName, cppPairName + ".first", tm.args.apply(0), true, true, w, valueLevel + 1)
f(objcValueName, cppPairName + ".second", tm.args.apply(1), true, true, w, valueLevel + 1)
w.wl(s"[$objcIdent setObject:$objcValueName forKey:$objcKeyName];")
w.wl(s"[${objcIdent}TempDictionary setObject:$objcValueName forKey:$objcKeyName];")
}
w.wl(s"$objcType$objcIdent = ${objcIdent}TempDictionary;")
}
case d: MDef => {
val typeName = d.name
......@@ -909,9 +915,9 @@ class ObjcGenerator(spec: Spec) extends Generator(spec) {
case MString => ("NSString", true)
case MBinary => ("NSData", true)
case MOptional => throw new AssertionError("optional should have been special cased")
case MList => ("NSMutableArray", true)
case MSet => ("NSMutableSet", true)
case MMap => ("NSMutableDictionary", true)
case MList => ("NSArray", true)
case MSet => ("NSSet", true)
case MMap => ("NSDictionary", true)
case d: MDef => d.defType match {
case DEnum => if (needRef) ("NSNumber", true) else (idObjc.ty(d.name), false)
case DRecord => (idObjc.ty(d.name), true)
......
......@@ -6,8 +6,8 @@
@interface DBMapListRecord : NSObject
- (id)initWithMapListRecord:(DBMapListRecord *)mapListRecord;
- (id)initWithMapList:(NSMutableArray *)mapList;
- (id)initWithMapList:(NSArray *)mapList;
@property (nonatomic, readonly) NSMutableArray *mapList;
@property (nonatomic, readonly) NSArray *mapList;
@end
......@@ -12,24 +12,26 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithMapListRecord:(DBMapListRecord *)mapListRecord
{
if (self = [super init]) {
_mapList = [NSMutableArray arrayWithCapacity:[mapListRecord.mapList count]];
for (NSMutableDictionary *currentValue_0 in mapListRecord.mapList) {
NSMutableArray *_mapListTempArray = [NSMutableArray arrayWithCapacity:[mapListRecord.mapList count]];
for (NSDictionary *currentValue_0 in mapListRecord.mapList) {
id copiedValue_0;
copiedValue_0 = [NSMutableDictionary dictionaryWithCapacity:[currentValue_0 count]];
NSMutableDictionary *copiedValue_0TempDictionary = [NSMutableDictionary dictionaryWithCapacity:[currentValue_0 count]];
for (id key_1 in currentValue_0) {
id copiedKey_1, copiedValue_1;
copiedKey_1 = [key_1 copy];
id value_1 = [currentValue_0 objectForKey:key_1];
copiedValue_1 = value_1;
[copiedValue_0 setObject:copiedValue_1 forKey:copiedKey_1];
[copiedValue_0TempDictionary setObject:copiedValue_1 forKey:copiedKey_1];
}
[_mapList addObject:copiedValue_0];
copiedValue_0 = copiedValue_0TempDictionary;
[_mapListTempArray addObject:copiedValue_0];
}
_mapList = _mapListTempArray;
}
return self;
}
- (id)initWithMapList:(NSMutableArray *)mapList
- (id)initWithMapList:(NSArray *)mapList
{
if (self = [super init]) {
_mapList = mapList;
......@@ -40,18 +42,20 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithCppMapListRecord:(const MapListRecord &)mapListRecord
{
if (self = [super init]) {
_mapList = [NSMutableArray arrayWithCapacity:mapListRecord.map_list.size()];
NSMutableArray *_mapListTempArray = [NSMutableArray arrayWithCapacity:mapListRecord.map_list.size()];
for (const auto & cppValue_0 : mapListRecord.map_list) {
NSMutableDictionary *objcValue_0 = [NSMutableDictionary dictionaryWithCapacity:cppValue_0.size()];
NSMutableDictionary *objcValue_0TempDictionary = [NSMutableDictionary dictionaryWithCapacity:cppValue_0.size()];
for (const auto & cppPair_1 : cppValue_0) {
NSString *objcKey_1 = [[NSString alloc] initWithBytes:cppPair_1.first.data()
length:cppPair_1.first.length()
encoding:NSUTF8StringEncoding];
NSNumber *objcValue_1 = [NSNumber numberWithLongLong:cppPair_1.second];
[objcValue_0 setObject:objcValue_1 forKey:objcKey_1];
[objcValue_0TempDictionary setObject:objcValue_1 forKey:objcKey_1];
}
[_mapList addObject:objcValue_0];
NSDictionary *objcValue_0 = objcValue_0TempDictionary;
[_mapListTempArray addObject:objcValue_0];
}
_mapList = _mapListTempArray;
}
return self;
}
......@@ -60,7 +64,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
{
std::vector<std::unordered_map<std::string, int64_t>> mapList;
mapList.reserve([_mapList count]);
for (NSMutableDictionary *objcValue_0 in _mapList) {
for (NSDictionary *objcValue_0 in _mapList) {
std::unordered_map<std::string, int64_t> cppValue_0;
for (id objcKey_1 in objcValue_0) {
std::string cppKey_1([objcKey_1 UTF8String], [objcKey_1 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
......
......@@ -6,8 +6,8 @@
@interface DBMapRecord : NSObject
- (id)initWithMapRecord:(DBMapRecord *)mapRecord;
- (id)initWithMap:(NSMutableDictionary *)map;
- (id)initWithMap:(NSDictionary *)map;
@property (nonatomic, readonly) NSMutableDictionary *map;
@property (nonatomic, readonly) NSDictionary *map;
@end
......@@ -12,19 +12,20 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithMapRecord:(DBMapRecord *)mapRecord
{
if (self = [super init]) {
_map = [NSMutableDictionary dictionaryWithCapacity:[mapRecord.map count]];
NSMutableDictionary *_mapTempDictionary = [NSMutableDictionary dictionaryWithCapacity:[mapRecord.map count]];
for (id key_0 in mapRecord.map) {
id copiedKey_0, copiedValue_0;
copiedKey_0 = [key_0 copy];
id value_0 = [mapRecord.map objectForKey:key_0];
copiedValue_0 = value_0;
[_map setObject:copiedValue_0 forKey:copiedKey_0];
[_mapTempDictionary setObject:copiedValue_0 forKey:copiedKey_0];
}
_map = _mapTempDictionary;
}
return self;
}
- (id)initWithMap:(NSMutableDictionary *)map
- (id)initWithMap:(NSDictionary *)map
{
if (self = [super init]) {
_map = map;
......@@ -35,14 +36,15 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithCppMapRecord:(const MapRecord &)mapRecord
{
if (self = [super init]) {
_map = [NSMutableDictionary dictionaryWithCapacity:mapRecord.map.size()];
NSMutableDictionary *_mapTempDictionary = [NSMutableDictionary dictionaryWithCapacity:mapRecord.map.size()];
for (const auto & cppPair_0 : mapRecord.map) {
NSString *objcKey_0 = [[NSString alloc] initWithBytes:cppPair_0.first.data()
length:cppPair_0.first.length()
encoding:NSUTF8StringEncoding];
NSNumber *objcValue_0 = [NSNumber numberWithLongLong:cppPair_0.second];
[_map setObject:objcValue_0 forKey:objcKey_0];
[_mapTempDictionary setObject:objcValue_0 forKey:objcKey_0];
}
_map = _mapTempDictionary;
}
return self;
}
......
......@@ -6,8 +6,8 @@
@interface DBNestedCollection : NSObject
- (id)initWithNestedCollection:(DBNestedCollection *)nestedCollection;
- (id)initWithSetList:(NSMutableArray *)setList;
- (id)initWithSetList:(NSArray *)setList;
@property (nonatomic, readonly) NSMutableArray *setList;
@property (nonatomic, readonly) NSArray *setList;
@end
......@@ -12,22 +12,24 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithNestedCollection:(DBNestedCollection *)nestedCollection
{
if (self = [super init]) {
_setList = [NSMutableArray arrayWithCapacity:[nestedCollection.setList count]];
for (NSMutableSet *currentValue_0 in nestedCollection.setList) {
NSMutableArray *_setListTempArray = [NSMutableArray arrayWithCapacity:[nestedCollection.setList count]];
for (NSSet *currentValue_0 in nestedCollection.setList) {
id copiedValue_0;
copiedValue_0 = [NSMutableSet setWithCapacity:[currentValue_0 count]];
NSMutableSet *copiedValue_0TempSet = [NSMutableSet setWithCapacity:[currentValue_0 count]];
for (NSString *currentValue_1 in currentValue_0) {
id copiedValue_1;
copiedValue_1 = [currentValue_1 copy];
[copiedValue_0 addObject:copiedValue_1];
[copiedValue_0TempSet addObject:copiedValue_1];
}
[_setList addObject:copiedValue_0];
copiedValue_0 = copiedValue_0TempSet;
[_setListTempArray addObject:copiedValue_0];
}
_setList = _setListTempArray;
}
return self;
}
- (id)initWithSetList:(NSMutableArray *)setList
- (id)initWithSetList:(NSArray *)setList
{
if (self = [super init]) {
_setList = setList;
......@@ -38,17 +40,19 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithCppNestedCollection:(const NestedCollection &)nestedCollection
{
if (self = [super init]) {
_setList = [NSMutableArray arrayWithCapacity:nestedCollection.set_list.size()];
NSMutableArray *_setListTempArray = [NSMutableArray arrayWithCapacity:nestedCollection.set_list.size()];
for (const auto & cppValue_0 : nestedCollection.set_list) {
NSMutableSet *objcValue_0 = [NSMutableSet setWithCapacity:cppValue_0.size()];
NSMutableSet *objcValue_0TempSet = [NSMutableSet setWithCapacity:cppValue_0.size()];
for (const auto & cppValue_1 : cppValue_0) {
NSString *objcValue_1 = [[NSString alloc] initWithBytes:cppValue_1.data()
length:cppValue_1.length()
encoding:NSUTF8StringEncoding];
[objcValue_0 addObject:objcValue_1];
[objcValue_0TempSet addObject:objcValue_1];
}
[_setList addObject:objcValue_0];
NSSet *objcValue_0 = objcValue_0TempSet;
[_setListTempArray addObject:objcValue_0];
}
_setList = _setListTempArray;
}
return self;
}
......@@ -57,7 +61,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
{
std::vector<std::unordered_set<std::string>> setList;
setList.reserve([_setList count]);
for (NSMutableSet *objcValue_0 in _setList) {
for (NSSet *objcValue_0 in _setList) {
std::unordered_set<std::string> cppValue_0;
for (NSString *objcValue_1 in objcValue_0) {
std::string cppValue_1([objcValue_1 UTF8String], [objcValue_1 lengthOfBytesUsingEncoding:NSUTF8StringEncoding]);
......
......@@ -6,8 +6,8 @@
@interface DBPrimitiveList : NSObject
- (id)initWithPrimitiveList:(DBPrimitiveList *)primitiveList;
- (id)initWithList:(NSMutableArray *)list;
- (id)initWithList:(NSArray *)list;
@property (nonatomic, readonly) NSMutableArray *list;
@property (nonatomic, readonly) NSArray *list;
@end
......@@ -12,17 +12,18 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithPrimitiveList:(DBPrimitiveList *)primitiveList
{
if (self = [super init]) {
_list = [NSMutableArray arrayWithCapacity:[primitiveList.list count]];
NSMutableArray *_listTempArray = [NSMutableArray arrayWithCapacity:[primitiveList.list count]];
for (NSNumber *currentValue_0 in primitiveList.list) {
id copiedValue_0;
copiedValue_0 = currentValue_0;
[_list addObject:copiedValue_0];
[_listTempArray addObject:copiedValue_0];
}
_list = _listTempArray;
}
return self;
}
- (id)initWithList:(NSMutableArray *)list
- (id)initWithList:(NSArray *)list
{
if (self = [super init]) {
_list = list;
......@@ -33,11 +34,12 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithCppPrimitiveList:(const PrimitiveList &)primitiveList
{
if (self = [super init]) {
_list = [NSMutableArray arrayWithCapacity:primitiveList.list.size()];
NSMutableArray *_listTempArray = [NSMutableArray arrayWithCapacity:primitiveList.list.size()];
for (const auto & cppValue_0 : primitiveList.list) {
NSNumber *objcValue_0 = [NSNumber numberWithLongLong:cppValue_0];
[_list addObject:objcValue_0];
[_listTempArray addObject:objcValue_0];
}
_list = _listTempArray;
}
return self;
}
......
......@@ -6,8 +6,8 @@
@interface DBSetRecord : NSObject
- (id)initWithSetRecord:(DBSetRecord *)setRecord;
- (id)initWithSet:(NSMutableSet *)set;
- (id)initWithSet:(NSSet *)set;
@property (nonatomic, readonly) NSMutableSet *set;
@property (nonatomic, readonly) NSSet *set;
@end
......@@ -12,17 +12,18 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithSetRecord:(DBSetRecord *)setRecord
{
if (self = [super init]) {
_set = [NSMutableSet setWithCapacity:[setRecord.set count]];
NSMutableSet *_setTempSet = [NSMutableSet setWithCapacity:[setRecord.set count]];
for (NSString *currentValue_0 in setRecord.set) {
id copiedValue_0;
copiedValue_0 = [currentValue_0 copy];
[_set addObject:copiedValue_0];
[_setTempSet addObject:copiedValue_0];
}
_set = _setTempSet;
}
return self;
}
- (id)initWithSet:(NSMutableSet *)set
- (id)initWithSet:(NSSet *)set
{
if (self = [super init]) {
_set = set;
......@@ -33,13 +34,14 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
- (id)initWithCppSetRecord:(const SetRecord &)setRecord
{
if (self = [super init]) {
_set = [NSMutableSet setWithCapacity:setRecord.set.size()];
NSMutableSet *_setTempSet = [NSMutableSet setWithCapacity:setRecord.set.size()];
for (const auto & cppValue_0 : setRecord.set) {
NSString *objcValue_0 = [[NSString alloc] initWithBytes:cppValue_0.data()
length:cppValue_0.length()
encoding:NSUTF8StringEncoding];
[_set addObject:objcValue_0];
[_setTempSet addObject:objcValue_0];
}
_set = _setTempSet;
}
return self;
}
......
......@@ -26,13 +26,13 @@
+ (BOOL)checkNestedCollection:(DBNestedCollection *)nc;
+ (NSMutableDictionary *)getMap;
+ (NSDictionary *)getMap;
+ (BOOL)checkMap:(NSMutableDictionary *)m;
+ (BOOL)checkMap:(NSDictionary *)m;
+ (NSMutableDictionary *)getEmptyMap;
+ (NSDictionary *)getEmptyMap;
+ (BOOL)checkEmptyMap:(NSMutableDictionary *)m;
+ (BOOL)checkEmptyMap:(NSDictionary *)m;
+ (DBMapListRecord *)getMapListRecord;
......@@ -42,7 +42,7 @@
+ (void)checkClientInterfaceNonascii:(id <DBClientInterface>)i;
+ (void)checkEnumMap:(NSMutableDictionary *)m;
+ (void)checkEnumMap:(NSDictionary *)m;
+ (id <DBToken>)tokenId:(id <DBToken>)t;
......
......@@ -91,22 +91,23 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSMutableDictionary *)getMap {
+ (NSDictionary *)getMap {
try {
std::unordered_map<std::string, int64_t> cppRet = TestHelpers::get_map();
NSMutableDictionary *objcRet = [NSMutableDictionary dictionaryWithCapacity:cppRet.size()];
NSMutableDictionary *objcRetTempDictionary = [NSMutableDictionary dictionaryWithCapacity:cppRet.size()];
for (const auto & cppPair_0 : cppRet) {
NSString *objcKey_0 = [[NSString alloc] initWithBytes:cppPair_0.first.data()
length:cppPair_0.first.length()
encoding:NSUTF8StringEncoding];
NSNumber *objcValue_0 = [NSNumber numberWithLongLong:cppPair_0.second];
[objcRet setObject:objcValue_0 forKey:objcKey_0];
[objcRetTempDictionary setObject:objcValue_0 forKey:objcKey_0];
}
NSDictionary *objcRet = objcRetTempDictionary;
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkMap:(NSMutableDictionary *)m {
+ (BOOL)checkMap:(NSDictionary *)m {
try {
std::unordered_map<std::string, int64_t> cppM;
for (id objcKey_0 in m) {
......@@ -120,22 +121,23 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (NSMutableDictionary *)getEmptyMap {
+ (NSDictionary *)getEmptyMap {
try {
std::unordered_map<std::string, int64_t> cppRet = TestHelpers::get_empty_map();
NSMutableDictionary *objcRet = [NSMutableDictionary dictionaryWithCapacity:cppRet.size()];
NSMutableDictionary *objcRetTempDictionary = [NSMutableDictionary dictionaryWithCapacity:cppRet.size()];
for (const auto & cppPair_0 : cppRet) {
NSString *objcKey_0 = [[NSString alloc] initWithBytes:cppPair_0.first.data()
length:cppPair_0.first.length()
encoding:NSUTF8StringEncoding];
NSNumber *objcValue_0 = [NSNumber numberWithLongLong:cppPair_0.second];
[objcRet setObject:objcValue_0 forKey:objcKey_0];
[objcRetTempDictionary setObject:objcValue_0 forKey:objcKey_0];
}
NSDictionary *objcRet = objcRetTempDictionary;
return objcRet;
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (BOOL)checkEmptyMap:(NSMutableDictionary *)m {
+ (BOOL)checkEmptyMap:(NSDictionary *)m {
try {
std::unordered_map<std::string, int64_t> cppM;
for (id objcKey_0 in m) {
......@@ -180,7 +182,7 @@ static_assert(__has_feature(objc_arc), "Djinni requires ARC to be enabled for th
} DJINNI_TRANSLATE_EXCEPTIONS()
}
+ (void)checkEnumMap:(NSMutableDictionary *)m {
+ (void)checkEnumMap:(NSDictionary *)m {
try {
std::unordered_map<color, std::string> cppM;
for (id objcKey_0 in m) {
......
......@@ -54,7 +54,7 @@
{
MapListRecord cppMapListRecord{ { [self getCppMap] } };
DBMapListRecord *objcMapListRecord = [[DBMapListRecord alloc] initWithCppMapListRecord:cppMapListRecord];
NSMutableArray *objcMapList = objcMapListRecord.mapList;
NSArray *objcMapList = objcMapListRecord.mapList;
XCTAssertEqual([objcMapList count], 1, @"List with 1 map expected, actual no: %lu", (unsigned long)[objcMapList count]);
[self checkObjcMap:[objcMapList objectAtIndex:0]];
}
......@@ -77,7 +77,7 @@
XCTAssertEqual(cppMap.at("String3"), 3, @"\"String3 -> 3\" expected");
}
- (void)checkObjcMap:(NSMutableDictionary *)objcMap
- (void)checkObjcMap:(NSDictionary *)objcMap
{
XCTAssertEqual([objcMap count], 3, @"Count 3 expected, actual: %lu", (unsigned long)[objcMap count]);
XCTAssertEqual([objcMap objectForKey:@"String1"], [NSNumber numberWithLongLong:1], @"\"String1 -> 1\" expected");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment