Fixed unsigned/signed mismatch + unsafe type converion warnings in tests

This will remove some compiler warnings when compiling the tests on Visual Studio.