-
Notifications
You must be signed in to change notification settings - Fork 0
/
hsm.m
33 lines (25 loc) · 900 Bytes
/
hsm.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#import <Foundation/Foundation.h>
#import "DogStateMachine.h"
#import "DogVerifier.h"
/**
Stubbing out a test framework for the StateMachine framework..
*/
int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
// lets create a hypothetical "dog state machine" that represents a complex
// canine reactive system (aka, a dog)
DogStateMachine *dog = [[DogStateMachine alloc] init];
// now lets create a DogVerifier that checks this behaves as a real dog should
DogVerifier *doggyChecker = [[DogVerifier alloc] init];
doggyChecker.dog = dog;
BOOL isReallyADog = [doggyChecker verify];
// report result
if (isReallyADog) {
NSLog(@"Its really a dog! (all tests passed)");
}
else {
NSLog(@"Hah, this is NOT a real dog! Its probably a cat wearing a dogsuit. (1 or more tests failed)");
}
[pool drain];
return 0;
}