Fix gcc warning -Wsizeof-pointer-memaccess in test
Fix unused variable warnings in test cases