Differences From Artifact [7e5d27d097]:
- File
tests/OFMethodSignatureTests.m
— part of check-in
[dc0c6c34ab]
at
2019-02-17 22:44:23
on branch trunk
— tests: Only import ObjFW.h
This prevents forgetting to add an import to ObjFW.h, as the tests would
then not compile. (user: js, size: 5126) [annotate] [blame] [check-ins using]
To Artifact [919883130b]:
- File tests/OFMethodSignatureTests.m — part of check-in [b045cbb9c7] at 2019-03-25 00:21:30 on branch trunk — tests: Use dot syntax (user: js, size: 5109) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
75 76 77 78 79 80 81 |
- (void)methodSignatureTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFMethodSignature *ms;
TEST(@"-[:signatureWithObjCTypes:] #1",
(ms = [OFMethodSignature signatureWithObjCTypes:
| | | | | < | | 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
- (void)methodSignatureTests
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFMethodSignature *ms;
TEST(@"-[:signatureWithObjCTypes:] #1",
(ms = [OFMethodSignature signatureWithObjCTypes:
"i28@0:8S16*20"]) && ms.numberOfArguments == 4 &&
strcmp(ms.methodReturnType, "i") == 0 &&
strcmp([ms argumentTypeAtIndex: 0], "@") == 0 &&
strcmp([ms argumentTypeAtIndex: 1], ":") == 0 &&
strcmp([ms argumentTypeAtIndex: 2], "S") == 0 &&
strcmp([ms argumentTypeAtIndex: 3], "*") == 0 &&
ms.frameLength == 28 && [ms argumentOffsetAtIndex: 0] == 0 &&
[ms argumentOffsetAtIndex: 1] == 8 &&
[ms argumentOffsetAtIndex: 2] == 16 &&
[ms argumentOffsetAtIndex: 3] == 20)
TEST(@"-[signatureWithObjCTypes:] #2",
(ms = [OFMethodSignature signatureWithObjCTypes:
"{s0=csi(u1={s2=iii{s3=(u4=ic^v*)}})}24@0:8"
"^{s0=csi(u1={s2=iii{s3=(u4=ic^v*)}})}16"]) &&
ms.numberOfArguments == 3 && strcmp(ms.methodReturnType,
"{s0=csi(u1={s2=iii{s3=(u4=ic^v*)}})}") == 0 &&
strcmp([ms argumentTypeAtIndex: 0], "@") == 0 &&
strcmp([ms argumentTypeAtIndex: 1], ":") == 0 &&
strcmp([ms argumentTypeAtIndex: 2],
"^{s0=csi(u1={s2=iii{s3=(u4=ic^v*)}})}") == 0 &&
ms.frameLength == 24 && [ms argumentOffsetAtIndex: 0] == 0 &&
[ms argumentOffsetAtIndex: 1] == 8 &&
[ms argumentOffsetAtIndex: 2] == 16)
EXPECT_EXCEPTION(@"-[signatureWithObjCTypes:] #3",
OFInvalidFormatException,
[OFMethodSignature signatureWithObjCTypes: "{ii"])
|
| ︙ | ︙ |