Easy functions have a basic unit test

TODO
Finish unit tests for hard cases
maybe add mocks
add more test cases, ie function_works is bad
separate out more tests
identify functions that do too much
find examples of networking unit tests