Fix coding unit test and tolerate size differences

This commit is contained in:
Hugo Melder 2022-08-04 13:05:43 +02:00
parent 42efca0754
commit e6789cb7ed
15 changed files with 8 additions and 10 deletions

Binary file not shown.

Binary file not shown.

View file

@ -114,15 +114,10 @@ void testReadBasicType_##testName (char *pre, testType *expect, testType *toDeco
NSData *data; \ NSData *data; \
NSUnarchiver *unArch; \ NSUnarchiver *unArch; \
NSString *str2; \ NSString *str2; \
NSArray *encodedFiles; \ NSString *fileName; \
NSString *prefix = [[NSString stringWithCString:pre] retain]; \ long typeSize = sizeof(testType); \
unsigned int i, c; \ fileName = [[NSString stringWithFormat:@"%s-%li.type",pre,typeSize] retain]; \
encodedFiles = [[NSBundle bundleWithPath: [fm currentDirectoryPath]] \ if ([fm isReadableFileAtPath:fileName]) \
pathsForResourcesOfType:@"type" inDirectory:nil]; \
for (i = 0, c = [encodedFiles count]; i < c; i++) \
{ \
NSString *fileName = [encodedFiles objectAtIndex:i]; \
if ([[fileName lastPathComponent] hasPrefix:prefix]) \
{ \ { \
data = [NSData dataWithContentsOfFile:fileName]; \ data = [NSData dataWithContentsOfFile:fileName]; \
unArch = [[NSUnarchiver alloc] initForReadingWithData:data]; \ unArch = [[NSUnarchiver alloc] initForReadingWithData:data]; \
@ -136,6 +131,9 @@ void testReadBasicType_##testName (char *pre, testType *expect, testType *toDeco
PASS((VAL_TEST(*expect,*toDecode) && [str isEqual:str2]), \ PASS((VAL_TEST(*expect,*toDecode) && [str isEqual:str2]), \
"can unarchive %s from %s", pre, [fileName UTF8String]); \ "can unarchive %s from %s", pre, [fileName UTF8String]); \
} \ } \
else \
{ \
PASS(1 == 2, "Archive %s not found.", [fileName UTF8String]); \
} \ } \
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.