mas-bandwidth / netcode

Secure client/server connections over UDP
BSD 3-Clause "New" or "Revised" License
2.44k stars 191 forks source link

Remove unnecessary code duplication in socket_connect tests #132

Closed dbechrd closed 2 months ago

dbechrd commented 2 months ago

All 8 of these tests do exactly the same thing, with various combinations of addresses. With a helper function, you can test everything with ~400 less lines of code, and it's easier to see what the various cases are testing.

Also note that I swapped the order of server_address and server_address2 for the IPv6 test cases such that the IPv6 address is always in server_address. This is to make the helper function the same for all 8 cases, and is functionally identical because netcode_server_create_overload accounts for receiving the addresses in either order.