| 1 |
/* Contributed by Nicola Pero - Fri Mar 9 21:35:47 CET 2001 */ |
| 2 |
|
| 3 |
#include <stdlib.h> |
| 4 |
#include "../../objc-obj-c++-shared/TestsuiteObject.m" |
| 5 |
|
| 6 |
/* Tests defining a protocol and a class adopting it */ |
| 7 |
|
| 8 |
@protocol Enabling |
| 9 |
- (BOOL) isEnabled; |
| 10 |
- (void) setEnabled: (BOOL)flag; |
| 11 |
@end |
| 12 |
|
| 13 |
@interface Feature : TestsuiteObject <Enabling> |
| 14 |
{ |
| 15 |
const char *name; |
| 16 |
BOOL isEnabled; |
| 17 |
} |
| 18 |
@end |
| 19 |
|
| 20 |
@implementation Feature |
| 21 |
- (BOOL) isEnabled |
| 22 |
{ |
| 23 |
return isEnabled; |
| 24 |
} |
| 25 |
- (void) setEnabled: (BOOL)flag |
| 26 |
{ |
| 27 |
isEnabled = flag; |
| 28 |
} |
| 29 |
@end |
| 30 |
|
| 31 |
int main (void) |
| 32 |
{ |
| 33 |
Feature *object; |
| 34 |
|
| 35 |
object = [Feature new]; |
| 36 |
|
| 37 |
[object setEnabled: YES]; |
| 38 |
if (![object isEnabled]) |
| 39 |
{ |
| 40 |
abort (); |
| 41 |
} |
| 42 |
|
| 43 |
return 0; |
| 44 |
} |
| 45 |
|