bool mem_stomp = false;
bool conservative = false;
bool fork = true;
+ bool eager_alloc = true;
}
package Options options;
options.mem_stomp = parse_bool(opt_value);
else if (cstr_eq(opt_name, "conservative"))
options.conservative = parse_bool(opt_value);
- else if (cstr_eq(opt_name, "no_fork"))
- options.fork = !parse_bool(opt_value);
+ else if (cstr_eq(opt_name, "fork"))
+ options.fork = parse_bool(opt_value);
+ else if (cstr_eq(opt_name, "eager_alloc"))
+ options.eager_alloc = parse_bool(opt_value);
}
assert (mem_stomp == false);
assert (conservative == false);
assert (fork == true);
+ assert (eager_alloc == true);
}
parse("mem_stomp");
with (options) {
assert (mem_stomp == true);
assert (conservative == false);
assert (fork == true);
+ assert (eager_alloc == true);
}
- parse("mem_stomp=0:verbose=2:conservative:no_fork=10");
+ parse("mem_stomp=0:verbose=2:conservative:fork=0:eager_alloc=0");
with (options) {
assert (verbose == 2);
assert (log_file[0] == '\0');
assert (mem_stomp == false);
assert (conservative == true);
assert (fork == false);
+ assert (eager_alloc == false);
}
parse("log_file=12345 67890:verbose=1:sentinel=4:mem_stomp=1");
with (options) {
assert (mem_stomp == true);
assert (conservative == true);
assert (fork == false);
+ assert (eager_alloc == false);
}
parse(null);
with (options) {
assert (mem_stomp == true);
assert (conservative == true);
assert (fork == false);
+ assert (eager_alloc == false);
+ }
+ parse("");
+ with (options) {
+ assert (verbose == 1);
+ assert (cstring.strcmp(log_file.ptr, "12345 67890".ptr) == 0);
+ assert (sentinel == true);
+ assert (mem_stomp == true);
+ assert (conservative == true);
+ assert (fork == false);
+ assert (eager_alloc == false);
+ }
+ parse(":");
+ with (options) {
+ assert (verbose == 1);
+ assert (cstring.strcmp(log_file.ptr, "12345 67890".ptr) == 0);
+ assert (sentinel == true);
+ assert (mem_stomp == true);
+ assert (conservative == true);
+ assert (fork == false);
+ assert (eager_alloc == false);
+ }
+ parse("::::");
+ with (options) {
+ assert (verbose == 1);
+ assert (cstring.strcmp(log_file.ptr, "12345 67890".ptr) == 0);
+ assert (sentinel == true);
+ assert (mem_stomp == true);
+ assert (conservative == true);
+ assert (fork == false);
+ assert (eager_alloc == false);
}
}