[K/N][Tests] Migrate objcSmoke & objcTests tests

^KT-61259
This commit is contained in:
Vladimir Sukharev
2024-01-24 18:04:17 +01:00
committed by Space Team
parent 58f7dd1c83
commit 524f0d335e
98 changed files with 227 additions and 8 deletions
@@ -0,0 +1,56 @@
#import "kt41811.h"
#import "assert.h"
id retainObject = nil;
BOOL deallocRetainReleaseDeallocated = NO;
@implementation DeallocRetainRelease
-(void)dealloc {
retainObject = self;
assert(retainObject == self);
retainObject = nil;
assert(!deallocRetainReleaseDeallocated);
deallocRetainReleaseDeallocated = YES;
}
@end
DeallocRetainRelease* globalDeallocRetainRelease = nil;
@implementation ObjCWeakReference
@end
id <WeakReference> weakDeallocLoadWeak = nil;
BOOL deallocLoadWeakDeallocated = NO;
@implementation DeallocLoadWeak
-(void)checkWeak {
assert(weakDeallocLoadWeak != nil);
assert(weakDeallocLoadWeak.referent == self);
}
-(void)dealloc {
assert(weakDeallocLoadWeak != nil);
assert(weakDeallocLoadWeak.referent == nil);
assert(!deallocLoadWeakDeallocated);
deallocLoadWeakDeallocated = YES;
}
@end
id retainObject2 = nil;
BOOL deallocRetainAndAccessDeallocated = NO;
@implementation DeallocRetainAndAccess
- (void)dealloc {
retainObject2 = self;
assert(_onDealloc != nil);
_onDealloc(retainObject2);
retainObject2 = nil;
assert(!deallocRetainAndAccessDeallocated);
deallocRetainAndAccessDeallocated = YES;
}
@end