var pump=require("./index"),rs=require("fs").createReadStream("/dev/random"),ws=require("fs").createWriteStream("/dev/null"),toHex=function(){var e=new(require("stream").Transform);return e._transform=function(r,o,s){e.push(r.toString("hex")),s()},e},wsClosed=!1,rsClosed=!1,callbackCalled=!1,check=function(){wsClosed&&rsClosed&&callbackCalled&&(console.log("test-node.js passes"),clearTimeout(timeout))};ws.on("close",function(){wsClosed=!0,check()}),rs.on("close",function(){rsClosed=!0,check()});var res=pump(rs,toHex(),toHex(),toHex(),ws,function(){callbackCalled=!0,check()});if(res!==ws)throw new Error("should return last stream");setTimeout(function(){rs.destroy()},1e3);var timeout=setTimeout(function(){throw new Error("timeout")},5e3);