helper function for buffer test