#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <Block.h>
#include <Block_private.h>
#include <assert.h>
int
main(int argc, char *argv[])
{
__block int var = 0;
int shouldbe = 0;
void (^b)(void) = ^{ var++; };
__typeof(b) _b;
b(); ++shouldbe;
size_t i;
for (i = 0; i < 10; i++) {
_b = Block_copy(b); assert(_b);
++shouldbe;
_b(); Block_release(_b);
}
b(); ++shouldbe;
if (var != shouldbe) {
printf("Hmm, var is %d but should be %d\n", var, shouldbe);
return 1;
}
printf("%s: Success!!\n", argv[0]);
return 0;
}