Skip to content

Commit 6059806

Browse files
Stop including af-enums.h in Darwin unit tests.
These are Objective-C files, and should not be including potentially-C++ headers. A bunch of "test that the code is 0" checks were replaced with "error is nil" checks (and some were removed, if "error is nil" was already being tested). The macro definition reformatting in MTRBackwardsCompatTests.m is just from updates to our clang-format version, looks like.
1 parent b1087be commit 6059806

7 files changed

+91
-124
lines changed

src/darwin/Framework/CHIPTests/MTRBackwardsCompatTests.m

+19-21
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323
#import "MTRTestResetCommissioneeHelper.h"
2424
#import "MTRTestStorage.h"
2525

26-
#import <app/util/af-enums.h>
27-
2826
#import <math.h> // For INFINITY
2927

3028
// system dependencies
@@ -203,34 +201,34 @@ - (void)test000_SetUp
203201
// tests.
204202
}
205203

206-
#define CHECK_RETURN_TYPE(sig, type) \
207-
do { \
208-
XCTAssertNotNil(sig); \
209-
XCTAssertTrue(strcmp([sig methodReturnType], @encode(type)) == 0); \
204+
#define CHECK_RETURN_TYPE(sig, type) \
205+
do { \
206+
XCTAssertNotNil(sig); \
207+
XCTAssertTrue(strcmp([sig methodReturnType], @encode(type)) == 0); \
210208
} while (0)
211209

212210
/**
213211
* Arguments 0 and 1 are the implicit self and _cmd arguments; the real arguments begin at index 2.
214212
*/
215-
#define CHECK_ARGUMENT(sig, index, type) \
216-
do { \
217-
XCTAssertTrue(strcmp([sig getArgumentTypeAtIndex:(index) + 2], @encode(type)) == 0); \
213+
#define CHECK_ARGUMENT(sig, index, type) \
214+
do { \
215+
XCTAssertTrue(strcmp([sig getArgumentTypeAtIndex:(index) + 2], @encode(type)) == 0); \
218216
} while (0)
219217

220-
#define CHECK_READONLY_PROPERTY(instance, propName, type) \
221-
do { \
222-
NSMethodSignature * signature = [instance methodSignatureForSelector:@selector(propName)]; \
223-
CHECK_RETURN_TYPE(signature, type); \
224-
/* Check that getting the property directly compiles too */ \
225-
(void) instance.propName; \
218+
#define CHECK_READONLY_PROPERTY(instance, propName, type) \
219+
do { \
220+
NSMethodSignature * signature = [instance methodSignatureForSelector:@selector(propName)]; \
221+
CHECK_RETURN_TYPE(signature, type); \
222+
/* Check that getting the property directly compiles too */ \
223+
(void) instance.propName; \
226224
} while (0)
227225

228-
#define CHECK_PROPERTY(instance, propName, setterName, type) \
229-
do { \
230-
CHECK_READONLY_PROPERTY(instance, propName, type); \
231-
NSMethodSignature * signature = [instance methodSignatureForSelector:@selector(setterName:)]; \
232-
CHECK_RETURN_TYPE(signature, void); \
233-
CHECK_ARGUMENT(signature, 0, type); \
226+
#define CHECK_PROPERTY(instance, propName, setterName, type) \
227+
do { \
228+
CHECK_READONLY_PROPERTY(instance, propName, type); \
229+
NSMethodSignature * signature = [instance methodSignatureForSelector:@selector(setterName:)]; \
230+
CHECK_RETURN_TYPE(signature, void); \
231+
CHECK_ARGUMENT(signature, 0, type); \
234232
} while (0)
235233

236234
/**

0 commit comments

Comments
 (0)