mercredi 13 mars 2019

How to test API that just returns system values?

Let's say for example we have a routine

int unw_getcontext(unw_context_t *ucp)

The unw_getcontext() routine initializes the context structure pointed to by ucp with the machine-state of the call-site. The exact set of registers stored by unw_getcontext() is platform-specific

What must be a unit test for such a routine? Of course I can use some system calls to fetch CPU registers and stuff like that and then compare it with what the routine returns. But it seems to be so much work for a unit test. What testing theory says about testing such API?

Aucun commentaire:

Enregistrer un commentaire