Skip to content
This repository has been archived by the owner on Nov 11, 2021. It is now read-only.

Feature

yaakaito edited this page May 28, 2012 · 2 revisions

たとえば足し算メソッドをテストする場合

- (BOOL)propAdd:(NSInteger)a b:(NSInteger)b {
    
    return [Hoge add:a b:b] == a + b;
}

- (void)testAdd {
    NLTQuickCheckTests *testCase = [NLTQuickCheckTest testWithName:@"exsample"
                                                      propSelector:@selector(propAdd:b:)
                                                        arbitrarys:[NSArray arrayWithObjects:[NLTQuickCheckArbitrary intArbitray],
                                                                                             [NLTQuickCheckArbitrary intArbitray], nil]];
    STAssertTrue([testCase success], @"%@", [testCase report]);
}
- (void)testAdd {
    NLTQuickCheckTests *testCase = [NLTQuickCheckTest testWithName:@"exsample"
                                                             block:BOOL^(Arguments* args){
                                                                 return [Hoge add:a b:b] == a + b;
                                                             }
                                                        arbitrarys:[NSArray arrayWithObjects:[NLTQuickCheckArbitrary intArbitray],
                                                                                             [NLTQuickCheckArbitrary intArbitray], nil]];
    STAssertTrue([testCase success], @"%@", [testCase report]);
}