?????????????????????collection?????Kiwi???Щ???????????have??haveCountOf??е???????????????????????-count???????????????????????????????д??????????????????????????????????д??
????it(@"should equal contains 0 element"?? ^{
????[[stack should] haveCountOf:0];
????});
??????????????£?????????????????VVStack??-count????????????????????????н?????????????????????????????????????????????????????????????????????????count??????????????????????????????unrecognized selector????Kiwi???????????????????????????????Matcher??objc????????????objcruntime??????????????????????????????????Kiwi?????д?????????
????????????????????????????д?????????汾??????????
????it(@"should equal contains 0 element"?? ^{
????[[stack should] beEmpty];
????});
?????????????????????μ????о?????????????????TDD???????????VVStack??ɡ???????????????????-pop?????????Given???????????????When??????????????????Then?????????pop???????????????????????????context???????????·??д????????????????

 

context(@"when new created and pushed 4.6"?? ^{
__block VVStack *stack = nil;
beforeEach(^{
stack = [VVStack new];
[stack push:4.6];
});
afterEach(^{
stack = nil;
});
it(@"can be poped and the value equals 4.6"?? ^{
[[theValue([stack pop]) should] equal:theValue(4.6)];
});
it(@"should contains 0 element after pop"?? ^{
[stack pop];
[[stack should] beEmpty];
});
});

??????????????д?????????????????д?????????VVStack.h???????????????.m?м??????????
????- (double)pop {
????double result = [self top];
????[self.numbers removeLastObject];
????return result;
????}
????????ɡ?????????в??????????????????Stack?????????????????????????????????????м??????????????????????????????????????????????????????????VVStack????????С????????????????????????pop???????????????????????????????pop???????objc?????????????????????????????????????????????????C???????????????????????????????“when created”???????м????????????
????it(@"should raise a exception when pop"?? ^{
????[[theBlock(^{
????[stack pop];
????}) should] raiseWithName:@"VVStackPopEmptyException"];
????});
??????theValue????????????theBlock???Kiwi?е???????????????????γ????????????matcher?????????????????????????????????Stack???pop???????????”VVStackPopEmptyException”????????????????pop??????????????????????

 

- (double)pop {
if ([self count] == 0) {
[NSException raise:@"VVStackPopEmptyException" format:@"Can not pop an empty stack."];
}
double result = [self top];
[self.numbers removeLastObject];
return result;
}

???????????Kiwi
????VVStack??????????????????????????????????????????????????????????????????????????????????????????????????μ???????????????bug??????????????????????????????????????????????????????????????м???????Kiwi??????Kiwi?????????mock/stub????ú??????Ρ?Kiwi????????????????У????repo??wiki?????Щ???????????????????ο???VVStack?????????????????repo???????????????ο???