2011-02-16 08:21:17 +00:00
|
|
|
#import "Testing.h"
|
|
|
|
#import <Foundation/NSAutoreleasePool.h>
|
|
|
|
#import <Foundation/NSObject.h>
|
|
|
|
/* Nicola Pero, Tue Dec 18 17:54:53 GMT 2001 */
|
|
|
|
@protocol DoingNothing
|
|
|
|
- (void) doNothing;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@protocol DoingNothingCategory
|
|
|
|
- (void) doNothingCategory;
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
@interface NicolaTest : NSObject <DoingNothing>
|
|
|
|
{
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation NicolaTest
|
|
|
|
- (void) doNothing
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface NicolaTest (Category) <DoingNothingCategory>
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation NicolaTest (Category)
|
|
|
|
- (void) doNothingCategory
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
2024-11-16 14:07:33 +00:00
|
|
|
ENTER_POOL
|
|
|
|
id instance = AUTORELEASE([NicolaTest new]);
|
|
|
|
|
2011-02-16 08:21:17 +00:00
|
|
|
PASS([NicolaTest conformsToProtocol:@protocol(DoingNothing)],
|
|
|
|
"+conformsToProtocol returns YES on an implemented protocol");
|
|
|
|
PASS([NicolaTest conformsToProtocol:@protocol(DoingNothingCategory)],
|
|
|
|
"+conformsToProtocol returns YES on a protocol implemented in a category");
|
|
|
|
PASS(![NicolaTest conformsToProtocol:@protocol(NSCoding)],
|
|
|
|
"+conformsToProtocol returns NO on an unimplemented protocol");
|
2024-11-16 14:07:33 +00:00
|
|
|
PASS([instance conformsToProtocol:@protocol(DoingNothing)],
|
2011-02-16 08:21:17 +00:00
|
|
|
"-conformsToProtocol returns YES on an implemented protocol");
|
2024-11-16 14:07:33 +00:00
|
|
|
PASS([instance conformsToProtocol:@protocol(DoingNothingCategory)],
|
2011-02-16 08:21:17 +00:00
|
|
|
"-conformsToProtocol returns YES on a protocol implemented in a category");
|
2024-11-16 14:07:33 +00:00
|
|
|
PASS(![instance conformsToProtocol:@protocol(NSCoding)],
|
2011-02-16 08:21:17 +00:00
|
|
|
"-conformsToProtocol returns NO on an unimplemented protocol");
|
|
|
|
|
2024-11-16 14:07:33 +00:00
|
|
|
LEAVE_POOL
|
2011-02-16 08:21:17 +00:00
|
|
|
return 0;
|
|
|
|
}
|