local F=require("\064\102\114\107\116\101\115\116\047")local r=F.test local R=F.assert.check local B=require("\046\047\117\116\105\108\115")return function()r.suite("\098\105\116\051\050",function()r.case("\098\105\116\119\105\115\101 \111\112\101\114\097\116\105\111\110\115",function()R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123\n\t\t\t\t\098\105\116\051\050\046\098\097\110\100\040\049\044 \051\044 \055\041\044\n\t\t\t\t\098\105\116\051\050\046\098\097\110\100\040-\049\044 -\051\044 -\055\041\044\n\t\t\t\t\098\105\116\051\050\046\098\097\110\100\040\048\046\049\044 \048\046\051\044 \048\046\055\041\n\t\t\t\125\n\t\t\t"))R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123\n\t\t\t\t\098\105\116\051\050\046\098\111\114\040\049\044 \050\044 \052\041\044\n\t\t\t\t\098\105\116\051\050\046\098\111\114\040\048\120\070\048\044 \048\120\048\070\041\044\n\t\t\t\t\098\105\116\051\050\046\098\111\114\040-\049\044 -\050\044 -\052\041\044\n\t\t\t\t\098\105\116\051\050\046\098\111\114\040\048\046\049\044 \048\046\050\044 \048\046\052\041\n\t\t\t\125\n\t\t\t"))R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123\n\t\t\t\t\098\105\116\051\050\046\098\120\111\114\040\049\044 \050\044 \051\041\044\n\t\t\t\t\098\105\116\051\050\046\098\120\111\114\040\048\120\070\070\044 \048\120\065\065\041\044\n\t\t\t\t\098\105\116\051\050\046\098\120\111\114\040-\049\044 -\050\044 -\051\041\044\n\t\t\t\t\098\105\116\051\050\046\098\120\111\114\040\048\046\049\044 \048\046\050\044 \048\046\051\041\n\t\t\t\125\n\t\t\t"))R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123\n\t\t\t\t\098\105\116\051\050\046\108\115\104\105\102\116\040\049\044 \051\041\044\n\t\t\t\t\098\105\116\051\050\046\108\115\104\105\102\116\040\048\120\048\049\044 \056\041\044\n\t\t\t\t\098\105\116\051\050\046\108\115\104\105\102\116\040-\049\044 -\051\041\044\n\t\t\t\t\098\105\116\051\050\046\108\115\104\105\102\116\040\048\046\049\044 \048\046\051\041\n\t\t\t\125\n\t\t\t"))R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123\n\t\t\t\t\098\105\116\051\050\046\114\115\104\105\102\116\040\049\054\044 \050\041\044\n\t\t\t\t\098\105\116\051\050\046\114\115\104\105\102\116\040\048\120\049\048\048\044 \056\041\044\n\t\t\t\t\098\105\116\051\050\046\114\115\104\105\102\116\040-\049\054\044 -\050\041\044\n\t\t\t\t\098\105\116\051\050\046\114\115\104\105\102\116\040\048\046\049\054\044 \048\046\050\041\n\t\t\t\125\n\t\t\t"))R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123\n\t\t\t\t\098\105\116\051\050\046\098\110\111\116\040\048\041\044\n\t\t\t\t\098\105\116\051\050\046\098\110\111\116\040\048\120\070\070\070\070\070\070\070\070\041\044\n\t\t\t\t\098\105\116\051\050\046\098\110\111\116\040-\053\041\044\n\t\t\t\t\098\105\116\051\050\046\098\110\111\116\040\048\046\053\041\n\t\t\t\125\n\t\t\t"))end)r.case("\097\114\115\104\105\102\116",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\097\114\115\104\105\102\116\040\048\098\049\049\049\049\044 \050\041\n\n\t\t\t"))R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\097\114\115\104\105\102\116\040-\052\044 \049\041\n\n\t\t\t"))R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\097\114\115\104\105\102\116\040\048\120\070\070\044 \051\050\041\n\n\t\t\t"))end)r.case("\101\120\116\114\097\099\116",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\101\120\116\114\097\099\116\040\048\120\049\050\051\052\044 \052\044 \052\041\n\n\t\t\t"))R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\101\120\116\114\097\099\116\040\048\120\070\070\070\070\044 \056\044 \056\041\n\n\t\t\t"))end)r.case("\114\114\111\116\097\116\101",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\114\114\111\116\097\116\101\040\048\120\049\050\051\052\053\054\055\056\044 \052\041\n\n\t\t\t"))R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\114\114\111\116\097\116\101\040\048\120\056\048\048\048\048\048\048\048\044 \049\041\n\n\t\t\t"))end)r.case("\108\114\111\116\097\116\101",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\108\114\111\116\097\116\101\040\048\120\049\050\051\052\053\054\055\056\044 \052\041\n\n\t\t\t"))R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\108\114\111\116\097\116\101\040\048\120\056\048\048\048\048\048\048\048\044 \049\041\n\n\t\t\t"))end)r.case("\114\101\112\108\097\099\101",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\114\101\112\108\097\099\101\040\048\120\049\050\051\052\044 \048\120\053\044 \052\044 \052\041\n\n\t\t\t"))R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\114\101\112\108\097\099\101\040\048\120\070\070\070\070\044 \048\120\048\044 \056\044 \056\041\n\n\t\t\t"))end)r.case("\099\111\117\110\116\122",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\099\111\117\110\116\114\122\040\051\050\041\n\n\t\t\t"))R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\105\116\051\050\046\099\111\117\110\116\108\122\040\051\050\041\n\n\t\t\t"))end)end)r.suite("\098\117\102\102\101\114",function()r.case("\105\110\116\101\103\101\114\115",function()R.table.equal(B.execute("\n\t\t\t\108\111\099\097\108 \111\102\102\115\101\116 \061 \048\n\t\t\t\108\111\099\097\108 \098 \061 \098\117\102\102\101\114\046\099\114\101\097\116\101\040\049\052\041\n\n\t\t\t-- \119\114\105\116\105\110\103 \117\110\115\105\103\110\101\100\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\117\056\040\098\044 \111\102\102\115\101\116\044 \050\094\056-\049\041\n\t\t\t\111\102\102\115\101\116 \043\061 \049\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\117\049\054\040\098\044 \111\102\102\115\101\116\044 \050\094\049\054-\049\041\n\t\t\t\111\102\102\115\101\116 \043\061 \050\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\117\051\050\040\098\044 \111\102\102\115\101\116\044 \050\094\051\050-\049\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t-- \119\114\105\116\105\110\103 \115\105\103\110\101\100\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\105\056\040\098\044 \111\102\102\115\101\116\044 \050\094\055-\049\041\n\t\t\t\111\102\102\115\101\116 \043\061 \049\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\105\049\054\040\098\044 \111\102\102\115\101\116\044 \050\094\049\053-\049\041\n\t\t\t\111\102\102\115\101\116 \043\061 \050\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\105\051\050\040\098\044 \111\102\102\115\101\116\044 \050\094\051\049-\049\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t-- \114\101\097\100\105\110\103 \117\110\115\105\103\110\101\100\n\t\t\t\108\111\099\097\108 \114\101\097\100 \061 \123\125\n\t\t\t\111\102\102\115\101\116 \061 \048\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\117\056\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \049\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\117\049\054\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \050\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\117\051\050\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t-- \114\101\097\100\105\110\103 \115\105\103\110\101\100\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\105\056\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \049\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\105\049\054\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \050\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\105\051\050\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t\114\101\116\117\114\110 \123 \098\117\102\102\101\114\046\116\111\115\116\114\105\110\103\040\098\041\044 \116\097\098\108\101\046\099\111\110\099\097\116\040\114\101\097\100\044 \"\044\"\041 \125\n\n\t\t\t"))end)r.case("\102\108\111\097\116\115",function()R.table.equal(B.execute("\n\t\t\t-- \119\114\105\116\105\110\103\n\t\t\t\108\111\099\097\108 \111\102\102\115\101\116 \061 \048\n\t\t\t\108\111\099\097\108 \098 \061 \098\117\102\102\101\114\046\099\114\101\097\116\101\040\049\050 \042 \051\041\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\102\051\050\040\098\044 \111\102\102\115\101\116\044 \049\050\051\052\046\053\054\055\056\057\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\102\054\052\040\098\044 \111\102\102\115\101\116\044 \049\050\051\052\046\053\054\055\056\057\041\n\t\t\t\111\102\102\115\101\116 \043\061 \056\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\102\051\050\040\098\044 \111\102\102\115\101\116\044 \109\097\116\104\046\104\117\103\101\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\102\054\052\040\098\044 \111\102\102\115\101\116\044 \109\097\116\104\046\104\117\103\101\041\n\t\t\t\111\102\102\115\101\116 \043\061 \056\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\102\051\050\040\098\044 \111\102\102\115\101\116\044 \048\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\102\054\052\040\098\044 \111\102\102\115\101\116\044 \048\041\n\t\t\t\111\102\102\115\101\116 \043\061 \056\n\n\t\t\t-- \114\101\097\100\105\110\103\n\t\t\t\108\111\099\097\108 \114\101\097\100 \061 \123\125\n\t\t\t\111\102\102\115\101\116 \061 \048\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\102\051\050\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\102\054\052\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \056\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\102\051\050\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\102\054\052\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \056\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\102\051\050\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\102\054\052\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \056\n\n\t\t\t\114\101\116\117\114\110 \123 \098\117\102\102\101\114\046\116\111\115\116\114\105\110\103\040\098\041\044 \116\097\098\108\101\046\099\111\110\099\097\116\040\114\101\097\100\044 \"\044\"\041 \125\n\n\t\t\t"))end)r.case("\115\116\114\105\110\103\115",function()R.table.equal(B.execute("\n\t\t\t-- \119\114\105\116\105\110\103\n\t\t\t\108\111\099\097\108 \111\102\102\115\101\116 \061 \048\n\t\t\t\108\111\099\097\108 \109\115\103 \061 \"\104\101\108\108\111\"\n\t\t\t\108\111\099\097\108 \099\104\097\114 \061 \"\065\"\n\t\t\t\108\111\099\097\108 \098 \061 \098\117\102\102\101\114\046\099\114\101\097\116\101\040\035\109\115\103 \043 \052 \043 \049\041\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\117\051\050\040\098\044 \111\102\102\115\101\116\044 \049\050\051\052\053\054\055\056\041 -- \106\117\115\116 \097 \116\101\115\116\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\115\116\114\105\110\103\040\098\044 \111\102\102\115\101\116\044 \109\115\103\041\n\t\t\t\111\102\102\115\101\116 \043\061 \035\109\115\103\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\115\116\114\105\110\103\040\098\044 \111\102\102\115\101\116\044 \099\104\097\114\044 \049\041\n\t\t\t\111\102\102\115\101\116 \043\061 \049\n\n\t\t\t-- \114\101\097\100\105\110\103\n\t\t\t\108\111\099\097\108 \114\101\097\100 \061 \123\125\n\t\t\t\111\102\102\115\101\116 \061 \048\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\117\051\050\040\098\044 \111\102\102\115\101\116\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \052\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\115\116\114\105\110\103\040\098\044 \111\102\102\115\101\116\044 \035\109\115\103\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \035\109\115\103\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\115\116\114\105\110\103\040\098\044 \111\102\102\115\101\116\044 \049\041\041\n\t\t\t\111\102\102\115\101\116 \043\061 \049\n\n\t\t\t\114\101\116\117\114\110 \123\098\117\102\102\101\114\046\116\111\115\116\114\105\110\103\040\098\041\044 \116\097\098\108\101\046\099\111\110\099\097\116\040\114\101\097\100\044 \"\044\"\041\125\n\n\t\t\t"))end)r.case("\102\105\108\108",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \098 \061 \098\117\102\102\101\114\046\099\114\101\097\116\101\040\052\041\n\n\t\t\t\098\117\102\102\101\114\046\102\105\108\108\040\098\044 \048\044 \050\053\053\044 \052\041\n\n\t\t\t\114\101\116\117\114\110 \098\117\102\102\101\114\046\116\111\115\116\114\105\110\103\040\098\041\n\n\t\t\t"))end)r.case("\099\111\112\121",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \098 \061 \098\117\102\102\101\114\046\099\114\101\097\116\101\040\052\041\n\t\t\t\108\111\099\097\108 \115\111\117\114\099\101 \061 \098\117\102\102\101\114\046\099\114\101\097\116\101\040\052\041\n\n\t\t\t\098\117\102\102\101\114\046\119\114\105\116\101\117\051\050\040\115\111\117\114\099\101\044 \048\044 \049\050\051\052\053\054\055\056\041\n\t\t\t\098\117\102\102\101\114\046\099\111\112\121\040\098\044 \048\044 \115\111\117\114\099\101\044 \048\044 \052\041\n\n\t\t\t\114\101\116\117\114\110 \098\117\102\102\101\114\046\116\111\115\116\114\105\110\103\040\098\041\n\n\t\t\t"))end)r.case("\108\101\110",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \098\117\102\102\101\114\046\108\101\110\040\098\117\102\102\101\114\046\099\114\101\097\116\101\040\053\041\041\n\n\t\t\t"))end)r.case("\102\114\111\109\115\116\114\105\110\103",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \098 \061 \098\117\102\102\101\114\046\102\114\111\109\115\116\114\105\110\103\040\"\097\098\099\100\"\041\n\n\t\t\t\108\111\099\097\108 \114\101\097\100 \061 \123\125\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\117\051\050\040\098\044 \048\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\105\051\050\040\098\044 \048\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\114\101\097\100\044 \098\117\102\102\101\114\046\114\101\097\100\102\051\050\040\098\044 \048\041\041\n\n\t\t\t\114\101\116\117\114\110 \116\097\098\108\101\046\099\111\110\099\097\116\040\114\101\097\100\044 \"\044\"\041\n\n\t\t\t"))end)end)r.suite("\103\108\111\098\097\108 \102\117\110\099\116\105\111\110\115",function()r.case("\116\121\112\101\115",function()R.table.equal(B.execute("\n\t\t\t\108\111\099\097\108 \116\121\112\101\115 \061 \123\125\n\t\t\t\108\111\099\097\108 \098 \061 \098\117\102\102\101\114\046\099\114\101\097\116\101\040\049\041\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\040\098\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\111\102\040\098\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\040\116\114\117\101\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\111\102\040\102\097\108\115\101\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\040\049\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\111\102\040\050\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\040\"\097\"\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\111\102\040\"\065\066\067\068\"\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\040\123\125\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\111\102\040\123\125\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\040\110\101\119\112\114\111\120\121\040\041\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\111\102\040\110\101\119\112\114\111\120\121\040\041\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\040\116\121\112\101\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\111\102\040\102\117\110\099\116\105\111\110\040\041 \101\110\100\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\040\116\097\098\108\101\046\102\114\101\101\122\101\040\123\125\041\041\041\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\116\121\112\101\115\044 \116\121\112\101\111\102\040\116\097\098\108\101\046\102\114\101\101\122\101\040\123\049\125\041\041\041\n\n\t\t\t\114\101\116\117\114\110 \116\121\112\101\115\n\n\t\t\t"))end)r.case("\114\097\119\115\101\116\047\103\101\116",function()R.equal(B.execute("\t\t\t\108\111\099\097\108 \116 \061 \115\101\116\109\101\116\097\116\097\098\108\101\040\123\125\044 \123\n\t\t\t\t\095\095\110\101\119\105\110\100\101\120 \061 \102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\114\101\116\117\114\110 \"\116\104\105\115 \105\115 \110\101\119\105\110\100\101\120\"\n\t\t\t\t\101\110\100\044\n\t\t\t\t\095\095\105\110\100\101\120 \061 \102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\114\101\116\117\114\110 \"\116\104\105\115 \105\115 \105\110\100\101\120\"\n\t\t\t\t\101\110\100\n\t\t\t\125\041\n\n\t\t\t\114\097\119\115\101\116\040\116\044 \"\107\101\121\"\044 \"\118\097\108\117\101\"\041\n\t\t\t\114\101\116\117\114\110 \114\097\119\103\101\116\040\116\044 \"\107\101\121\"\041\n\n\t\t\t"))end)r.case("\099\097\108\108\105\110\103 \110\101\120\116 \119\105\116\104 \105\110\118\097\108\105\100 \116\097\098\108\101",function()R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123\112\099\097\108\108\040\110\101\120\116\044 \110\101\119\112\114\111\120\121\040\041\041\125\n\t\t\t"))end)r.case("\101\109\117\108\097\116\105\110\103 \110\101\119\112\114\111\120\121\047\117\115\101\114\100\097\116\097",function()R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123\n\t\t\t\t\123\112\099\097\108\108\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\110\101\119\112\114\111\120\121\040\041\046\107\101\121 \061 \116\114\117\101\n\t\t\t\t\101\110\100\041\125\044\n\t\t\t\t\123\112\099\097\108\108\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\114\101\116\117\114\110 \110\101\119\112\114\111\120\121\040\116\114\117\101\041\046\107\101\121\n\t\t\t\t\101\110\100\041\125\044\n\t\t\t\t\123\112\099\097\108\108\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\114\101\116\117\114\110 \110\101\119\112\114\111\120\121\040\102\097\108\115\101\041 \060 \110\101\119\112\114\111\120\121\040\116\114\117\101\041\n\t\t\t\t\101\110\100\041\125\044\n\t\t\t\t\123\112\099\097\108\108\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\114\101\116\117\114\110 \110\101\119\112\114\111\120\121\040\041 \043 \053\n\t\t\t\t\101\110\100\041\125\044\n\t\t\t\125\n\t\t\t"))end)r.case("\105\116\101\114\097\116\111\114\115",function()R.table.equal(B.execute("\n\t\t\t\108\111\099\097\108 \116 \061 \123\125\n\t\t\t\108\111\099\097\108 \104\097\115\104\084\097\098\108\101 \061 \123\n\t\t\t\t\097\112\112\108\101 \061 \053\053\044\n\t\t\t\t\098\097\110\097\110\097 \061 \049\049\049\044\n\t\t\t\t\112\101\097\099\104 \061 \049\050\051\044\n\t\t\t\t\103\114\097\112\101 \061 \050\053\053\n\t\t\t\125\n\n\t\t\t\102\111\114 \095 \061 \049\044 \049\048\048 \100\111\n\t\t\t\t\108\111\099\097\108 \105 \061 \048\n\t\t\t\t\102\111\114 \095\044 \118 \105\110 \112\097\105\114\115\040\104\097\115\104\084\097\098\108\101\041 \100\111\n\t\t\t\t\t\105 \043\061 \049\n\t\t\t\t\t\116\091\105\093 \061 \118\n\t\t\t\t\101\110\100\n\n\t\t\t\t\105 \061 \048\n\t\t\t\t\102\111\114 \095\044 \118 \105\110 \112\097\105\114\115\040\104\097\115\104\084\097\098\108\101\041 \100\111\n\t\t\t\t\t\105 \043\061 \049\n\t\t\t\t\t\116\091\105\093 -\061 \118\n\t\t\t\t\101\110\100\n\t\t\t\101\110\100\n\n\t\t\t\114\101\116\117\114\110 \116\n\n\t\t\t"))end)r.case("\118\101\114\115\105\111\110",function()R.equal(B.executeWithLuau("\n\t\t\t\114\101\116\117\114\110 \095\086\069\082\083\073\079\078\n\n\t\t\t"))end)r.case("\110\101\119\112\114\111\120\121 \119\105\116\104 \109\101\116\097\116\097\098\108\101",function()R.table.equal(B.execute("\n\t\t\t\108\111\099\097\108 \117\100 \061 \110\101\119\112\114\111\120\121\040\116\114\117\101\041\n\t\t\t\108\111\099\097\108 \109\116 \061 \103\101\116\109\101\116\097\116\097\098\108\101\040\117\100\041\n\n\t\t\t\109\116\046\095\095\116\111\115\116\114\105\110\103 \061 \102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\114\101\116\117\114\110 \"\104\101\108\108\111\111\111\"\n\t\t\t\101\110\100\n\n\t\t\t\109\116\046\095\095\108\101\110 \061 \102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\114\101\116\117\114\110 \049\048\048\048\n\t\t\t\101\110\100\n\n\t\t\t\114\101\116\117\114\110 \123\116\111\115\116\114\105\110\103\040\117\100\041\044 \035\117\100\125\n\n\t\t\t"))end)end)r.suite("\109\097\116\104",function()r.case("\097\116\097\110",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\097\116\097\110\040\049\050\051\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\097\116\097\110\040\049\047\051\041\n\t\t\t"))end)r.case("\097\116\097\110\050",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\097\116\097\110\050\040\049\044 \050\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\097\116\097\110\050\040\054\044 \057\041\n\t\t\t"))end)r.case("\099\108\097\109\112",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\099\108\097\109\112\040\053\044 -\049\044 \051\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\099\108\097\109\112\040-\053\044 -\049\044 \049\048\041\n\t\t\t"))end)r.case("\099\111\115\104",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\099\111\115\104\040\049\050\051\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\099\111\115\104\040\109\097\116\104\046\114\097\100\040\051\048\041\041\n\t\t\t"))end)r.case("\115\105\110\104",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\115\105\110\104\040\049\050\051\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\115\105\110\104\040\109\097\116\104\046\114\097\100\040\051\048\041\041\n\t\t\t"))end)r.case("\116\097\110\104",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\116\097\110\104\040\049\050\051\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\116\097\110\104\040\109\097\116\104\046\114\097\100\040\057\048\041\041\n\t\t\t"))end)r.case("\112\111\119",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\112\111\119\040\050\044 \056\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\112\111\119\040\050\044 -\049\054\041\n\t\t\t"))end)r.case("\102\114\101\120\112",function()R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123 \109\097\116\104\046\102\114\101\120\112\040\049\046\050\051\052\041 \125\n\t\t\t"))R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123 \109\097\116\104\046\102\114\101\120\112\040\051\051\041 \125\n\t\t\t"))end)r.case("\108\100\101\120\112",function()R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123 \109\097\116\104\046\108\100\101\120\112\040\049\046\050\051\052\044 \049\046\050\051\052\041 \125\n\t\t\t"))R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123 \109\097\116\104\046\108\100\101\120\112\040\051\051\044 \049\050\041 \125\n\t\t\t"))end)r.case("\108\111\103\049\048",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\108\111\103\049\048\040\049\048\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\108\111\103\049\048\040\050\041\n\t\t\t"))end)r.case("\114\111\117\110\100",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\114\111\117\110\100\040\048\046\053\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\114\111\117\110\100\040\048\046\053\052\051\050\049\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\114\111\117\110\100\040\048\046\049\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\114\111\117\110\100\040\048\046\057\041\n\t\t\t"))end)r.case("\115\105\103\110",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\115\105\103\110\040-\049\050\051\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\115\105\103\110\040\049\050\051\041\n\t\t\t"))end)r.case("\110\111\105\115\101\040\112\101\114\108\105\110\041",function()R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\110\111\105\115\101\040\049\046\053\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\110\111\105\115\101\040\049\046\053\044 \050\046\053\041\n\t\t\t"))R.equal(B.execute("\t\t\t\114\101\116\117\114\110 \109\097\116\104\046\110\111\105\115\101\040\049\046\053\044 \050\046\053\044 \051\046\053\041\n\t\t\t"))end)end)r.suite("\115\116\114\105\110\103",function()r.case("\115\112\108\105\116 \109\101\116\104\111\100",function()R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \040\"\097\044\098\099\044\100\101\102\"\041\058\115\112\108\105\116\040\"\044\"\041\n\t\t\t"))end)r.case("\115\112\108\105\116",function()R.table.equal(B.execute("\t\t\t\114\101\116\117\114\110 \123\n\t\t\t\t\117\110\112\097\099\107\040\115\116\114\105\110\103\046\115\112\108\105\116\040\"\097\112\112\108\101\059\098\097\110\097\110\097\"\044 \"\059\"\041\041\044\n\t\t\t\t\117\110\112\097\099\107\040\115\116\114\105\110\103\046\115\112\108\105\116\040\"\059\097\112\112\108\101\059\098\097\110\097\110\097\059\"\044 \"\059\"\041\041\044\n\t\t\t\t\117\110\112\097\099\107\040\115\116\114\105\110\103\046\115\112\108\105\116\040\"\097\112\112\108\101\059\098\097\110\097\110\097\059\"\044 \"\046\"\041\041\044\n\t\t\t\125\n\t\t\t"))end)end)r.suite("\116\097\098\108\101",function()r.case("\099\114\101\097\116\101 \097\110\100 \099\108\101\097\114",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \116 \061 \116\097\098\108\101\046\099\114\101\097\116\101\040\109\097\116\104\046\114\097\110\100\111\109\040\050\048\044 \053\048\041\044 \"\065\"\041\n\n\t\t\t\116\097\098\108\101\046\099\108\101\097\114\040\116\041\n\n\t\t\t\114\101\116\117\114\110 \035\116\n\n\t\t\t"))end)r.case("\099\108\111\110\101",function()R.table.equal(B.execute("\n\t\t\t\108\111\099\097\108 \099\104\101\099\107\115 \061 \123\125\n\n\t\t\t\108\111\099\097\108 \102\114\117\105\116\115 \061 \123\"\098\097\110\097\110\097\"\044 \"\097\112\112\108\101\"\044 \"\112\101\097\099\104\"\044 \"\103\114\097\112\101\"\125\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\099\104\101\099\107\115\044 \116\097\098\108\101\046\099\108\111\110\101\040\102\114\117\105\116\115\041\041\n\n\t\t\t\108\111\099\097\108 \114\101\097\100\079\110\108\121 \061 \115\101\116\109\101\116\097\116\097\098\108\101\040\123\125\044 \123\n\t\t\t\t\095\095\110\101\119\105\110\100\101\120 \061 \102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\101\114\114\111\114\040\"\116\104\105\115 \105\115 \114\101\097\100-\111\110\108\121\033\"\041\n\t\t\t\t\101\110\100\n\t\t\t\125\041\n\n\t\t\t\116\097\098\108\101\046\105\110\115\101\114\116\040\099\104\101\099\107\115\044 \123\112\099\097\108\108\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\108\111\099\097\108 \110\101\119\082\101\097\100\079\110\108\121 \061 \116\097\098\108\101\046\099\108\111\110\101\040\114\101\097\100\079\110\108\121\041\n\n\t\t\t\t\110\101\119\082\101\097\100\079\110\108\121\046\107\101\121 \061 \"\118\097\108\117\101\"\n\t\t\t\101\110\100\041\125\041\n\n\t\t\t\114\101\116\117\114\110 \099\104\101\099\107\115\n\n\t\t\t"))end)r.case("\102\105\110\100",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \116 \061 \123\"\065\"\044 \"\065\065\"\044 \"\065\065\065\"\044 \"\083\"\044 \"\083\083\"\044 \"\083\083\"\044 \"\083\083\"\044 \"\083\083\"\044 \"\066\066\"\044 \"\066\066\"\044 \"\067\"\125\n\n\t\t\t\114\101\116\117\114\110 \116\097\098\108\101\046\102\105\110\100\040\116\044 \"\083\083\"\041\n\n\t\t\t"))end)r.case("\102\111\114\101\097\099\104",function()R.table.equal(B.execute("\n\t\t\t\108\111\099\097\108 \115\117\109 \061 \048\n\t\t\t\116\097\098\108\101\046\102\111\114\101\097\099\104\040\123 \097 \061 \049\044 \098 \061 \050\044 \099 \061 \051\044 \100 \061 \052 \125\044 \102\117\110\099\116\105\111\110\040\107\044 \118\041\n\t\t\t\t\115\117\109 \061 \115\117\109 \043 \118\n\t\t\t\101\110\100\041\n\n\t\t\t\108\111\099\097\108 \109\115\103 \061 \"\"\n\t\t\t\108\111\099\097\108 \100\111\117\098\108\101\076\097\115\116\073\110\100\101\120 \061 \048\n\t\t\t\116\097\098\108\101\046\102\111\114\101\097\099\104\105\040\123 \"\065\"\044 \"\080\080\"\044 \"\076\"\044 \"\069\" \125\044 \102\117\110\099\116\105\111\110\040\105\044 \118\041\n\t\t\t\t\109\115\103 \061 \109\115\103 \046\046 \118\n\t\t\t\t\100\111\117\098\108\101\076\097\115\116\073\110\100\101\120 \061 \105 \042 \050\n\t\t\t\101\110\100\041\n\n\t\t\t\114\101\116\117\114\110 \123 \115\117\109\044 \109\115\103\044 \100\111\117\098\108\101\076\097\115\116\073\110\100\101\120 \125\n\n\t\t\t"))end)r.case("\102\114\101\101\122\101",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \114\101\097\100\111\110\108\121 \061 \116\097\098\108\101\046\102\114\101\101\122\101\040\123\n\t\t\t\t\107\101\121 \061 \"\111\108\100\086\097\108\117\101\"\n\t\t\t\125\041\n\n\t\t\t\114\101\116\117\114\110 \112\099\097\108\108\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\114\101\097\100\111\110\108\121\046\107\101\121 \061 \"\110\101\119\086\097\108\117\101\"\n\t\t\t\101\110\100\041\n\n\t\t\t"))end)r.case("\103\101\116\110 \109\097\120\110",function()R.table.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \123\n\t\t\t\t\116\097\098\108\101\046\103\101\116\110\040\123\049\044 \050\044 \051\044 \052\125\041\044\n\t\t\t\t\116\097\098\108\101\046\109\097\120\110\040\123\"\097\112\112\108\101\"\044 \"\098\097\110\097\110\097\"\044 \"\103\114\097\112\101\"\125\041\n\t\t\t\125\n\n\t\t\t"))end)end)r.suite("\100\101\098\117\103",function()r.case("\116\114\097\099\101\098\097\099\107\095\116\104\114\101\097\100",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \100\101\098\117\103\046\116\114\097\099\101\098\097\099\107\040\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\108\111\099\097\108 \099\111 \061 \099\111\114\111\117\116\105\110\101\046\099\114\101\097\116\101\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\099\111\114\111\117\116\105\110\101\046\121\105\101\108\100\040\041\n\t\t\t\t\101\110\100\041\n\t\t\t\t\099\111\114\111\117\116\105\110\101\046\114\101\115\117\109\101\040\099\111\041\n\t\t\t\t\114\101\116\117\114\110 \099\111\n\t\t\t\101\110\100\041\040\041\044 \'\097\112\112\108\101\'\044 \050\041\n\n\t\t\t"))end)r.case("\116\114\097\099\101\098\097\099\107\095\109\115\103",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \116\n\t\t\t\114\101\116\117\114\110 \040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\108\111\099\097\108 \099\111 \061 \099\111\114\111\117\116\105\110\101\046\099\114\101\097\116\101\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\116 \061 \100\101\098\117\103\046\116\114\097\099\101\098\097\099\107\040\'\097\112\112\108\101\'\044 \050\041\n\t\t\t\t\t\099\111\114\111\117\116\105\110\101\046\121\105\101\108\100\040\041\n\t\t\t\t\101\110\100\041\n\t\t\t\t\099\111\114\111\117\116\105\110\101\046\114\101\115\117\109\101\040\099\111\041\n\t\t\t\t\114\101\116\117\114\110 \116\n\t\t\t\101\110\100\041\040\041\n\n\t\t\t"))end)r.case("\105\110\102\111\095\116\104\114\101\097\100",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \102\117\110\099\116\105\111\110 \103\101\116\073\110\102\111\040\041\n\t\t\t\t\108\111\099\097\108 \116 \061 \123\125\n\t\t\t\t\102\111\114 \105\061\049\044 \054 \100\111\n\t\t\t\t\t\116\091\035\116 \043 \049\093 \061 \100\101\098\117\103\046\105\110\102\111\040\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\t\108\111\099\097\108 \099\111 \061 \099\111\114\111\117\116\105\110\101\046\099\114\101\097\116\101\040\102\117\110\099\116\105\111\110\040\041\n\t\t\t\t\t\t\t\099\111\114\111\117\116\105\110\101\046\121\105\101\108\100\040\041\n\t\t\t\t\t\t\101\110\100\041\n\t\t\t\t\t\t\099\111\114\111\117\116\105\110\101\046\114\101\115\117\109\101\040\099\111\041\n\t\t\t\t\t\t\114\101\116\117\114\110 \099\111\n\t\t\t\t\t\101\110\100\041\040\041\044 \105 - \049\044 \'\115\108\110\102\'\041\n\t\t\t\t\101\110\100\n\t\t\t\t\114\101\116\117\114\110 \116\n\t\t\t\101\110\100\n\n\t\t\t\114\101\116\117\114\110 \116\097\098\108\101\046\117\110\112\097\099\107\040\103\101\116\073\110\102\111\040\041\041\n\n\t\t\t"))end)r.case("\105\110\102\111\095\102\117\110\099\116\105\111\110",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \102\117\110\099\116\105\111\110 \120\040\110\117\109\041\n\t\t\t\t\114\101\116\117\114\110 \110\117\109 \042 \050\n\t\t\t\101\110\100\n\n\t\t\t\108\111\099\097\108 \102\117\110\099\116\105\111\110 \103\101\116\073\110\102\111\040\041\n\t\t\t\t\100\101\098\117\103\046\105\110\102\111\040\120\044 \'\115\108\110\102\'\041\n\t\t\t\101\110\100\n\n\t\t\t\114\101\116\117\114\110 \103\101\116\073\110\102\111\040\041\n\n\t\t\t"))end)r.case("\105\110\102\111\095\110\117\109\098\101\114",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \102\117\110\099\116\105\111\110 \103\101\116\073\110\102\111\040\041\n\t\t\t\t\108\111\099\097\108 \116 \061 \123\125\n\t\t\t\t\102\111\114 \105\061\049\044 \054 \100\111\n\t\t\t\t\t\116\091\035\116 \043 \049\093 \061 \100\101\098\117\103\046\105\110\102\111\040\105 - \049\044 \'\115\108\110\102\'\041\n\t\t\t\t\101\110\100\n\t\t\t\t\114\101\116\117\114\110 \116\n\t\t\t\101\110\100\n\n\t\t\t\114\101\116\117\114\110 \116\097\098\108\101\046\117\110\112\097\099\107\040\103\101\116\073\110\102\111\040\041\041\n\n\t\t\t"))end)end)r.suite("\117\116\102\056",function()r.case("\111\102\102\115\101\116",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \117\116\102\056\046\111\102\102\115\101\116\040\'\237\149\156\'\044 \048\044 \049\041\n\n\t\t\t"))end)r.case("\099\111\100\101\112\111\105\110\116",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \117\116\102\056\046\099\111\100\101\112\111\105\110\116\040\'\235\183\129\235\145\153\'\044 \049\044 \052\041\n\n\t\t\t"))end)r.case("\099\104\097\114",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \117\116\102\056\046\099\104\097\114\040\054\053\044 \053\048\048\048\044 \054\055\041\n\n\t\t\t"))end)r.case("\108\101\110",function()R.equal(B.execute("\n\t\t\t\114\101\116\117\114\110 \117\116\102\056\046\108\101\110\040\'\237\149\156\234\184\128\'\041\n\n\t\t\t"))end)r.case("\099\111\100\101\115",function()R.equal(B.execute("\n\t\t\t\108\111\099\097\108 \112\111\115\082\101\115\117\108\116 \061 \048\n\t\t\t\108\111\099\097\108 \099\111\100\101\082\101\115\117\108\116 \061 \048\n\n\t\t\t\102\111\114 \112\111\115\044 \099\111\100\101 \105\110 \117\116\102\056\046\099\111\100\101\115\040\"\236\149\136\235\133\149\237\149\152\236\132\184\236\154\148\"\041 \100\111\n\t\t\t\t\112\111\115\082\101\115\117\108\116 \061 \112\111\115\082\101\115\117\108\116 \043 \112\111\115\n\t\t\t\t\099\111\100\101\082\101\115\117\108\116 \061 \099\111\100\101\082\101\115\117\108\116 \043 \099\111\100\101\n\t\t\t\101\110\100\n\n\t\t\t\114\101\116\117\114\110 \112\111\115\082\101\115\117\108\116\044 \099\111\100\101\082\101\115\117\108\116\n\n\t\t\t"))end)end)end
local frktest = require("@frktest/")
local test = frktest.test
local check = frktest.assert.check
local utils = require("./utils")

return function()
	test.suite("bit32", function()
		test.case("bitwise operations", function()
			check.table.equal(utils.execute([[
			return {
				bit32.band(1, 3, 7),
				bit32.band(-1, -3, -7),
				bit32.band(0.1, 0.3, 0.7)
			}
			]]))

			check.table.equal(utils.execute([[
			return {
				bit32.bor(1, 2, 4),
				bit32.bor(0xF0, 0x0F),
				bit32.bor(-1, -2, -4),
				bit32.bor(0.1, 0.2, 0.4)
			}
			]]))

			check.table.equal(utils.execute([[
			return {
				bit32.bxor(1, 2, 3),
				bit32.bxor(0xFF, 0xAA),
				bit32.bxor(-1, -2, -3),
				bit32.bxor(0.1, 0.2, 0.3)
			}
			]]))

			check.table.equal(utils.execute([[
			return {
				bit32.lshift(1, 3),
				bit32.lshift(0x01, 8),
				bit32.lshift(-1, -3),
				bit32.lshift(0.1, 0.3)
			}
			]]))

			check.table.equal(utils.execute([[
			return {
				bit32.rshift(16, 2),
				bit32.rshift(0x100, 8),
				bit32.rshift(-16, -2),
				bit32.rshift(0.16, 0.2)
			}
			]]))

			check.table.equal(utils.execute([[
			return {
				bit32.bnot(0),
				bit32.bnot(0xFFFFFFFF),
				bit32.bnot(-5),
				bit32.bnot(0.5)
			}
			]]))
		end)

		test.case("arshift", function()
			check.equal(utils.execute([[

			return bit32.arshift(0b1111, 2)

			]]))

			check.equal(utils.execute([[

			return bit32.arshift(-4, 1)

			]]))

			check.equal(utils.execute([[

			return bit32.arshift(0xFF, 32)

			]]))
		end)

		test.case("extract", function()
			check.equal(utils.execute([[

			return bit32.extract(0x1234, 4, 4)

			]]))

			check.equal(utils.execute([[

			return bit32.extract(0xFFFF, 8, 8)

			]]))
		end)

		test.case("rrotate", function()
			check.equal(utils.execute([[

			return bit32.rrotate(0x12345678, 4)

			]]))

			check.equal(utils.execute([[

			return bit32.rrotate(0x80000000, 1)

			]]))
		end)

		test.case("lrotate", function()
			check.equal(utils.execute([[

			return bit32.lrotate(0x12345678, 4)

			]]))

			check.equal(utils.execute([[

			return bit32.lrotate(0x80000000, 1)

			]]))
		end)

		test.case("replace", function()
			check.equal(utils.execute([[

			return bit32.replace(0x1234, 0x5, 4, 4)

			]]))

			check.equal(utils.execute([[

			return bit32.replace(0xFFFF, 0x0, 8, 8)

			]]))
		end)

		test.case("countz", function()
			check.equal(utils.execute([[

			return bit32.countrz(32)

			]]))

			check.equal(utils.execute([[

			return bit32.countlz(32)

			]]))
		end)
	end)

	test.suite("buffer", function()
		test.case("integers", function()
			check.table.equal(utils.execute([[

			local offset = 0
			local b = buffer.create(14)

			-- writing unsigned
			buffer.writeu8(b, offset, 2^8-1)
			offset += 1

			buffer.writeu16(b, offset, 2^16-1)
			offset += 2

			buffer.writeu32(b, offset, 2^32-1)
			offset += 4

			-- writing signed
			buffer.writei8(b, offset, 2^7-1)
			offset += 1

			buffer.writei16(b, offset, 2^15-1)
			offset += 2

			buffer.writei32(b, offset, 2^31-1)
			offset += 4

			-- reading unsigned
			local read = {}
			offset = 0

			table.insert(read, buffer.readu8(b, offset))
			offset += 1

			table.insert(read, buffer.readu16(b, offset))
			offset += 2

			table.insert(read, buffer.readu32(b, offset))
			offset += 4

			-- reading signed
			table.insert(read, buffer.readi8(b, offset))
			offset += 1

			table.insert(read, buffer.readi16(b, offset))
			offset += 2

			table.insert(read, buffer.readi32(b, offset))
			offset += 4

			return { buffer.tostring(b), table.concat(read, ",") }

			]]))
		end)

		test.case("floats", function()
			check.table.equal(utils.execute([[

			-- writing
			local offset = 0
			local b = buffer.create(12 * 3)

			buffer.writef32(b, offset, 1234.56789)
			offset += 4

			buffer.writef64(b, offset, 1234.56789)
			offset += 8

			buffer.writef32(b, offset, math.huge)
			offset += 4

			buffer.writef64(b, offset, math.huge)
			offset += 8

			buffer.writef32(b, offset, 0)
			offset += 4

			buffer.writef64(b, offset, 0)
			offset += 8

			-- reading
			local read = {}
			offset = 0

			table.insert(read, buffer.readf32(b, offset))
			offset += 4

			table.insert(read, buffer.readf64(b, offset))
			offset += 8

			table.insert(read, buffer.readf32(b, offset))
			offset += 4

			table.insert(read, buffer.readf64(b, offset))
			offset += 8

			table.insert(read, buffer.readf32(b, offset))
			offset += 4

			table.insert(read, buffer.readf64(b, offset))
			offset += 8

			return { buffer.tostring(b), table.concat(read, ",") }

			]]))
		end)

		test.case("strings", function()
			check.table.equal(utils.execute([[

			-- writing
			local offset = 0
			local msg = "hello"
			local char = "A"
			local b = buffer.create(#msg + 4 + 1)

			buffer.writeu32(b, offset, 12345678) -- just a test
			offset += 4

			buffer.writestring(b, offset, msg)
			offset += #msg

			buffer.writestring(b, offset, char, 1)
			offset += 1

			-- reading
			local read = {}
			offset = 0

			table.insert(read, buffer.readu32(b, offset))
			offset += 4

			table.insert(read, buffer.readstring(b, offset, #msg))
			offset += #msg

			table.insert(read, buffer.readstring(b, offset, 1))
			offset += 1

			return {buffer.tostring(b), table.concat(read, ",")}

			]]))
		end)

		test.case("fill", function()
			check.equal(utils.execute([[

			local b = buffer.create(4)

			buffer.fill(b, 0, 255, 4)

			return buffer.tostring(b)

			]]))
		end)

		test.case("copy", function()
			check.equal(utils.execute([[

			local b = buffer.create(4)
			local source = buffer.create(4)

			buffer.writeu32(source, 0, 12345678)
			buffer.copy(b, 0, source, 0, 4)

			return buffer.tostring(b)

			]]))
		end)

		test.case("len", function()
			check.equal(utils.execute([[

			return buffer.len(buffer.create(5))

			]]))
		end)

		test.case("fromstring", function()
			check.equal(utils.execute([[

			local b = buffer.fromstring("abcd")

			local read = {}

			table.insert(read, buffer.readu32(b, 0))
			table.insert(read, buffer.readi32(b, 0))
			table.insert(read, buffer.readf32(b, 0))

			return table.concat(read, ",")

			]]))
		end)
	end)

	test.suite("global functions", function()
		test.case("types", function()
			check.table.equal(utils.execute([[

			local types = {}
			local b = buffer.create(1)

			table.insert(types, type(b))
			table.insert(types, typeof(b))
			table.insert(types, type(true))
			table.insert(types, typeof(false))
			table.insert(types, type(1))
			table.insert(types, typeof(2))
			table.insert(types, type("a"))
			table.insert(types, typeof("ABCD"))
			table.insert(types, type({}))
			table.insert(types, typeof({}))
			table.insert(types, type(newproxy()))
			table.insert(types, typeof(newproxy()))
			table.insert(types, type(type))
			table.insert(types, typeof(function() end))
			table.insert(types, type(table.freeze({})))
			table.insert(types, typeof(table.freeze({1})))

			return types

			]]))
		end)

		test.case("rawset/get", function()
			check.equal(utils.execute([[
			local t = setmetatable({}, {
				__newindex = function()
					return "this is newindex"
				end,
				__index = function()
					return "this is index"
				end
			})

			rawset(t, "key", "value")
			return rawget(t, "key")

			]]))
		end)

		test.case("calling next with invalid table", function()
			check.table.equal(utils.execute([[
			return {pcall(next, newproxy())}
			]]))
		end)

		test.case("emulating newproxy/userdata", function()
			check.table.equal(utils.execute([[
			return {
				{pcall(function()
					newproxy().key = true
				end)},
				{pcall(function()
					return newproxy(true).key
				end)},
				{pcall(function()
					return newproxy(false) < newproxy(true)
				end)},
				{pcall(function()
					return newproxy() + 5
				end)},
			}
			]]))
		end)

		test.case("iterators", function()
			check.table.equal(utils.execute([[

			local t = {}
			local hashTable = {
				apple = 55,
				banana = 111,
				peach = 123,
				grape = 255
			}

			for _ = 1, 100 do
				local i = 0
				for _, v in pairs(hashTable) do
					i += 1
					t[i] = v
				end

				i = 0
				for _, v in pairs(hashTable) do
					i += 1
					t[i] -= v
				end
			end

			return t

			]]))
		end)

		test.case("version", function()
			check.equal(utils.executeWithLuau([[

			return _VERSION

			]]))
		end)

		test.case("newproxy with metatable", function()
			check.table.equal(utils.execute([[

			local ud = newproxy(true)
			local mt = getmetatable(ud)

			mt.__tostring = function()
				return "hellooo"
			end

			mt.__len = function()
				return 1000
			end

			return {tostring(ud), #ud}

			]]))
		end)
	end)

	test.suite("math", function()
		test.case("atan", function()
			check.equal(utils.execute([[
			return math.atan(123)
			]]))

			check.equal(utils.execute([[
			return math.atan(1/3)
			]]))
		end)

		test.case("atan2", function()
			check.equal(utils.execute([[
			return math.atan2(1, 2)
			]]))

			check.equal(utils.execute([[
			return math.atan2(6, 9)
			]]))
		end)

		test.case("clamp", function()
			check.equal(utils.execute([[
			return math.clamp(5, -1, 3)
			]]))

			check.equal(utils.execute([[
			return math.clamp(-5, -1, 10)
			]]))
		end)

		test.case("cosh", function()
			check.equal(utils.execute([[
			return math.cosh(123)
			]]))

			check.equal(utils.execute([[
			return math.cosh(math.rad(30))
			]]))
		end)

		test.case("sinh", function()
			check.equal(utils.execute([[
			return math.sinh(123)
			]]))

			check.equal(utils.execute([[
			return math.sinh(math.rad(30))
			]]))
		end)

		test.case("tanh", function()
			check.equal(utils.execute([[
			return math.tanh(123)
			]]))

			check.equal(utils.execute([[
			return math.tanh(math.rad(90))
			]]))
		end)

		test.case("pow", function()
			check.equal(utils.execute([[
			return math.pow(2, 8)
			]]))

			check.equal(utils.execute([[
			return math.pow(2, -16)
			]]))
		end)

		test.case("frexp", function()
			check.table.equal(utils.execute([[
			return { math.frexp(1.234) }
			]]))

			check.table.equal(utils.execute([[
			return { math.frexp(33) }
			]]))
		end)

		test.case("ldexp", function()
			check.table.equal(utils.execute([[
			return { math.ldexp(1.234, 1.234) }
			]]))

			check.table.equal(utils.execute([[
			return { math.ldexp(33, 12) }
			]]))
		end)

		test.case("log10", function()
			check.equal(utils.execute([[
			return math.log10(10)
			]]))

			check.equal(utils.execute([[
			return math.log10(2)
			]]))
		end)

		test.case("round", function()
			check.equal(utils.execute([[
			return math.round(0.5)
			]]))

			check.equal(utils.execute([[
			return math.round(0.54321)
			]]))

			check.equal(utils.execute([[
			return math.round(0.1)
			]]))

			check.equal(utils.execute([[
			return math.round(0.9)
			]]))
		end)

		test.case("sign", function()
			check.equal(utils.execute([[
			return math.sign(-123)
			]]))

			check.equal(utils.execute([[
			return math.sign(123)
			]]))
		end)

		test.case("noise(perlin)", function()
			check.equal(utils.execute([[
			return math.noise(1.5)
			]]))

			check.equal(utils.execute([[
			return math.noise(1.5, 2.5)
			]]))

			check.equal(utils.execute([[
			return math.noise(1.5, 2.5, 3.5)
			]]))
		end)
	end)

	test.suite("string", function()
		test.case("split method", function()
			check.table.equal(utils.execute([[
			return ("a,bc,def"):split(",")
			]]))
		end)

		test.case("split", function()
			check.table.equal(utils.execute([[
			return {
				unpack(string.split("apple;banana", ";")),
				unpack(string.split(";apple;banana;", ";")),
				unpack(string.split("apple;banana;", ".")),
			}
			]]))
		end)
	end)

	test.suite("table", function()
		test.case("create and clear", function()
			check.equal(utils.execute([[

			local t = table.create(math.random(20, 50), "A")

			table.clear(t)

			return #t

			]]))
		end)

		test.case("clone", function()
			check.table.equal(utils.execute([[

			local checks = {}

			local fruits = {"banana", "apple", "peach", "grape"}

			table.insert(checks, table.clone(fruits))

			local readOnly = setmetatable({}, {
				__newindex = function()
					error("this is read-only!")
				end
			})

			table.insert(checks, {pcall(function()
				local newReadOnly = table.clone(readOnly)

				newReadOnly.key = "value"
			end)})

			return checks

			]]))
		end)

		test.case("find", function()
			check.equal(utils.execute([[

			local t = {"A", "AA", "AAA", "S", "SS", "SS", "SS", "SS", "BB", "BB", "C"}

			return table.find(t, "SS")

			]]))
		end)

		test.case("foreach", function()
			check.table.equal(utils.execute([[

			local sum = 0
			table.foreach({ a = 1, b = 2, c = 3, d = 4 }, function(k, v)
				sum = sum + v
			end)

			local msg = ""
			local doubleLastIndex = 0
			table.foreachi({ "A", "PP", "L", "E" }, function(i, v)
				msg = msg .. v
				doubleLastIndex = i * 2
			end)

			return { sum, msg, doubleLastIndex }

			]]))
		end)

		test.case("freeze", function()
			check.equal(utils.execute([[

			local readonly = table.freeze({
				key = "oldValue"
			})

			return pcall(function()
				readonly.key = "newValue"
			end)

			]]))
		end)

		test.case("getn maxn", function()
			check.table.equal(utils.execute([[

			return {
				table.getn({1, 2, 3, 4}),
				table.maxn({"apple", "banana", "grape"})
			}

			]]))
		end)
	end)

	test.suite("debug", function()
		test.case("traceback_thread", function()
			check.equal(utils.execute([[

			return debug.traceback((function()
				local co = coroutine.create(function()
					coroutine.yield()
				end)
				coroutine.resume(co)
				return co
			end)(), 'apple', 2)

			]]))
		end)

		test.case("traceback_msg", function()
			check.equal(utils.execute([[

			local t
			return (function()
				local co = coroutine.create(function()
					t = debug.traceback('apple', 2)
					coroutine.yield()
				end)
				coroutine.resume(co)
				return t
			end)()

			]]))
		end)

		test.case("info_thread", function()
			check.equal(utils.execute([[

			local function getInfo()
				local t = {}
				for i=1, 6 do
					t[#t + 1] = debug.info((function()
						local co = coroutine.create(function()
							coroutine.yield()
						end)
						coroutine.resume(co)
						return co
					end)(), i - 1, 'slnf')
				end
				return t
			end

			return table.unpack(getInfo())

			]]))
		end)

		test.case("info_function", function()
			check.equal(utils.execute([[

			local function x(num)
				return num * 2
			end

			local function getInfo()
				debug.info(x, 'slnf')
			end

			return getInfo()

			]]))
		end)

		test.case("info_number", function()
			check.equal(utils.execute([[

			local function getInfo()
				local t = {}
				for i=1, 6 do
					t[#t + 1] = debug.info(i - 1, 'slnf')
				end
				return t
			end

			return table.unpack(getInfo())

			]]))
		end)
	end)

	test.suite("utf8", function()
		test.case("offset", function()
			check.equal(utils.execute([[

			return utf8.offset('한', 0, 1)

			]]))
		end)

		test.case("codepoint", function()
			check.equal(utils.execute([[

			return utf8.codepoint('뷁둙', 1, 4)

			]]))
		end)

		test.case("char", function()
			check.equal(utils.execute([[

			return utf8.char(65, 5000, 67)

			]]))
		end)

		test.case("len", function()
			check.equal(utils.execute([[

			return utf8.len('한글')

			]]))
		end)

		test.case("codes", function()
			check.equal(utils.execute([[

			local posResult = 0
			local codeResult = 0

			for pos, code in utf8.codes("안녕하세요") do
				posResult = posResult + pos
				codeResult = codeResult + code
			end

			return posResult, codeResult

			]]))
		end)
	end)
end
