Improve test code for verifying bit size of keys