Clean up the <libgen.h> implementation a little, bring in tests.

Most of these tests were in system/extras, but I've added more to cover other
cases explicitly mentioned by POSIX.

Change-Id: I5e8d77e4179028d77306935cceadbb505515dcde
diff --git a/tests/Android.mk b/tests/Android.mk
index f948fea..68dee10 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -27,6 +27,7 @@
 test_src_files = \
     dirent_test.cpp \
     getcwd_test.cpp \
+    libgen_test.cpp \
     pthread_test.cpp \
     regex_test.cpp \
     stack_protector_test.cpp \