void Suite_run(Suite *self) { current_suite = self; if (Suite_spec_length(self)) printf("\n\033[1;01m %s\033[0m", Suite_description(self)); Suite_run_blocks(self, blockTypeBefore); for (int i = 0; i < self->nblocks; ++i) if (self->blocks[i]->type == blockTypeSpec) Suite_run_spec(self, self->blocks[i]); printf("\n"); Suite_run_blocks(self, blockTypeAfter); for (int i = 0; i < self->nsuites; ++i) Suite_run(self->suites[i]); }
int main() { Suite *suite_0 = Suite_new("RoutingTable"); Block *block_0 = Block_new(blockTypeBefore, NULL, &block_0_callback); Suite_push_block(suite_0, block_0); Block *block_1 = Block_new(blockTypeSpec, "nodes should be findable", &block_1_callback); Suite_push_block(suite_0, block_1); Block *block_2 = Block_new(blockTypeSpec, "nodes should be removeable", &block_2_callback); Suite_push_block(suite_0, block_2); Suite_run(suite_0); CSpec_stats(); return CSpec.failures; }