Moved all tests top level, so they're shared with OS X target
Added Writebatch's tests
Fix some memory issues