Skip to content

Instantly share code, notes, and snippets.

@bassosimone
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bassosimone/231f43eb8285303c2007 to your computer and use it in GitHub Desktop.
Save bassosimone/231f43eb8285303c2007 to your computer and use it in GitHub Desktop.
@interface GenericTest : NSObject
typedef void(^begin_function)(void);
typedef void(^end_function)(void);
+ (GenericTest *)make_test:NSDictionary;
- (void)begin:begin_function;
- (void)end:end_function;
///
@interface ight : NSObject
+ (void)loop;
+ (void)break_loop;
// FIXME: What is missing is a way to know the progress status
// Maybe we can add a callback called progress?
///
NSDictionary *settings = @{
@"nameserver": @"8.8.8.8",
@"input_filepath": @"/foo/bar",
@"test_name": @"ooni/dns_injection",
};
GenericTest *test = [GenericTest make_test:settings];
// What I wonder is how much this syntax is surprising (or commonly used!) in ObjeC
[test begin ^{} {
[test end ^{} {
[ight break_loop];
]
];
[ight loop];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment