Write C to Test C

It disappoints me to see messy, procedural, assertion-based testing in C codebases. Here’s an example from the wild: const char *key = "404"; const int values[3] = { 0, 1, 2 }; plan_no_plan(); Map *map = map_new(); ok(map && map_empty(map), "Creation"); ok(map_first(map, &key) == NULL && strcmp(key, "404") == 0, "First on empty map"); ok(map_empty(map_prefix(map, "404")), "Empty prefix map"); In assertion-based testing, it’s common to test an entire data structure in a single function, instead of testing one of its operations. [Read More]