troglobit / mdnsd

Jeremie Miller's original mdnsd
BSD 3-Clause "New" or "Revised" License
55 stars 35 forks source link

Add unit tests for addr.c:iface_init #61

Closed fzs closed 1 year ago

fzs commented 1 year ago

This PR adds new unit tests, testing the iface_init function in addr.c. Specifically the overwriting of link local with global IP addresses is tested.

Please check if the integration is okay regarding Makefile.am definitions, and other conventions. I am not so sure that the test source files should be named the same as the original source files, so I went for addr_test.c.

Another thing is where the object file for the included addr.c is placed. I only found a way to leave it with the source file, but that would potentially overwrite the one for the normal compilation. Which is okay in this case as nothing is different. But it would be problematic should it be advantageous to compile with different flags for tests than normally, for example to make static functions not static in order to be able to access them in tests.