??iOS???????
?????AllanHou ???????[ 2017/5/9 10:23:27 ] ??????????????? ???????
???????????- (void)testPersonalInformationAge??????????????????м?鵱??????????????г????????????4??????- (void)testPersonalInformationAge?????????????????λ??????????????
????
?4.??????
???????????????- (void)testPersonalInformationAge?????????????2???????????ε???????????Ч???????5??
????- (void)testPersonalInformationAge
????{
????ResponsePersonalInformation * response = [[ResponsePersonalInformation alloc] init];
????response.age = @"-1"; //???110???????
????[self checkAge:response];
????}
????
?5.??鯔???
??????????????
????Test Suite 'Selected tests' started at 2017-03-23 15:23:42.135
????Test Suite '???????demoTests.xctest' started at 2017-03-23 15:23:42.136
????Test Suite 'PersonalInformationTests' started at 2017-03-23 15:23:42.137
????Test Case '-[PersonalInformationTests testPersonalInformationAge]' started. //?????????????????start???
????/Users/xl10014/Desktop/???????demo/???????demoTests/PersonalInformationTests.m:45: error: -[PersonalInformationTests testPersonalInformationAge] : (([response.age integerValue] < 0) is true) failed - ????С??0??-??? //??????????????? ?????λ?? ??????????? PersonalInformationTests.m:45??
????/Users/xl10014/Desktop/???????demo/???????demoTests/PersonalInformationTests.m:46: error: -[PersonalInformationTests testPersonalInformationAge] : (([response.age integerValue] >110) is true) failed - ????????110??-??? //??????????????? ?????λ?? ??????????? PersonalInformationTests.m:46??
????Test Case '-[PersonalInformationTests testPersonalInformationAge]' failed (0.015 seconds). //??????????????????? ???????????仨??0.015??
????????????????XCTest??????÷???????????????????????XCTes????????????????????????????????.m?е??????????
????- (void)testPerformanceExample {
????// This is an example of a performance test case.
????[self measureBlock:^{
????// Put the code you want to measure the time of here.
????}];
????}
??????????????????????????testPerformanceExample?????????block?У?
????- (void)testPerformanceExample {
????// This is an example of a performance test case.
????[self measureBlock:^{
????NSMutableArray * mutArray = [[NSMutableArray alloc] init];
????for (int i = 0; i < 9999; i++) {
????NSObject * object = [[NSObject alloc] init];
????[mutArray addObject:object];
????}
????}];
????}
????????block??д?????for??????9999?Σ??????????????????????????????????????????£?
????Test Suite 'Selected tests' started at 2017-03-23 15:54:41.488
????Test Suite '???????demoTests.xctest' started at 2017-03-23 15:54:41.489
????Test Suite 'PersonalInformationTests' started at 2017-03-23 15:54:41.490
????Test Case '-[PersonalInformationTests testPerformanceExample]' started.
?????????????л?????м???????: measured [Time?? seconds] average: 0.002?? relative standard deviation: 4.830%?? values: [0.002294?? 0.002094?? 0.002255?? 0.002304?? 0.002295?? 0.002052?? 0.002055?? 0.002135?? 0.002352?? 0.002224]??????????????????????for????????????????????10?Σ??????????????????average: 0.002???????????0.002??
???????????????????????????????????????????????Ч????????????testPerformanceExample???????????????????????????????????????????????NSTimeInterval??????????????????????????????÷????′???
- (void)testPerformanceExample {
// This is an example of a performance test case.
[self measureBlock:^{
NSTimeInterval startTime = CACurrentMediaTime();
NSMutableArray * mutArray = [[NSMutableArray alloc] init];
for (int i = 0; i < 9999; i++) {
NSObject * object = [[NSObject alloc] init];
[mutArray addObject:object];
}
NSLog(@"%f"??CACurrentMediaTime() - startTime);
}];
}
??????.????????????????????????
??????????к??????????????????????????????????????????????е?д?????????硣?????д???????????Щ?????????д????????????д?? ??????????????????????????????????????????????????????д?????????????????????????????????????ò????????????????????????????????????????????????Щ???Щ??????????Щ?????д??????????????????:?????.h?е???????д?????????? ????Щ??з???д???????????????????????
???????????????????????????????????????????????????????????????????50%??????????????????????????70??80??Щ??????????????????????????Щ?????????????????????????????????????????????磬AFNNetWorking?????????87%??SDWebImage?????????77%??
????AFN??????????????87%
????SD??????????????77%
??????.???????
?????????????????????????????????????????????д??????????????????????????????????????????????????????????У??Щ????????????????????????????????????????????????????????в????
????????????
#import "Teacher.h"
#import "Student.h"
@implementation Teacher
- (void)guideStudentRead
{
Student * gaoStu = [[Student alloc] initWithName:@"MrGao"];
[std read];
}
@end
??????????δ???????Teacher???????guideStudentRead???????????飩??????д???????????MrGao??????????????gaoStu??????顣???????????????????????????Teacher??Student?????????????????????????????????????????????????????Teacher??÷????????????????????????????Student???????????????????????MrGao?????MrHu???????guideStudentRead??????????????????????????????????????????????????????????????????????????????????
#import "Teacher.h"
#import "Student.h"
@interface Teacher ()
@property (nonatomic?? strong) Student * stu;
@end
@implementation Teacher
- (instancetype)initWithStudent:(Student *)student
{
if (self = [super init]) {
self.stu = student;
}
return self;
}
- (void)guideStudentRead
{
}
@end
????????????????????????????洢??????????Teacher??init?????д????????Student???????Student???????????????Teacher???У?????????????????????Teacher???У????Teacher????Student????????????????????????????????????????????????????????????????????????к????????????????init??????????????????????????????????????????????????????????????д?????????OC?л????Щ??????????????????Objection ??Typhoon ????????????????????????£???????????????????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11