rename membuf_exchange, improve tests