From e6789cb7edceaa9c9b9ffca16a205403b20e1944 Mon Sep 17 00:00:00 2001 From: Hugo Melder Date: Thu, 4 Aug 2022 13:05:43 +0200 Subject: [PATCH] Fix coding unit test and tolerate size differences --- Tests/base/coding/BOOL-1.type | Bin 158 -> 0 bytes Tests/base/coding/BOOL-4.type | Bin 0 -> 161 bytes Tests/base/coding/basictypes.m | 18 ++++++++---------- Tests/base/coding/double-8.type | Bin 138 -> 165 bytes Tests/base/coding/float-4.type | Bin 134 -> 161 bytes Tests/base/coding/int-4.type | Bin 134 -> 161 bytes Tests/base/coding/llong-8.type | Bin 138 -> 165 bytes Tests/base/coding/long-4.type | Bin 134 -> 161 bytes Tests/base/coding/schar-1.type | Bin 131 -> 158 bytes Tests/base/coding/short-2.type | Bin 132 -> 159 bytes Tests/base/coding/uchar-1.type | Bin 131 -> 158 bytes Tests/base/coding/uint-4.type | Bin 134 -> 161 bytes Tests/base/coding/ullong-8.type | Bin 138 -> 165 bytes Tests/base/coding/ulong-4.type | Bin 134 -> 161 bytes Tests/base/coding/ushort-2.type | Bin 132 -> 159 bytes 15 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 Tests/base/coding/BOOL-1.type create mode 100644 Tests/base/coding/BOOL-4.type diff --git a/Tests/base/coding/BOOL-1.type b/Tests/base/coding/BOOL-1.type deleted file mode 100644 index 856c02bd280b53166a9aa01352c6cc85334c6569..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 158 zcmZ?w3oR~5El@}-O3uhEOEoYsNHZ}qF|YzMzyJ$_iP3=3kdcAIFF3fQC^Ijefq{Y1 zkO{>1Ps&P7E&=ix7}S7RS`|oeiGo-x3@!}$3OEDci3B?@A(Ft{+}Gbk|R0m%{|UBZyaPzvOM*cm`}0T5OK Q*=b-=1%@P`SPnxD0Fa>`C;$Ke literal 0 HcmV?d00001 diff --git a/Tests/base/coding/basictypes.m b/Tests/base/coding/basictypes.m index 01789f1fa..6291621e4 100644 --- a/Tests/base/coding/basictypes.m +++ b/Tests/base/coding/basictypes.m @@ -114,15 +114,10 @@ void testReadBasicType_##testName (char *pre, testType *expect, testType *toDeco NSData *data; \ NSUnarchiver *unArch; \ NSString *str2; \ - NSArray *encodedFiles; \ - NSString *prefix = [[NSString stringWithCString:pre] retain]; \ - unsigned int i, c; \ - encodedFiles = [[NSBundle bundleWithPath: [fm currentDirectoryPath]] \ - pathsForResourcesOfType:@"type" inDirectory:nil]; \ - for (i = 0, c = [encodedFiles count]; i < c; i++) \ - { \ - NSString *fileName = [encodedFiles objectAtIndex:i]; \ - if ([[fileName lastPathComponent] hasPrefix:prefix]) \ + NSString *fileName; \ + long typeSize = sizeof(testType); \ + fileName = [[NSString stringWithFormat:@"%s-%li.type",pre,typeSize] retain]; \ + if ([fm isReadableFileAtPath:fileName]) \ { \ data = [NSData dataWithContentsOfFile:fileName]; \ unArch = [[NSUnarchiver alloc] initForReadingWithData:data]; \ @@ -136,7 +131,10 @@ void testReadBasicType_##testName (char *pre, testType *expect, testType *toDeco PASS((VAL_TEST(*expect,*toDecode) && [str isEqual:str2]), \ "can unarchive %s from %s", pre, [fileName UTF8String]); \ } \ - } \ + else \ + { \ + PASS(1 == 2, "Archive %s not found.", [fileName UTF8String]); \ + } \ } #define VAL_TEST(testX,testY) testX == testY diff --git a/Tests/base/coding/double-8.type b/Tests/base/coding/double-8.type index 9623fc75cbbf0227f0b2c01ee2ab5e3ec54eebbc..cc4332d80e47cb2fce0ddcde7c64431b8bccf53d 100644 GIT binary patch delta 97 zcmeBTT*@fn?iX5Il3JjUSd^TRS(a*GV31~FWMW`7kzabEv8gSWC<6n7Gz)_ZLq3B7 mLmrSU0n#N5i43Jc9*CU*WETKoC6Jv47FA$K0*d7@7#O6PT=Et2@=Fv-5=-++6fzPE P3Mv)SO7j$w5_56@Y5x;w diff --git a/Tests/base/coding/float-4.type b/Tests/base/coding/float-4.type index 418e1f8af566cfe274b78f3842a8d469e2282069..a888d6ea7d3434d7e7f79b93d231163fdb5a4a42 100644 GIT binary patch delta 97 zcmZo;T*xTl?iX5Il3JjUSd^TRS(a*GV31~FWMW`7kzabEv7s%OC<6n7Gz)_ZLq3B7 mLmrSU0n#N5i43Jc9*CU*WETKoC6Jv47FA$K0*d7@7#O6PT=Et2@=Fv-5=-++6fzPE P3Mv)SO7j$w5_56@XKxc+ diff --git a/Tests/base/coding/int-4.type b/Tests/base/coding/int-4.type index d5e553094c74c2a3b0fe14782dedb7efc9d938f9..ac6c93e1e6a6e5d97e323ebdca0367878b61b81d 100644 GIT binary patch delta 97 zcmZo;T*xTl?iX5Il3JjUSd^TRS(a*GV31~FWMW`7kzabEv7s%OC<6n7Gz)_ZLq3B7 mLmrSU0n#N5i43Jc9*CU*WETKoC6Jv47FA$K0*d7@7#O6PT=Et2@=Fv-5=-++6fzPE P3Mv)SO7j$w5_56@XKxc+ diff --git a/Tests/base/coding/llong-8.type b/Tests/base/coding/llong-8.type index d29b0874bac832cf81afb002aea375c340c341e2..35e6ac4eb2b27e5f5e7c5c86613f3e49f4089b98 100644 GIT binary patch delta 97 zcmeBTT*@fn?iX5Il3JjUSd^TRS(a*GV31~FWMW`7kzabEv8gSWC<6n7Gz)_ZLq3B7 mLmrSU0n#N5i43Jc9*CU*WETKoC6Jv47FA$K0*d7@7#O6PT=Et2@=Fv-5=-++6fzPE P3Mv)SO7j$w5_56@Y5x;w diff --git a/Tests/base/coding/long-4.type b/Tests/base/coding/long-4.type index 74997a342616f265999ca5282d7ef430379ce270..5bd50f003be9c4707825ed60dd55c0859e054f3a 100644 GIT binary patch delta 97 zcmZo;T*xTl?iX5Il3JjUSd^TRS(a*GV31~FWMW`7kzabEv7s%OC<6n7Gz)_ZLq3B7 mLmrSU0n#N5i43Jc9*CU*WETKoC6Jv47FA$K0*d7@7#O6PT=Et2@=Fv-5=-++6fzPE P3Mv)SO7j$w5_56@XKxc+ diff --git a/Tests/base/coding/schar-1.type b/Tests/base/coding/schar-1.type index 06767dff075f560ee85827cd050ebed88ffb4148..446fd564630dba42c461a2bccc0ecead105f7342 100644 GIT binary patch delta 97 zcmZo>oX05P?iX5Il3JjUSd^TRS(a*GV31~FWMW`7kzabEv7RlLC<6n7Gz)_ZLq3B7 mLmrSU0n#N5i43Jc9*CU*WETKoC6Jv47FA$K0*d7@7#O6PT=Et2@=Fv-5=-++6fzPE P3Mv)SO7j$w5_56@W+xL? diff --git a/Tests/base/coding/uchar-1.type b/Tests/base/coding/uchar-1.type index 8d55b81df1fb17626835610d2bb111953aafa266..7a709940adba3c726571f41a63b127f3c9c7f1e1 100644 GIT binary patch delta 97 zcmZo>oX05P?iX5Il3JjUSd^TRS(a*GV31~FWMW`7kzabEv7RlLC<6n7Gz)_ZLq3B7 mLmrSU0n#N5i43Jc9*CU*WETKoC6Jv47FA$K0*d7@7#O6PT=Et2@=Fv-5=-++6fzPE P3Mv)SO7j$w5_56@XKxc+ diff --git a/Tests/base/coding/ullong-8.type b/Tests/base/coding/ullong-8.type index 88c25ff938768cfadd79db98dfaebdbffc4e44c8..50516c26dad1f6996d9199067499251de4188f99 100644 GIT binary patch delta 97 zcmeBTT*@fn?iX5Il3JjUSd^TRS(a*GV31~FWMW`7kzabEv8gSWC<6n7Gz)_ZLq3B7 mLmrSU0n#N5i43Jc9*CU*WETKoC6Jv47FA$K0*d7@7#O6PT=Et2@=Fv-5=-++6fzPE P3Mv)SO7j$w5_56@Y5x;w diff --git a/Tests/base/coding/ulong-4.type b/Tests/base/coding/ulong-4.type index a54ee85a4f3aad0bb825fc6ea46d89ce945c7abb..b8dd564b079f1aa28e86ee03899b4bd6b6c69ef9 100644 GIT binary patch delta 97 zcmZo;T*xTl?iX5Il3JjUSd^TRS(a*GV31~FWMW`7kzabEv7s%OC<6n7Gz)_ZLq3B7 mLmrSU0n#N5i43Jc9*CU*WETKoC6Jv47FA$K0*d7@7#O6PT=Et2@=Fv-5=-++6fzPE P3Mv)SO7j$w5_56@XKxc+ diff --git a/Tests/base/coding/ushort-2.type b/Tests/base/coding/ushort-2.type index cf67a193fe171888b9522fb7606d5e404698e16c..701012f512793117458c71048debf66cfba0374c 100644 GIT binary patch delta 97 zcmZo+oX;rX?iX5Il3JjUSd^TRS(a*GV31~FWMW`7kzabEvA!*rC<6n7Gz)_ZLq3B7 mLmrSU0n#N5i43Jc9*CU*WETKoC6Jv47FA$K0*d7@7#O6PT=Et2@=Fv-5=-++6fzPE P3Mv)SO7j$w5_56@W+xL?