-- Penlight 1.11.0-1 | /lua/pl/test.lua | https://github.com/lunarmodules/Penlight | License: MIT | Minified using https://www.npmjs.com/package/luamin/v/1.0.4
-- Copyright (C) 2009-2016 Steve Donovan, David Manura.
-- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
local a=require'pl.tablex'local b=require'pl.utils'local c=require'pl.pretty'local d=require'pl.path'local type,e,f=type,b.unpack,b.pack;local g=os.clock;local h=require'debug'local io=io;local function i(j)if type(j)=='table'and not(getmetatable(j)and getmetatable(j).__tostring)then return c.write(j,' ',true)elseif type(j)=='string'then return'"'..j..'"'else return tostring(j)end end;local k={}function k.error_handler(l,m,n,o,p)local q=io.stderr;q:write(d.basename(l)..':'..m..': assertion failed\n')q:write("got:\t",n,'\n')q:write("needed:\t",o,'\n')b.quit(1,p or"these values were not equal")end;local function r(j,s,p,t)local u=h.getinfo(3+(t or 0))k.error_handler(u.short_src,u.currentline,i(j),i(s),p)end;k.complain=r;function k.asserteq(j,s,v,t)local w=j==s;if not w then w=a.deepcompare(j,s,true,v)end;if not w then r(j,s,nil,t)end end;function k.assertmatch(x,y,t)if not x:match(y)then r(x,y,"these strings did not match",t)end end;function k.assertraise(z,A,t)local B,q;if type(z)=='table'then B,q=pcall(e(z))else B,q=pcall(z)end;if B or q:match(A)==nil then r(q,A,"these errors did not match",t)end end;function k.asserteq2(C,D,E,F,t)if C~=E then r(C,E,nil,t)end;if D~=F then r(D,F,nil,t)end end;local G={unpack=e}G.__index=G;function G.__tostring(self)local H={}for u=1,self.n do local I=self[u]H[u]=type(I)=='string'and('%q'):format(I)or tostring(I)end;return'tuple('..table.concat(H,', ')..')'end;function G.__eq(J,K)if J.n~=K.n then return false end;for u=1,J.n do if J[u]~=K[u]then return false end end;return true end;function G.__len(self)return self.n end;function k.tuple(...)return setmetatable(f(...),G)end;function k.timer(p,L,M,...)local N=g()for u=1,L do M(...)end;b.printf("%s: took %7.2f sec\n",p,g()-N)end;return k
