#import <Foundation/Foundation.h>
#import <Block.h>
// CONFIG GC
int countem(NSHashTable *table) {
int result = 0;
for (id elem in table)
++result;
return result;
}
int main(char *argc, char *argv[]) {
NSHashTable *weakSet = [NSHashTable hashTableWithWeakObjects];
void (^local)(void) = ^{ [weakSet count]; };
extern id _Block_copy_collectable(void *);
//[weakSet addObject:_Block_copy_collectable(local)];
[weakSet addObject:Block_copy(local)];
[weakSet addObject:Block_copy(local)];
[weakSet addObject:Block_copy(local)];
[weakSet addObject:Block_copy(local)];
[weakSet addObject:Block_copy(local)];
[weakSet addObject:Block_copy(local)];
//printf("gc block... we hope\n [[NSGarbageCollector defaultCollector] collectExhaustively];
int count = countem(weakSet);
if (count == 6) {
printf(" exit(0);
}
else {
printf(" }
exit(1);
}