multi_test: implement C equivalent of test.py