[Win32] Port Tests to Win32

Adds a test fixture to remove some duplicated code. Still finding
port-related bugs.
[Win32] Testing Framework work
[Win32] Add more missing casts, more cleanup
[Win32] She Works!

Win32 port works, test files can be encoded and decoded successfully.
Still seeing some problems out of test_pattern(), but I'm starting to
believe that the library's code is sound (if ugly) and the real problem
is in the test case.