美文网首页
iOS 测试常用宏

iOS 测试常用宏

作者: 40dd4b561abe | 来源:发表于2018-04-25 22:18 被阅读21次
    #define assertTrue(expr)              XCTAssertTrue((expr), @"")
    #define assertFalse(expr)             XCTAssertFalse((expr), @"")
    #define assertNil(a1)                 XCTAssertNil((a1), @"")
    #define assertNotNil(a1)              XCTAssertNotNil((a1), @"")
    #define assertEqual(a1, a2)           XCTAssertEqual((a1), (a2), @"")
    #define assertEqualObjects(a1, a2)    XCTAssertEqualObjects((a1), (a2), @"")
    #define assertNotEqual(a1, a2)        XCTAssertNotEqual((a1), (a2), @"")
    #define assertNotEqualObjects(a1, a2) XCTAssertNotEqualObjects((a1), (a2), @"")
    #define assertAccuracy(a1, a2, acc)   XCTAssertEqualWithAccuracy((a1),(a2),(acc))
    
    #define WAIT                                                                \
    do {                                                                        \
    [self expectationForNotification:@"LCUnitTest" object:nil handler:nil]; \
    [self waitForExpectationsWithTimeout:60 handler:nil];                   \
    } while(0);
    
    #define NOTIFY                                                                            \
    do {                                                                                      \
    [[NSNotificationCenter defaultCenter] postNotificationName:@"LCUnitTest" object:nil]; \
    } while(0);
    

    相关文章

      网友评论

          本文标题:iOS 测试常用宏

          本文链接:https://www.haomeiwen.com/subject/bxjulftx.html