Merge pull request #264 from jwwang/add_gtests

Add gtests
Remove fallback defines for NULL

No actual (supported) compiler lacks a definition for NULL, and it
is mandated to be present in stddef.h according to the C89 standard.
Open output files in binary mode in the testsuite

This fixes running tests on windows.
Include <algorithm> for std::min

This fixes building the test code on MSVC 2013.

(Actually building all of the tests on windows still is tricky
due to the OpenSSL dependency for SHA1, but there's a patchset
in review to take care of that.)
Merge pull request #265 from mstorsjo/fix-tests-windows

Fix building/running tests on windows
Merge pull request #266 from mstorsjo/remove-null-define

Remove fallback defines for NULL
1. support .c in makefile generator. 2. add test to check C interfaces.