??????????????????????????????????????????????????????????????????????????????????????з??????·?????????????????NSMutableArray???洢??????????top?????????????????????VVStack.m?????????飬????????

 

//VVStack.m
@interface VVStack()
@property (nonatomic?? strong) NSMutableArray *numbers;
@end
@implementation VVStack
- (id)init {
if (self = [super init]) {
_numbers = [NSMutableArray new];
}
return self;
}
- (void)push:(double)num {
[self.numbers addObject:@(num)];
}
- (double)top {
return [[self.numbers lastObject] doubleValue];
}
@end

??????????????????-testStackObjectCanBeCreated??testPushANumberAndGetIt?????????ж??????????VVStack?????????????????л??????????????????????????????????????????????????????VVStack???????????????????е????????????-setUp?У?????-tearDown??????
 

??????????????????????????pop?????????????????????????????????????????????????????????????????????????????????????????????????????Ч????£??????????????????????????????????????????????????????ж?????“??????”????е??????????????????ú????????????????????????????????????XCTest???????????????????github???????

Kiwi??BDD????????
????XCTest?????OCUnit???????????????д??????????????á??????????????????????????????????????????????????????????????????????????????????????????????????????????????顣???е????????????????????????????????岢?????????????????????????????μ?????????????????????????????????????????????????????????????????д???????????????????У????????????XCTest????????????????????????mock????stub????????????????????????????????mock???????????????????м?????????

?????????????????BDD?????????????????????????????????????????BDD??????????????????????????????????????????????????????????????????????????д??????????????????????/?????????????????????????????????????????????????????????????д???????BDD?????????????????????BDD????????????????????????????????????????????Given..When..Then???????????????????BDD???????????????????Щ???????????Java??JBehave??????????Ruby??RSpec??Cucumber??????objc??????BDD???????????????????????????objc???????????????????????????C???????????????????п???д??????????????????objc?У??????????е?BDD?????cedar??specta??Kiwi?????и????????Kiwi?????Kiwiд???????????????????????????

 

describe(@"Team"?? ^{
context(@"when newly created"?? ^{
it(@"should have a name"?? ^{
id team = [Team team];
[[team.name should] equal:@"Black Hawks"];
});
it(@"should have 11 players"?? ^{
id team = [Team team];
[[[team should] have:11] players];
});
});
});