Improved buffer operation test cases with checks for empty buffers.