I have a header interface.h with a function f() and its two implementations, imp1.c and imp2.c. Both imp1.c, and imp2.c contain definitions for f(). I am checking f() with random inputs, but I want to make sure that the outputs from both imp1.c and imp2.c agree. How can I do that? Is there any way my main function can distinguish between the two implementations? Like
if(imp1.f() != imp2.f()) printf("The implementations differ on input %d", i);
x, if Q(f1, f2) is true, return!!f1(x). Otherwise, returnf1(x). Then Q either must be broken or must never return in some cases, because, if it says f1 and f2 always return the same result, f2 returns a result different from f1, and, if it says they do not always return the same result, f2 returns the same result as f1.