TDD??iOS???????????Kiwi???????
???????????? ???????[ 2014/2/24 13:42:41 ] ???????????????
describe(@"VVStack"?? ^{
context(@"when created"?? ^{
__block VVStack *stack = nil;
beforeEach(^{
stack = [VVStack new];
});
afterEach(^{
stack = nil;
});
it(@"should have the class VVStack"?? ^{
[[[VVStack class] shouldNot] beNil];
});
it(@"should exist"?? ^{
[[stack shouldNot] beNil];
});
it(@"should be able to push and get top"?? ^{
[stack push:2.3];
[[theValue([stack top]) should] equal:theValue(2.3)];
[stack push:4.6];
[[theValue([stack top]) should] equal:4.6 withDelta:0.001];
});
});
});
|
???????????????????β?????ò????????????????????????stack???????beforeEach??afterEach??block?е?????????????????????????????????__block???????Σ???????????should????shouldNot??????????????????????????????????????????????Kiwi???????????????????????????????theValue????????????????????????????????????????2.3???????????д???????ж???????????????漰???????????????????????????????????????о????????????????????????4.6?????е?equal:withDelta:?????????????????demo??????????ú?????2.3???????????????
????????????????????context???????????????????????????????????????????????????Array??????洢?????????????????ù???equal?????????????????????????????????
????it(@"should equal contains 0 element"?? ^{
????[[theValue([stack.numbers count]) should] equal:theValue(0)];
????});
??????β?????????????????????????з??????????????????????????????????д??Extension???numbers??????????У???????????????????????????????????????????????????-count????????????numbers????????????????numbers???????????????????????????theValue???????????????????????????????????????????????£????????0?????????????beZero????????????????á?????д??????VVStack.h??????????????????????
//VVStack.h
//...
- (NSUInteger)count;
//...
//VVStack.m
//...
- (NSUInteger)count {
return [self.numbers count];
}
//...
it(@"should equal contains 0 element"?? ^{
[[theValue([stack count]) should] beZero];
});
|
??????
???·???
??????????????????
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