return function()local E=(game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")).Packages.Monolith local p=require(E.LinkedDeque)describe("\067\111\110\115\116\114\117\099\116\111\114",function()it("\115\104\111\117\108\100 \099\114\101\097\116\101 \097\110 \101\109\112\116\121 \076\105\110\107\101\100\068\101\113\117\101",function()local E=p.new();(expect(E:Empty())).to.equal(true)end)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \097 \076\105\110\107\101\100\068\101\113\117\101 \102\114\111\109 \097 \116\097\098\108\101",function()local E={1,2;3,4;5}local R=p.new(E);(expect(R:Count())).to.equal(#E)local g=1 while R:Count()>0 do local p=R:Shift();(expect(p)).to.equal(E[g])g=g+1 end end)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \097 \076\105\110\107\101\100\068\101\113\117\101 \102\114\111\109 \097 \067\111\108\108\101\099\116\105\111\110",function()local E=p.new({1;2;3;4,5})local R=p.new(E);(expect(R:Count())).to.equal(E:Count())while R:Count()>0 do local p=R:Shift()local g=E:Shift();(expect(p)).to.equal(g)end end)it("\115\104\111\117\108\100 \101\114\114\111\114 \119\104\101\110 \097\116\116\101\109\112\116\105\110\103 \116\111 \099\114\101\097\116\101 \097 \076\105\110\107\101\100\068\101\113\117\101 \102\114\111\109 \097 \110\111\110-\116\097\098\108\101",function()(expect(function()p.new(true)end)).to.throw("\067\097\110\110\111\116 \099\111\110\115\116\114\117\099\116 \076\105\110\107\101\100\068\101\113\117\101 \102\114\111\109 \116\121\112\101 \098\111\111\108\101\097\110\046");(expect(function()p.new(1)end)).to.throw("\067\097\110\110\111\116 \099\111\110\115\116\114\117\099\116 \076\105\110\107\101\100\068\101\113\117\101 \102\114\111\109 \116\121\112\101 \110\117\109\098\101\114\046");(expect(function()p.new("\115\116\114\105\110\103")end)).to.throw("\067\097\110\110\111\116 \099\111\110\115\116\114\117\099\116 \076\105\110\107\101\100\068\101\113\117\101 \102\114\111\109 \116\121\112\101 \115\116\114\105\110\103\046");(expect(function()p.new(function() end)end)).to.throw("\067\097\110\110\111\116 \099\111\110\115\116\114\117\099\116 \076\105\110\107\101\100\068\101\113\117\101 \102\114\111\109 \116\121\112\101 \102\117\110\099\116\105\111\110\046");(expect(function()p.new(Instance.new("\070\111\108\100\101\114"))end)).to.throw("\067\097\110\110\111\116 \099\111\110\115\116\114\117\099\116 \076\105\110\107\101\100\068\101\113\117\101 \102\114\111\109 \116\121\112\101 \117\115\101\114\100\097\116\097\046");(expect(function()p.new(coroutine.create(function() end))end)).to.throw("\067\097\110\110\111\116 \099\111\110\115\116\114\117\099\116 \076\105\110\107\101\100\068\101\113\117\101 \102\114\111\109 \116\121\112\101 \116\104\114\101\097\100\046")end)end)describe("\069\110\117\109\101\114\097\098\108\101 \073\110\116\101\114\102\097\099\101",function()describe("\069\110\117\109\101\114\097\116\111\114",function()it("\115\104\111\117\108\100 \112\114\111\118\105\100\101 \097\110 \105\116\101\114\097\116\111\114 \103\101\110\101\114\097\116\111\114",function()local E=p.new()local R=E:Enumerator();(expect(R)).to.be.a("\102\117\110\099\116\105\111\110")end)it("\115\104\111\117\108\100 \101\110\117\109\101\114\097\116\101 \105\110 \097 \103\101\110\101\114\105\099 \102\111\114 \108\111\111\112",function()local E=p.new()local R=10 for p=1,R,1 do E:Add(p)end local g=0 for E,p in E:Enumerator()do g=g+1;(expect(E)).to.be.a("\110\117\109\098\101\114");(expect(p)).to.be.a("\110\117\109\098\101\114")end;(expect(g)).to.equal(R)end)end)end)describe("\067\111\108\108\101\099\116\105\111\110 \073\110\116\101\114\102\097\099\101",function()describe("\082\101\113\117\105\114\101\100 \077\101\116\104\111\100\115",function()describe("\067\111\110\116\097\105\110\115",function()it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \097\110\121 \101\108\101\109\101\110\116 \119\104\101\110 \101\109\112\116\121",function()local E=p.new();(expect(E:Contains(0))).to.equal(false)end)it("\115\104\111\117\108\100 \102\105\110\100 \097\110 \101\108\101\109\101\110\116 \119\104\101\110 \116\104\097\116 \101\108\101\109\101\110\116 \101\120\105\115\116\115",function()local E=p.new({1;2,3;4;5});(expect(E:Contains(1))).to.equal(true)end)it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \097\110 \101\108\101\109\101\110\116 \119\104\101\110 \116\104\097\116 \101\108\101\109\101\110\116 \100\111\101\115 \110\111\116 \101\120\105\115\116",function()local E=p.new({1;2,3,4;5});(expect(E:Contains(0))).to.equal(false)end)it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \097\110 \101\108\101\109\101\110\116 \117\110\116\105\108 \105\116 \105\115 \097\100\100\101\100",function()local E=p.new({1,2;3,4;5});(expect(E:Contains(0))).to.equal(false)E:Add(0);(expect(E:Contains(0))).to.equal(true)end)it("\115\104\111\117\108\100 \110\111 \108\111\110\103\101\114 \102\105\110\100 \097\110 \101\108\101\109\101\110\116 \119\104\101\110 \105\116\115 \114\101\109\111\118\101\100",function()local E=p.new({1,2,3;4,5});(expect(E:Contains(1))).to.equal(true)E:Remove(1);(expect(E:Contains(1))).to.equal(false)end)end)describe("\067\111\110\116\097\105\110\115\065\108\108",function()it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \097\110\121 \101\108\101\109\101\110\116 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()local R=p.new({1,2,3,4,5});(expect(E:ContainsAll(R))).to.equal(false)end)it("\115\104\111\117\108\100 \102\105\110\100 \097\108\108 \122\101\114\111 \101\108\101\109\101\110\116\115 \119\104\101\110 \116\104\101 \112\114\111\118\105\100\101\100 \067\111\108\108\101\099\116\105\111\110 \105\115 \101\109\112\116\121",function()local E=p.new({1;2,3,4;5})local R=p.new();(expect(E:ContainsAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \102\105\110\100 \097\108\108 \101\108\101\109\101\110\116\115 \119\104\101\110 \097\108\108 \111\102 \116\104\101 \101\108\101\109\101\110\116\115 \101\120\105\115\116",function()local E=p.new({1;2,3,4,5})local R=p.new({1;2,3;4;5});(expect(E:ContainsAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \102\105\110\100 \111\110\101 \101\108\101\109\101\110\116 \119\104\101\110 \105\116 \101\120\105\115\116\115",function()local E=p.new({1;2,3;4,5})local R=p.new({3});(expect(E:ContainsAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \097\108\108 \101\108\101\109\101\110\116\115 \119\104\101\110 \111\110\101 \100\111\101\115 \110\111\116 \101\120\105\115\116",function()local E=p.new({1,2,4;5})local R=p.new({1,2;3;4;5});(expect(E:ContainsAll(R))).to.equal(false)end)it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \111\110\101 \101\108\101\109\101\110\116 \119\104\101\110 \105\116 \100\111\101\115 \110\111\116 \101\120\105\115\116",function()local E=p.new({1,2,4;5})local R=p.new({3});(expect(E:ContainsAll(R))).to.equal(false)end)it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \097\108\108 \101\108\101\109\101\110\116\115 \117\110\116\105\108 \116\104\101\121 \097\114\101 \097\100\100\101\100",function()local E=p.new()local R=p.new({1,2});(expect(E:ContainsAll(R))).to.equal(false)E:Add(1);(expect(E:ContainsAll(R))).to.equal(false)E:Add(2);(expect(E:ContainsAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \110\111 \108\111\110\103\101\114 \102\105\110\100 \097\108\108 \101\108\101\109\101\110\116\115 \119\104\101\110 \116\104\101\121 \097\114\101 \114\101\109\111\118\101\100",function()local E=p.new({1,2,3,4,5})local R=p.new({1,2,3;4,5});(expect(E:ContainsAll(R))).to.equal(true)E:Remove(1);(expect(E:ContainsAll(R))).to.equal(false)end)end)describe("\067\111\110\116\097\105\110\115\065\110\121",function()it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \097\110\121 \101\108\101\109\101\110\116 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()local R=p.new({1,2;3;4,5});(expect(E:ContainsAny(R))).to.equal(false)end)it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \097\110\121 \101\108\101\109\101\110\116 \119\104\101\110 \116\104\101 \112\114\111\118\105\100\101\100 \067\111\108\108\101\099\116\105\111\110 \105\115 \101\109\112\116\121",function()local E=p.new({1,2,3,4;5})local R=p.new();(expect(E:ContainsAny(R))).to.equal(false)end)it("\115\104\111\117\108\100 \102\105\110\100 \097\108\108 \101\108\101\109\101\110\116\115 \119\104\101\110 \116\104\101 \101\108\101\109\101\110\116\115 \101\120\105\115\116",function()local E=p.new({1;2,3,4;5})local R=p.new({1;2;3;4;5});(expect(E:ContainsAny(R))).to.equal(true)end)it("\115\104\111\117\108\100 \102\105\110\100 \111\110\101 \101\108\101\109\101\110\116 \119\104\101\110 \105\116 \101\120\105\115\116\115",function()local E=p.new({1,2;3,4,5})local R=p.new({3});(expect(E:ContainsAny(R))).to.equal(true)end)it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \115\111\109\101 \101\108\101\109\101\110\116\115 \119\104\101\110 \111\110\108\121 \111\110\101 \100\111\101\115 \110\111\116 \101\120\105\115\116",function()local E=p.new({1;2,4,5})local R=p.new({1,2,3;4,5});(expect(E:ContainsAny(R))).to.equal(true)end)it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \111\110\101 \101\108\101\109\101\110\116 \119\104\101\110 \105\116 \100\111\101\115 \110\111\116 \101\120\105\115\116",function()local E=p.new({1,2,4;5})local R=p.new({3});(expect(E:ContainsAny(R))).to.equal(false)end)it("\115\104\111\117\108\100 \110\111\116 \102\105\110\100 \101\108\101\109\101\110\116\115 \117\110\116\105\108 \116\104\101\121 \097\114\101 \097\100\100\101\100",function()local E=p.new()local R=p.new({1;2});(expect(E:ContainsAny(R))).to.equal(false)E:Add(1);(expect(E:ContainsAny(R))).to.equal(true)end)it("\115\104\111\117\108\100 \110\111 \108\111\110\103\101\114 \102\105\110\100 \097\108\108 \101\108\101\109\101\110\116\115 \119\104\101\110 \116\104\101\121 \097\114\101 \097\108\108 \114\101\109\111\118\101\100",function()local E=p.new({1;2;3,4;5})local R=p.new({1;2,3;4,5});(expect(E:ContainsAny(R))).to.equal(true)E:Remove(1);(expect(E:ContainsAny(R))).to.equal(true)E:Clear();(expect(E:ContainsAny(R))).to.equal(false)end)end)describe("\067\111\117\110\116",function()it("\115\104\111\117\108\100 \099\111\117\110\116 \122\101\114\111 \119\104\101\110 \101\109\112\116\121",function()local E=p.new();(expect(E:Count())).to.equal(0)end)it("\115\104\111\117\108\100 \099\111\117\110\116 \116\104\101 \110\117\109\098\101\114 \111\102 \101\108\101\109\101\110\116\115 \105\110 \116\104\101 \076\105\110\107\101\100\068\101\113\117\101",function()local E=p.new({1;2;3,4;5});(expect(E:Count())).to.equal(5)end)it("\115\104\111\117\108\100 \099\111\117\110\116 \110\101\119 \101\108\101\109\101\110\116\115 \119\104\101\110 \116\104\101\121 \097\114\101 \097\100\100\101\100",function()local E=p.new()local R=10;(expect(E:Count())).to.equal(0)for p=1,R,1 do E:Add(p);(expect(E:Count())).to.equal(p)end;(expect(E:Count())).to.equal(R)end)it("\115\104\111\117\108\100 \110\111\116 \099\111\117\110\116 \101\108\101\109\101\110\116\115 \097\102\116\101\114 \116\104\101\121 \097\114\101 \114\101\109\111\118\101\100",function()local E=p.new({1;2;3;4;5})local R=E:Count();(expect(R)).to.equal(5)while R>0 do E:Shift()local p=R R=E:Count();(expect(R)).to.equal(p-1)end end)it("\115\104\111\117\108\100 \099\111\117\110\116 \122\101\114\111 \097\102\116\101\114 \098\101\105\110\103 \099\108\101\097\114\101\100",function()local E=p.new({1;2,3;4,5});(expect(E:Count())).to.equal(5)E:Clear();(expect(E:Count())).to.equal(0)end)end)describe("\069\109\112\116\121",function()it("\115\104\111\117\108\100 \098\101 \101\109\112\116\121 \119\104\101\110 \105\110\115\116\097\110\116\105\097\116\101\100",function()local E=p.new();(expect(E:Empty())).to.equal(true)end)it("\115\104\111\117\108\100 \110\111\116 \098\101 \101\109\112\116\121 \119\105\116\104 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1});(expect(E:Empty())).to.equal(false)end)it("\115\104\111\117\108\100 \110\111\116 \098\101 \101\109\112\116\121 \119\105\116\104 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115",function()local E=p.new({1,2;3,4;5});(expect(E:Empty())).to.equal(false)end)it("\115\104\111\117\108\100 \110\111 \108\111\110\103\101\114 \098\101 \101\109\112\116\121 \097\102\116\101\114 \097\110 \101\108\101\109\101\110\116 \105\115 \097\100\100\101\100",function()local E=p.new();(expect(E:Empty())).to.equal(true)E:Add(1);(expect(E:Empty())).to.equal(false)end)it("\115\104\111\117\108\100 \098\101 \101\109\112\116\121 \097\102\116\101\114 \097\108\108 \101\108\101\109\101\110\116\115 \097\114\101 \114\101\109\111\118\101\100",function()local E=p.new({1,2;3,4;5})while E:Count()>0 do(expect(E:Empty())).to.equal(false)E:Shift()end;(expect(E:Empty())).to.equal(true)end)it("\115\104\111\117\108\100 \098\101 \101\109\112\116\121 \097\102\116\101\114 \098\101\105\110\103 \099\108\101\097\114\101\100",function()local E=p.new({1,2,3,4;5});(expect(E:Empty())).to.equal(false)E:Clear();(expect(E:Empty())).to.equal(true)end)end)describe("\084\111\065\114\114\097\121",function()it("\115\104\111\117\108\100 \114\101\116\117\114\110 \097 \116\097\098\108\101",function()local E=p.new();(expect(E:ToArray())).to.be.a("\116\097\098\108\101")end)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \097 \116\097\098\108\101 \111\102 \116\104\101 \115\097\109\101 \115\105\122\101",function()local E=p.new({1;2,3,4,5});(expect(#E:ToArray())).to.equal(E:Count())end)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \097\110 \101\109\112\116\121 \116\097\098\108\101 \119\104\101\110 \101\109\112\116\121",function()local E=p.new();(expect(#E:ToArray())).to.equal(0)end)it("\115\104\111\117\108\100 \099\114\101\097\116\101 \097 \116\097\098\108\101 \119\105\116\104 \116\104\101 \115\097\109\101 \101\108\101\109\101\110\116\115 \097\110\100 \111\114\100\101\114 \111\102 \101\110\117\109\101\114\097\116\105\111\110",function()local E=p.new({1;2;3,4,5})local R=E:ToArray();(expect(#R)).to.equal(E:Count())for p,R in ipairs(R)do(expect(R)).to.equal(E:Shift())end end)it("\115\104\111\117\108\100 \112\114\111\118\105\100\101 \111\110\108\121 \097\114\114\097\121 \105\110\100\101\120\097\098\108\101 \101\108\101\109\101\110\116\115",function()local E=p.new({1,2;3;4;5})local R=E:ToArray()local g=0 for E in pairs(R)do g=g+1 end;(expect(g)).to.equal(#R)end)end)describe("\084\111\084\097\098\108\101",function()it("\115\104\111\117\108\100 \112\114\111\118\105\100\101 \116\104\101 \115\097\109\101 \114\101\112\114\101\115\101\110\116\097\116\105\111\110 \097\115 \084\111\065\114\114\097\121",function()local E=p.new({1;2;3,4,5})local R=E:ToArray()local g=E:ToTable();(expect(g)).to.be.a("\116\097\098\108\101");(expect(#g)).to.equal(#R)for E,p in pairs(g)do(expect(p)).to.equal(R[E])end end)end)end)describe("\079\112\116\105\111\110\097\108 \077\101\116\104\111\100\115",function()describe("\065\100\100",function()it("\115\104\111\117\108\100 \097\100\100 \101\108\101\109\101\110\116\115 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()E:Add(1);(expect(E:Count())).to.equal(1)end)it("\115\104\111\117\108\100 \097\100\100 \101\108\101\109\101\110\116\115 \119\104\101\110 \110\111\116 \101\109\112\116\121",function()local E=p.new({1,2,3,4,5})E:Add(6);(expect(E:Count())).to.equal(6)end)it("\115\104\111\117\108\100 \097\100\100 \101\108\101\109\101\110\116\115 \116\111 \116\104\101 \101\110\100",function()local E=p.new({1;2;3;4,5})E:Add(1)while E:Count()>1 do E:Shift()end;(expect(E:First())).to.equal(1)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101",function()local E=p.new();(expect(E:Add(1))).to.equal(true)end)it("\115\104\111\117\108\100 \097\100\100 \100\117\112\108\105\099\097\116\101 \101\108\101\109\101\110\116\115",function()local E=p.new({1;1;1;1;1})E:Add(1);(expect(E:Count())).to.equal(6)end)end)describe("\065\100\100\065\108\108",function()it("\115\104\111\117\108\100 \097\100\100 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()local R=p.new({1,2,3;4;5})E:AddAll(R);(expect(E:Count())).to.equal(5)end)it("\115\104\111\117\108\100 \097\100\100 \111\110\101 \101\108\101\109\101\110\116 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()local R=p.new({1})E:AddAll(R);(expect(E:Count())).to.equal(1)end)it("\115\104\111\117\108\100 \097\100\100 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115 \119\104\101\110 \110\111\116 \101\109\112\116\121",function()local E=p.new({1,2,3,4,5})local R=p.new({6,7,8;9,0})E:AddAll(R);(expect(E:Count())).to.equal(10)end)it("\115\104\111\117\108\100 \097\100\100 \111\110\101 \101\108\101\109\101\110\116 \119\104\101\110 \110\111\116 \101\109\112\116\121",function()local E=p.new({1,2;3,4;5})local R=p.new({6})E:AddAll(R);(expect(E:Count())).to.equal(6)end)it("\115\104\111\117\108\100 \097\100\100 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115 \116\111 \116\104\101 \101\110\100",function()local E=p.new({1,2;3,4;5})local R=p.new({6;7,8,9;10})E:AddAll(R)while E:Count()>R:Count()do E:Shift()end;(expect(E:Shift())).to.equal(6);(expect(E:Shift())).to.equal(7);(expect(E:Shift())).to.equal(8);(expect(E:Shift())).to.equal(9);(expect(E:Shift())).to.equal(10)end)it("\115\104\111\117\108\100 \097\100\100 \111\110\101 \101\108\101\109\101\110\116 \116\111 \116\104\101 \101\110\100",function()local E=p.new({1,2;3,4,5})local R=p.new({6})E:AddAll(R)while E:Count()>1 do E:Shift()end;(expect(E:First())).to.equal(6)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \097\100\100\105\110\103 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115",function()local E=p.new()local R=p.new({6;7;8;9;10});(expect(E:AddAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \097\100\100\105\110\103 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new()local R=p.new({6});(expect(E:AddAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \097\100\100 \109\117\108\116\105\112\108\101 \100\117\112\108\105\099\097\116\101 \101\108\101\109\101\110\116\115",function()local E=p.new({1;1,1,1;1})local R=p.new({1;1,1,1;1})E:AddAll(R);(expect(E:Count())).to.equal(10)end)it("\115\104\111\117\108\100 \097\100\100 \111\110\101 \100\117\112\108\105\099\097\116\101 \101\108\101\109\101\110\116",function()local E=p.new({1;1;1;1,1})local R=p.new({1})E:AddAll(R);(expect(E:Count())).to.equal(6)end)end)describe("\067\108\101\097\114",function()it("\115\104\111\117\108\100 \099\108\101\097\114 \097\108\108 \101\108\101\109\101\110\116\115",function()local E=p.new({1,2,3;4;5});(expect(E:Empty())).to.equal(false)E:Clear();(expect(E:Empty())).to.equal(true)end)it("\115\104\111\117\108\100 \099\108\101\097\114 \119\104\101\110 \097\108\114\101\097\100\121 \101\109\112\116\121",function()local E=p.new()E:Clear();(expect(E:Empty())).to.equal(true)end)it("\115\104\111\117\108\100 \099\108\101\097\114 \119\105\116\104 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1})E:Clear();(expect(E:Empty())).to.equal(true)end)it("\115\104\111\117\108\100 \099\108\101\097\114 \119\105\116\104 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115",function()local E=p.new({1,2,3,4;5})E:Clear();(expect(E:Empty())).to.equal(true)end)it("\115\104\111\117\108\100 \099\108\101\097\114 \119\105\116\104 \100\117\112\108\105\099\097\116\101 \101\108\101\109\101\110\116\115",function()local E=p.new({1,1,1,1;1})E:Clear();(expect(E:Empty())).to.equal(true)end)end)describe("\082\101\109\111\118\101",function()it("\115\104\111\117\108\100 \115\117\099\099\101\115\115\102\117\108\108\121 \097\116\116\101\109\112\116 \116\111 \114\101\109\111\118\101 \119\104\101\110 \101\109\112\116\121",function()local E=p.new();(expect(function()E:Remove(1)end)).never.to.throw()end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \102\097\108\115\101 \119\104\101\110 \097\116\116\101\109\112\116\105\110\103 \116\111 \114\101\109\111\118\101 \119\104\101\110 \101\109\112\116\121",function()local E=p.new();(expect(E:Remove(1))).to.equal(false)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1})E:Remove(1);(expect(E:Count())).to.equal(0)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\109\111\118\105\110\103 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1});(expect(E:Remove(1))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \097\110 \101\108\101\109\101\110\116 \102\114\111\109 \109\097\110\121",function()local E=p.new({1;2,3;4;5})E:Remove(3);(expect(E:Count())).to.equal(4)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\109\111\118\105\110\103 \097\110 \101\108\101\109\101\110\116 \102\114\111\109 \109\097\110\121",function()local E=p.new({1,2,3;4;5});(expect(E:Remove(3))).to.equal(true)end)it("\115\104\111\117\108\100 \110\111\116 \114\101\109\111\118\101 \119\104\101\110 \116\104\101 \101\108\101\109\101\110\116 \100\111\101\115 \110\111\116 \101\120\105\115\116",function()local E=p.new({1,2,3,4;5})E:Remove(6);(expect(E:Count())).to.equal(5)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \102\097\108\115\101 \119\104\101\110 \097\110 \101\108\101\109\101\110\116 \105\115\110\'\116 \114\101\109\111\118\101\100",function()local E=p.new({1;2;3,4;5});(expect(E:Remove(6))).to.equal(false)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \111\110\101 \101\108\101\109\101\110\116 \119\104\101\110 \116\104\101\114\101 \097\114\101 \100\117\112\108\105\099\097\116\101\115",function()local E=p.new({1;1,1;1,1})E:Remove(1);(expect(E:Count())).to.equal(4)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\109\111\118\105\110\103 \097 \100\117\112\108\105\099\097\116\101",function()local E=p.new({1;1,1;1;1});(expect(E:Remove(1))).to.equal(true)end)end)describe("\082\101\109\111\118\101\065\108\108",function()it("\115\104\111\117\108\100 \115\117\099\099\101\115\115\102\117\108\108\121 \097\116\116\101\109\112\116 \116\111 \114\101\109\111\118\101 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()local R=p.new({1;2;3,4,5});(expect(function()E:RemoveAll(R)end)).never.to.throw()end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \102\097\108\115\101 \119\104\101\110 \097\116\116\101\109\112\116\105\110\103 \116\111 \114\101\109\111\118\101 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()local R=p.new({1,2;3;4,5});(expect(E:RemoveAll(R))).to.equal(false)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1})local R=p.new({1})E:RemoveAll(R);(expect(E:Count())).to.equal(0)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\109\111\118\105\110\103 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1})local R=p.new({1});(expect(E:RemoveAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \119\105\116\104 \101\120\099\101\115\115 \101\108\101\109\101\110\116\115",function()local E=p.new({1})local R=p.new({1,2,3;4;5})E:RemoveAll(R);(expect(E:Count())).to.equal(0)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\109\111\118\105\110\103 \119\105\116\104 \101\120\099\101\115\115 \101\108\101\109\101\110\116\115",function()local E=p.new({1})local R=p.new({1,2;3,4;5});(expect(E:RemoveAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \111\110\101 \101\108\101\109\101\110\116 \102\114\111\109 \109\097\110\121",function()local E=p.new({1,2;3;4,5})local R=p.new({1})E:RemoveAll(R);(expect(E:Count())).to.equal(4)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\109\111\118\105\110\103 \111\110\101 \101\108\101\109\101\110\116 \102\114\111\109 \109\097\110\121",function()local E=p.new({1;2;3;4;5})local R=p.new({1});(expect(E:RemoveAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \110\111\116 \114\101\109\111\118\101 \119\104\101\110 \116\104\101 \101\108\101\109\101\110\116 \100\111\101\115 \110\111\116 \101\120\105\115\116",function()local E=p.new({1,2,3;4,5})local R=p.new({0})E:RemoveAll(R);(expect(E:Count())).to.equal(5)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \102\097\108\115\101 \119\104\101\110 \097\110 \101\108\101\109\101\110\116 \105\115\110\'\116 \114\101\109\111\118\101\100",function()local E=p.new({1,2,3,4,5})local R=p.new({0});(expect(E:RemoveAll(R))).to.equal(false)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115",function()local E=p.new({1,2,3,4,5})local R=p.new({1;2,3,4;5})E:RemoveAll(R);(expect(E:Count())).to.equal(0)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\109\111\118\105\110\103 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115",function()local E=p.new({1;2;3;4,5})local R=p.new({1;2;3,4,5});(expect(E:RemoveAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \111\110\108\121 \111\110\099\101 \102\111\114 \101\097\099\104 \111\099\099\117\114\114\101\110\099\101 \111\102 \100\117\112\108\105\099\097\116\101\115",function()local E=p.new({1;1;1;1;1})local R=p.new({1,1,1})E:RemoveAll(R);(expect(E:Count())).to.equal(2)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\109\111\118\105\110\103 \100\117\112\108\105\099\097\116\101\115",function()local E=p.new({1;1;1;1;1})local R=p.new({1,1,1});(expect(E:RemoveAll(R))).to.equal(true)end)end)describe("\082\101\116\097\105\110\065\108\108",function()it("\115\104\111\117\108\100 \115\117\099\099\101\115\115\102\117\108\108\121 \097\116\116\101\109\112\116 \116\111 \114\101\116\097\105\110 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()local R=p.new({1,2,3;4;5});(expect(function()E:RetainAll(R)end)).never.to.throw()end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \102\097\108\115\101 \119\104\101\110 \114\101\116\097\105\110\105\110\103 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()local R=p.new({1,2;3;4,5});(expect(E:RetainAll(R))).to.equal(false)end)it("\115\104\111\117\108\100 \114\101\116\097\105\110 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1})local R=p.new({1})E:RetainAll(R);(expect(E:Count())).to.equal(1)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \102\097\108\115\101 \119\104\101\110 \114\101\116\097\105\110\105\110\103 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1})local R=p.new({1});(expect(E:RetainAll(R))).to.equal(false)end)it("\115\104\111\117\108\100 \114\101\116\097\105\110 \119\105\116\104 \101\120\099\101\115\115 \101\108\101\109\101\110\116\115 \116\111 \114\101\116\097\105\110",function()local E=p.new({1})local R=p.new({1,2;3,4;5})E:RetainAll(R);(expect(E:Count())).to.equal(1)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \102\097\108\115\101 \119\104\101\110 \114\101\116\097\105\110\105\110\103 \119\105\116\104 \101\120\099\101\115\115 \101\108\101\109\101\110\116\115 \116\111 \114\101\116\097\105\110",function()local E=p.new({1})local R=p.new({1,2;3,4;5});(expect(E:RetainAll(R))).to.equal(false)end)it("\115\104\111\117\108\100 \110\111\116 \114\101\116\097\105\110 \111\110\101 \101\108\101\109\101\110\116 \116\104\097\116 \100\111\101\115 \110\111\116 \109\097\116\099\104",function()local E=p.new({1})local R=p.new({0})E:RetainAll(R);(expect(E:Count())).to.equal(0)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \110\111\116 \114\101\116\097\105\110\105\110\103 \111\110\101 \101\108\101\109\101\110\116 \116\104\097\116 \100\111\101\115 \110\111\116 \109\097\116\099\104",function()local E=p.new({1})local R=p.new({0});(expect(E:RetainAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\116\097\105\110 \111\110\101 \101\108\101\109\101\110\116 \102\114\111\109 \109\097\110\121",function()local E=p.new({1;2;3;4,5})local R=p.new({3})E:RetainAll(R);(expect(E:Count())).to.equal(1)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\116\097\105\110\105\110\103 \111\110\101 \101\108\101\109\101\110\116 \102\114\111\109 \109\097\110\121",function()local E=p.new({1,2,3,4;5})local R=p.new({3});(expect(E:RetainAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\116\097\105\110 \110\111 \101\108\101\109\101\110\116\115 \119\104\101\110 \111\110\101 \101\108\101\109\101\110\116 \100\111\101\115 \110\111\116 \109\097\116\099\104",function()local E=p.new({1;2;3,4,5})local R=p.new({6})E:RetainAll(R);(expect(E:Count())).to.equal(0)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \110\111\116 \114\101\116\097\105\110\105\110\103 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1;2;3,4;5})local R=p.new({6});(expect(E:RetainAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\116\097\105\110 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115 \119\104\101\110 \109\111\114\101 \101\120\105\115\116",function()local E=p.new({1,2;3,4,5})local R=p.new({1,3;5})E:RetainAll(R);(expect(E:Count())).to.equal(3)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\116\097\105\110\105\110\103 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115 \119\104\101\110 \109\111\114\101 \101\120\105\115\116",function()local E=p.new({1;2;3;4,5})local R=p.new({1,3;5});(expect(E:RetainAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\116\097\105\110 \109\117\108\116\105\112\108\101 \101\108\101\109\101\110\116\115 \119\104\101\110 \097\116\116\101\109\112\116\105\110\103 \116\111 \114\101\116\097\105\110 \101\120\099\101\115\115 \101\108\101\109\101\110\116\115",function()local E=p.new({1;2,3;4;5})local R=p.new({0;1,3})E:RetainAll(R);(expect(E:Count())).to.equal(2)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \097\116\116\101\109\112\105\110\103 \116\111 \114\101\116\097\105\110 \119\105\116\104 \101\120\099\101\115\115 \101\108\101\109\101\110\116\115",function()local E=p.new({1;2,3;4,5})local R=p.new({0,1;3});(expect(E:RetainAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\116\097\105\110 \097\108\108 \101\108\101\109\101\110\116\115",function()local E=p.new({1,2,3,4;5})local R=p.new({1,2;3,4;5})E:RetainAll(R);(expect(E:Count())).to.equal(5)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \102\097\108\115\101 \119\104\101\110 \114\101\116\097\105\110\105\110\103 \097\108\108 \101\108\101\109\101\110\116\115",function()local E=p.new({1,2;3;4,5})local R=p.new({1,2,3;4,5});(expect(E:RetainAll(R))).to.equal(false)end)it("\115\104\111\117\108\100 \114\101\116\097\105\110 \097\108\108 \101\108\101\109\101\110\116\115 \119\104\101\110 \097\116\116\101\109\112\116\105\110\103 \116\111 \114\101\116\097\105\110 \101\120\099\101\115\115",function()local E=p.new({1,2,3,4,5})local R=p.new({0,1,2;3,4,5})E:RetainAll(R);(expect(E:Count())).to.equal(5)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \102\097\108\115\101 \119\104\101\110 \097\116\116\101\109\112\116\105\110\103 \116\111 \114\101\116\097\105\110 \101\120\099\101\101\115\115 \097\110\100 \114\101\116\097\105\110\105\110\103 \097\108\108 \101\108\101\109\101\110\116\115",function()local E=p.new({1,2,3;4;5})local R=p.new({0,1;2;3;4,5});(expect(E:RetainAll(R))).to.equal(false)end)it("\115\104\111\117\108\100 \114\101\116\097\105\110 \097\108\108 \100\117\112\108\105\099\097\116\101\115",function()local E=p.new({1,1;2;2;3})local R=p.new({1;2})E:RetainAll(R);(expect(E:Count())).to.equal(4)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101 \119\104\101\110 \114\101\116\097\105\110\105\110\103 \100\117\112\108\105\099\097\116\101\115 \097\110\100 \109\111\114\101 \101\120\105\115\116",function()local E=p.new({1,1,2,2;3})local R=p.new({1;2});(expect(E:RetainAll(R))).to.equal(true)end)it("\115\104\111\117\108\100 \114\101\116\097\105\110 \097\108\108 \100\117\112\108\105\099\097\116\101\115 \119\104\101\110 \097\116\116\101\109\112\105\110\103 \116\111 \114\101\116\097\105\110 \101\120\099\101\115\115",function()local E=p.new({1;1;1;1,1})local R=p.new({1;2})E:RetainAll(R);(expect(E:Count())).to.equal(5)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \102\097\108\115\101 \119\104\101\110 \114\101\116\097\105\110\105\110\103 \097\108\108 \100\117\112\108\105\099\097\116\101\115",function()local E=p.new({1,1,1,1,1})local R=p.new({1});(expect(E:RetainAll(R))).to.equal(false)end)end)end)end)describe("\081\117\101\117\101 \073\110\116\101\114\102\097\099\101",function()describe("\070\105\114\115\116",function()it("\115\104\111\117\108\100 \101\114\114\111\114 \119\104\101\110 \101\109\112\116\121",function()local E=p.new();(expect(function()E:First()end)).to.throw("\078\111 \102\105\114\115\116 \101\108\101\109\101\110\116 \101\120\105\115\116\115\046")end)it("\115\104\111\117\108\100 \103\101\116 \116\104\101 \102\105\114\115\116 \101\108\101\109\101\110\116 \119\105\116\104 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1});(expect(E:First())).to.equal(1)end)it("\115\104\111\117\108\100 \103\101\116 \116\104\101 \102\105\114\115\116 \101\108\101\109\101\110\116 \119\105\116\104 \109\097\110\121 \101\108\101\109\101\110\116\115",function()local E=p.new({1,2;3;4;5});(expect(E:First())).to.equal(1)end)it("\115\104\111\117\108\100 \103\101\116 \116\104\101 \102\105\114\115\116 \101\108\101\109\101\110\116 \119\104\101\110 \101\108\101\109\101\110\116\115 \097\114\101 \114\101\109\111\118\101\100",function()local E=p.new({1,2,3;4,5})E:Shift();(expect(E:First())).to.equal(2)end)it("\115\104\111\117\108\100 \101\114\114\111\114 \119\104\101\110 \097\108\108 \101\108\101\109\101\110\116\115 \104\097\118\101 \098\101\101\110 \114\101\109\111\118\101\100",function()local E=p.new({1,2,3;4;5})while E:Count()>0 do E:Shift()end;(expect(function()E:First()end)).to.throw("\078\111 \102\105\114\115\116 \101\108\101\109\101\110\116 \101\120\105\115\116\115\046")end)end)describe("\080\117\115\104",function()it("\115\104\111\117\108\100 \097\100\100 \097\110 \105\116\101\109 \116\111 \116\104\101 \101\110\100 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()E:Push(1);(expect(E:First())).to.equal(1);(expect(E:Count())).to.equal(1)end)it("\115\104\111\117\108\100 \097\100\100 \097\110 \105\116\101\109 \116\111 \116\104\101 \101\110\100 \119\105\116\104 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1})E:Push(2);(expect(E:Count())).to.equal(2)E:Shift();(expect(E:First())).to.equal(2)end)it("\115\104\111\117\108\100 \097\100\100 \097\110 \105\116\101\109 \116\111 \116\104\101 \101\110\100 \119\105\116\104 \109\097\110\121 \101\108\101\109\101\110\116\115",function()local E=p.new({1;2,3,4,5})E:Push(6);(expect(E:Count())).to.equal(6)while E:Count()>1 do E:Shift()end;(expect(E:First())).to.equal(6)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101",function()local E=p.new({1,2,3;4,5});(expect(E:Push(6))).to.equal(true)end)end)describe("\083\104\105\102\116",function()it("\115\104\111\117\108\100 \101\114\114\111\114 \119\104\101\110 \101\109\112\116\121",function()local E=p.new();(expect(function()E:Shift()end)).to.throw("\078\111 \102\105\114\115\116 \101\108\101\109\101\110\116 \101\120\105\115\116\115\046")end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \097\110 \105\116\101\109 \102\114\111\109 \116\104\101 \098\101\103\105\110\110\105\110\103 \119\105\116\104 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1})E:Shift();(expect(E:Count())).to.equal(0)end)it("\115\104\111\117\108\100 \103\101\116 \116\104\101 \101\108\101\109\101\110\116 \119\104\101\110 \114\101\109\111\118\105\110\103 \119\105\116\104 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1});(expect(E:Shift())).to.equal(1)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \097\110 \105\116\101\109 \102\114\111\109 \116\104\101 \098\101\103\105\110\110\105\110\103 \119\105\116\104 \109\097\110\121 \101\108\101\109\101\110\116\115",function()local E=p.new({1;2,3;4,5})E:Shift();(expect(E:First())).to.equal(2);(expect(E:Count())).to.equal(4)end)it("\115\104\111\117\108\100 \103\101\116 \116\104\101 \101\108\101\109\101\110\116 \119\104\101\110 \114\101\109\111\118\105\110\103 \119\105\116\104 \109\097\110\121 \101\108\101\109\101\110\116\115",function()local E=p.new({1;2;3,4;5});(expect(E:Shift())).to.equal(1)end)end)end)describe("\068\101\113\117\101 \073\110\116\101\114\102\097\099\101",function()describe("\076\097\115\116",function()it("\115\104\111\117\108\100 \101\114\114\111\114 \119\104\101\110 \101\109\112\116\121",function()local E=p.new();(expect(function()E:Last()end)).to.throw("\078\111 \108\097\115\116 \101\108\101\109\101\110\116 \101\120\105\115\116\115\046")end)it("\115\104\111\117\108\100 \103\101\116 \116\104\101 \108\097\115\116 \101\108\101\109\101\110\116 \119\105\116\104 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1});(expect(E:Last())).to.equal(1)end)it("\115\104\111\117\108\100 \103\101\116 \116\104\101 \108\097\115\116 \101\108\101\109\101\110\116 \119\105\116\104 \109\097\110\121 \101\108\101\109\101\110\116\115",function()local E=p.new({1,2;3,4,5});(expect(E:Last())).to.equal(5)end)it("\115\104\111\117\108\100 \103\101\116 \116\104\101 \108\097\115\116 \101\108\101\109\101\110\116 \119\104\101\110 \101\108\101\109\101\110\116\115 \097\114\101 \114\101\109\111\118\101\100",function()local E=p.new({1;2;3;4,5})E:Pop();(expect(E:Last())).to.equal(4)end)it("\115\104\111\117\108\100 \101\114\114\111\114 \119\104\101\110 \097\108\108 \101\108\101\109\101\110\116\115 \104\097\118\101 \098\101\101\110 \114\101\109\111\118\101\100",function()local E=p.new({1,2;3;4,5})while E:Count()>0 do E:Pop()end;(expect(function()E:Last()end)).to.throw("\078\111 \108\097\115\116 \101\108\101\109\101\110\116 \101\120\105\115\116\115\046")end)end)describe("\085\110\115\104\105\102\116",function()it("\115\104\111\117\108\100 \097\100\100 \097\110 \105\116\101\109 \116\111 \116\104\101 \098\101\103\105\110\110\105\110\103 \119\104\101\110 \101\109\112\116\121",function()local E=p.new()E:Unshift(1);(expect(E:First())).to.equal(1);(expect(E:Count())).to.equal(1)end)it("\115\104\111\117\108\100 \097\100\100 \097\110 \105\116\101\109 \116\111 \116\104\101 \098\101\103\105\110\110\105\110\103 \119\105\116\104 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1})E:Unshift(2);(expect(E:Count())).to.equal(2);(expect(E:First())).to.equal(2)end)it("\115\104\111\117\108\100 \097\100\100 \097\110 \105\116\101\109 \116\111 \116\104\101 \098\101\103\105\110\110\105\110\103 \119\105\116\104 \109\097\110\121 \101\108\101\109\101\110\116\115",function()local E=p.new({1;2,3;4,5})E:Unshift(6);(expect(E:Count())).to.equal(6);(expect(E:First())).to.equal(6)end)it("\115\104\111\117\108\100 \114\101\116\117\114\110 \116\114\117\101",function()local E=p.new({1,2,3,4,5});(expect(E:Push(6))).to.equal(true)end)end)describe("\080\111\112",function()it("\115\104\111\117\108\100 \101\114\114\111\114 \119\104\101\110 \101\109\112\116\121",function()local E=p.new();(expect(function()E:Pop()end)).to.throw("\078\111 \108\097\115\116 \101\108\101\109\101\110\116 \101\120\105\115\116\115\046")end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \097\110 \105\116\101\109 \102\114\111\109 \116\104\101 \101\110\100 \119\105\116\104 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1})E:Pop();(expect(E:Count())).to.equal(0)end)it("\115\104\111\117\108\100 \103\101\116 \116\104\101 \101\108\101\109\101\110\116 \119\104\101\110 \114\101\109\111\118\105\110\103 \119\105\116\104 \111\110\101 \101\108\101\109\101\110\116",function()local E=p.new({1});(expect(E:Pop())).to.equal(1)end)it("\115\104\111\117\108\100 \114\101\109\111\118\101 \097\110 \105\116\101\109 \102\114\111\109 \116\104\101 \101\110\100 \119\105\116\104 \109\097\110\121 \101\108\101\109\101\110\116\115",function()local E=p.new({1;2;3;4;5})E:Pop();(expect(E:Last())).to.equal(4);(expect(E:Count())).to.equal(4)end)it("\115\104\111\117\108\100 \103\101\116 \116\104\101 \101\108\101\109\101\110\116 \119\104\101\110 \114\101\109\111\118\105\110\103 \119\105\116\104 \109\097\110\121 \101\108\101\109\101\110\116\115",function()local E=p.new({1;2,3,4,5});(expect(E:Pop())).to.equal(5)end)end)end)end
--- Tests for the @{LinkedDeque} class.

return function()
	local module = game:GetService("ReplicatedStorage").Packages.Monolith
	local LinkedDeque = require(module.LinkedDeque)

	describe("Constructor", function()
		it("should create an empty LinkedDeque", function()
			local deque = LinkedDeque.new()
			expect(deque:Empty()).to.equal(true)
		end)

		it("should create a LinkedDeque from a table", function()
			local items = { 1, 2, 3, 4, 5 }
			local deque = LinkedDeque.new(items)
			expect(deque:Count()).to.equal(#items)
			local index = 1
			while deque:Count() > 0 do
				local item = deque:Shift()
				expect(item).to.equal(items[index])
				index = index + 1
			end
		end)

		it("should create a LinkedDeque from a Collection", function()
			local items = LinkedDeque.new({ 1, 2, 3, 4, 5 })
			local deque = LinkedDeque.new(items)
			expect(deque:Count()).to.equal(items:Count())
			while deque:Count() > 0 do
				local item = deque:Shift()
				local original = items:Shift()
				expect(item).to.equal(original)
			end
		end)

		it("should error when attempting to create a LinkedDeque from a non-table", function()
			expect(function()
				LinkedDeque.new(true)
			end).to.throw("Cannot construct LinkedDeque from type boolean.")
			expect(function()
				LinkedDeque.new(1)
			end).to.throw("Cannot construct LinkedDeque from type number.")
			expect(function()
				LinkedDeque.new("string")
			end).to.throw("Cannot construct LinkedDeque from type string.")
			expect(function()
				LinkedDeque.new(function() end)
			end).to.throw("Cannot construct LinkedDeque from type function.")
			expect(function()
				LinkedDeque.new(Instance.new("Folder"))
			end).to.throw("Cannot construct LinkedDeque from type userdata.")
			expect(function()
				LinkedDeque.new(coroutine.create(function() end))
			end).to.throw("Cannot construct LinkedDeque from type thread.")
		end)
	end)

	describe("Enumerable Interface", function()
		describe("Enumerator", function()
			it("should provide an iterator generator", function()
				local deque = LinkedDeque.new()
				local generator = deque:Enumerator()
				expect(generator).to.be.a("function")
			end)

			it("should enumerate in a generic for loop", function()
				local deque = LinkedDeque.new()
				local total = 10
				for i = 1, total do
					deque:Add(i)
				end

				local count = 0
				for i, v in deque:Enumerator() do
					count = count + 1
					expect(i).to.be.a("number")
					expect(v).to.be.a("number")
				end

				expect(count).to.equal(total)
			end)
		end)
	end)

	describe("Collection Interface", function()
		describe("Required Methods", function()
			describe("Contains", function()
				it("should not find any element when empty", function()
					local deque = LinkedDeque.new()
					expect(deque:Contains(0)).to.equal(false)
				end)

				it("should find an element when that element exists", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Contains(1)).to.equal(true)
				end)

				it("should not find an element when that element does not exist", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Contains(0)).to.equal(false)
				end)

				it("should not find an element until it is added", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Contains(0)).to.equal(false)
					deque:Add(0)
					expect(deque:Contains(0)).to.equal(true)
				end)

				it("should no longer find an element when its removed", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Contains(1)).to.equal(true)
					deque:Remove(1)
					expect(deque:Contains(1)).to.equal(false)
				end)
			end)

			describe("ContainsAll", function()
				it("should not find any element when empty", function()
					local deque = LinkedDeque.new()
					local contained = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:ContainsAll(contained)).to.equal(false)
				end)

				it("should find all zero elements when the provided Collection is empty", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local contained = LinkedDeque.new()
					expect(deque:ContainsAll(contained)).to.equal(true)
				end)

				it("should find all elements when all of the elements exist", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local contained = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:ContainsAll(contained)).to.equal(true)
				end)

				it("should find one element when it exists", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local contained = LinkedDeque.new({ 3 })
					expect(deque:ContainsAll(contained)).to.equal(true)
				end)

				it("should not find all elements when one does not exist", function()
					local deque = LinkedDeque.new({ 1, 2, 4, 5 })
					local contained = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:ContainsAll(contained)).to.equal(false)
				end)

				it("should not find one element when it does not exist", function()
					local deque = LinkedDeque.new({ 1, 2, 4, 5 })
					local contained = LinkedDeque.new({ 3 })
					expect(deque:ContainsAll(contained)).to.equal(false)
				end)

				it("should not find all elements until they are added", function()
					local deque = LinkedDeque.new()
					local contained = LinkedDeque.new({ 1, 2 })
					expect(deque:ContainsAll(contained)).to.equal(false)
					deque:Add(1)
					expect(deque:ContainsAll(contained)).to.equal(false)
					deque:Add(2)
					expect(deque:ContainsAll(contained)).to.equal(true)
				end)

				it("should no longer find all elements when they are removed", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local contained = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:ContainsAll(contained)).to.equal(true)
					deque:Remove(1)
					expect(deque:ContainsAll(contained)).to.equal(false)
				end)
			end)

			describe("ContainsAny", function()
				it("should not find any element when empty", function()
					local deque = LinkedDeque.new()
					local contained = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:ContainsAny(contained)).to.equal(false)
				end)

				it("should not find any element when the provided Collection is empty", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local contained = LinkedDeque.new()
					expect(deque:ContainsAny(contained)).to.equal(false)
				end)

				it("should find all elements when the elements exist", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local contained = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:ContainsAny(contained)).to.equal(true)
				end)

				it("should find one element when it exists", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local contained = LinkedDeque.new({ 3 })
					expect(deque:ContainsAny(contained)).to.equal(true)
				end)

				it("should not find some elements when only one does not exist", function()
					local deque = LinkedDeque.new({ 1, 2, 4, 5 })
					local contained = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:ContainsAny(contained)).to.equal(true)
				end)

				it("should not find one element when it does not exist", function()
					local deque = LinkedDeque.new({ 1, 2, 4, 5 })
					local contained = LinkedDeque.new({ 3 })
					expect(deque:ContainsAny(contained)).to.equal(false)
				end)

				it("should not find elements until they are added", function()
					local deque = LinkedDeque.new()
					local contained = LinkedDeque.new({ 1, 2 })
					expect(deque:ContainsAny(contained)).to.equal(false)
					deque:Add(1)
					expect(deque:ContainsAny(contained)).to.equal(true)
				end)

				it("should no longer find all elements when they are all removed", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local contained = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:ContainsAny(contained)).to.equal(true)
					deque:Remove(1)
					expect(deque:ContainsAny(contained)).to.equal(true)
					deque:Clear()
					expect(deque:ContainsAny(contained)).to.equal(false)
				end)
			end)

			describe("Count", function()
				it("should count zero when empty", function()
					local deque = LinkedDeque.new()
					expect(deque:Count()).to.equal(0)
				end)

				it("should count the number of elements in the LinkedDeque", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Count()).to.equal(5)
				end)

				it("should count new elements when they are added", function()
					local deque = LinkedDeque.new()
					local total = 10
					expect(deque:Count()).to.equal(0)
					for i = 1, total do
						deque:Add(i)
						expect(deque:Count()).to.equal(i)
					end
					expect(deque:Count()).to.equal(total)
				end)

				it("should not count elements after they are removed", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local count = deque:Count()
					expect(count).to.equal(5)
					while count > 0 do
						deque:Shift()
						local oldCount = count
						count = deque:Count()
						expect(count).to.equal(oldCount - 1)
					end
				end)

				it("should count zero after being cleared", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Count()).to.equal(5)
					deque:Clear()
					expect(deque:Count()).to.equal(0)
				end)
			end)

			describe("Empty", function()
				it("should be empty when instantiated", function()
					local deque = LinkedDeque.new()
					expect(deque:Empty()).to.equal(true)
				end)

				it("should not be empty with one element", function()
					local deque = LinkedDeque.new({ 1 })
					expect(deque:Empty()).to.equal(false)
				end)

				it("should not be empty with multiple elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Empty()).to.equal(false)
				end)

				it("should no longer be empty after an element is added", function()
					local deque = LinkedDeque.new()
					expect(deque:Empty()).to.equal(true)
					deque:Add(1)
					expect(deque:Empty()).to.equal(false)
				end)

				it("should be empty after all elements are removed", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					while deque:Count() > 0 do
						expect(deque:Empty()).to.equal(false)
						deque:Shift()
					end
					expect(deque:Empty()).to.equal(true)
				end)

				it("should be empty after being cleared", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Empty()).to.equal(false)
					deque:Clear()
					expect(deque:Empty()).to.equal(true)
				end)
			end)

			describe("ToArray", function()
				it("should return a table", function()
					local deque = LinkedDeque.new()
					expect(deque:ToArray()).to.be.a("table")
				end)

				it("should create a table of the same size", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(#deque:ToArray()).to.equal(deque:Count())
				end)

				it("should create an empty table when empty", function()
					local deque = LinkedDeque.new()
					expect(#deque:ToArray()).to.equal(0)
				end)

				it("should create a table with the same elements and order of enumeration", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local array = deque:ToArray()
					expect(#array).to.equal(deque:Count())
					for _, v in ipairs(array) do
						expect(v).to.equal(deque:Shift())
					end
				end)

				it("should provide only array indexable elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local array = deque:ToArray()
					local count = 0
					for _ in pairs(array) do
						count = count + 1
					end
					expect(count).to.equal(#array)
				end)
			end)

			describe("ToTable", function()
				it("should provide the same representation as ToArray", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local array = deque:ToArray()
					local table = deque:ToTable()
					expect(table).to.be.a("table")
					expect(#table).to.equal(#array)
					for i, v in pairs(table) do
						expect(v).to.equal(array[i])
					end
				end)
			end)
		end)

		describe("Optional Methods", function()
			describe("Add", function()
				it("should add elements when empty", function()
					local deque = LinkedDeque.new()
					deque:Add(1)
					expect(deque:Count()).to.equal(1)
				end)

				it("should add elements when not empty", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					deque:Add(6)
					expect(deque:Count()).to.equal(6)
				end)

				it("should add elements to the end", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					deque:Add(1)
					while deque:Count() > 1 do
						deque:Shift()
					end
					expect(deque:First()).to.equal(1)
				end)

				it("should return true", function()
					local deque = LinkedDeque.new()
					expect(deque:Add(1)).to.equal(true)
				end)

				it("should add duplicate elements", function()
					local deque = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					deque:Add(1)
					expect(deque:Count()).to.equal(6)
				end)
			end)

			describe("AddAll", function()
				it("should add multiple elements when empty", function()
					local deque = LinkedDeque.new()
					local add = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					deque:AddAll(add)
					expect(deque:Count()).to.equal(5)
				end)

				it("should add one element when empty", function()
					local deque = LinkedDeque.new()
					local add = LinkedDeque.new({ 1 })
					deque:AddAll(add)
					expect(deque:Count()).to.equal(1)
				end)

				it("should add multiple elements when not empty", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local add = LinkedDeque.new({ 6, 7, 8, 9, 0 })
					deque:AddAll(add)
					expect(deque:Count()).to.equal(10)
				end)

				it("should add one element when not empty", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local add = LinkedDeque.new({ 6 })
					deque:AddAll(add)
					expect(deque:Count()).to.equal(6)
				end)

				it("should add multiple elements to the end", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local add = LinkedDeque.new({ 6, 7, 8, 9, 10 })
					deque:AddAll(add)
					while deque:Count() > add:Count() do
						deque:Shift()
					end
					expect(deque:Shift()).to.equal(6)
					expect(deque:Shift()).to.equal(7)
					expect(deque:Shift()).to.equal(8)
					expect(deque:Shift()).to.equal(9)
					expect(deque:Shift()).to.equal(10)
				end)

				it("should add one element to the end", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local add = LinkedDeque.new({ 6 })
					deque:AddAll(add)
					while deque:Count() > 1 do
						deque:Shift()
					end
					expect(deque:First()).to.equal(6)
				end)

				it("should return true when adding multiple elements", function()
					local deque = LinkedDeque.new()
					local add = LinkedDeque.new({ 6, 7, 8, 9, 10 })
					expect(deque:AddAll(add)).to.equal(true)
				end)

				it("should return true when adding one element", function()
					local deque = LinkedDeque.new()
					local add = LinkedDeque.new({ 6 })
					expect(deque:AddAll(add)).to.equal(true)
				end)

				it("should add multiple duplicate elements", function()
					local deque = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					local add = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					deque:AddAll(add)
					expect(deque:Count()).to.equal(10)
				end)

				it("should add one duplicate element", function()
					local deque = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					local add = LinkedDeque.new({ 1 })
					deque:AddAll(add)
					expect(deque:Count()).to.equal(6)
				end)
			end)

			describe("Clear", function()
				it("should clear all elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Empty()).to.equal(false)
					deque:Clear()
					expect(deque:Empty()).to.equal(true)
				end)

				it("should clear when already empty", function()
					local deque = LinkedDeque.new()
					deque:Clear()
					expect(deque:Empty()).to.equal(true)
				end)

				it("should clear with one element", function()
					local deque = LinkedDeque.new({ 1 })
					deque:Clear()
					expect(deque:Empty()).to.equal(true)
				end)

				it("should clear with multiple elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					deque:Clear()
					expect(deque:Empty()).to.equal(true)
				end)

				it("should clear with duplicate elements", function()
					local deque = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					deque:Clear()
					expect(deque:Empty()).to.equal(true)
				end)
			end)

			describe("Remove", function()
				it("should successfully attempt to remove when empty", function()
					local deque = LinkedDeque.new()
					expect(function()
						deque:Remove(1)
					end).never.to.throw()
				end)

				it("should return false when attempting to remove when empty", function()
					local deque = LinkedDeque.new()
					expect(deque:Remove(1)).to.equal(false)
				end)

				it("should remove one element", function()
					local deque = LinkedDeque.new({ 1 })
					deque:Remove(1)
					expect(deque:Count()).to.equal(0)
				end)

				it("should return true when removing one element", function()
					local deque = LinkedDeque.new({ 1 })
					expect(deque:Remove(1)).to.equal(true)
				end)

				it("should remove an element from many", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					deque:Remove(3)
					expect(deque:Count()).to.equal(4)
				end)

				it("should return true when removing an element from many", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Remove(3)).to.equal(true)
				end)

				it("should not remove when the element does not exist", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					deque:Remove(6)
					expect(deque:Count()).to.equal(5)
				end)

				it("should return false when an element isn't removed", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:Remove(6)).to.equal(false)
				end)

				it("should remove one element when there are duplicates", function()
					local deque = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					deque:Remove(1)
					expect(deque:Count()).to.equal(4)
				end)

				it("should return true when removing a duplicate", function()
					local deque = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					expect(deque:Remove(1)).to.equal(true)
				end)
			end)

			describe("RemoveAll", function()
				it("should successfully attempt to remove when empty", function()
					local deque = LinkedDeque.new()
					local remove = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(function()
						deque:RemoveAll(remove)
					end).never.to.throw()
				end)

				it("should return false when attempting to remove when empty", function()
					local deque = LinkedDeque.new()
					local remove = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:RemoveAll(remove)).to.equal(false)
				end)

				it("should remove one element", function()
					local deque = LinkedDeque.new({ 1 })
					local remove = LinkedDeque.new({ 1 })
					deque:RemoveAll(remove)
					expect(deque:Count()).to.equal(0)
				end)

				it("should return true when removing one element", function()
					local deque = LinkedDeque.new({ 1 })
					local remove = LinkedDeque.new({ 1 })
					expect(deque:RemoveAll(remove)).to.equal(true)
				end)

				it("should remove with excess elements", function()
					local deque = LinkedDeque.new({ 1 })
					local remove = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					deque:RemoveAll(remove)
					expect(deque:Count()).to.equal(0)
				end)

				it("should return true when removing with excess elements", function()
					local deque = LinkedDeque.new({ 1 })
					local remove = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:RemoveAll(remove)).to.equal(true)
				end)

				it("should remove one element from many", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local remove = LinkedDeque.new({ 1 })
					deque:RemoveAll(remove)
					expect(deque:Count()).to.equal(4)
				end)

				it("should return true when removing one element from many", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local remove = LinkedDeque.new({ 1 })
					expect(deque:RemoveAll(remove)).to.equal(true)
				end)

				it("should not remove when the element does not exist", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local remove = LinkedDeque.new({ 0 })
					deque:RemoveAll(remove)
					expect(deque:Count()).to.equal(5)
				end)

				it("should return false when an element isn't removed", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local remove = LinkedDeque.new({ 0 })
					expect(deque:RemoveAll(remove)).to.equal(false)
				end)

				it("should remove multiple elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local remove = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					deque:RemoveAll(remove)
					expect(deque:Count()).to.equal(0)
				end)

				it("should return true when removing multiple elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local remove = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:RemoveAll(remove)).to.equal(true)
				end)

				it("should remove only once for each occurrence of duplicates", function()
					local deque = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					local remove = LinkedDeque.new({ 1, 1, 1 })
					deque:RemoveAll(remove)
					expect(deque:Count()).to.equal(2)
				end)

				it("should return true when removing duplicates", function()
					local deque = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					local remove = LinkedDeque.new({ 1, 1, 1 })
					expect(deque:RemoveAll(remove)).to.equal(true)
				end)
			end)

			describe("RetainAll", function()
				it("should successfully attempt to retain when empty", function()
					local deque = LinkedDeque.new()
					local retain = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(function()
						deque:RetainAll(retain)
					end).never.to.throw()
				end)

				it("should return false when retaining when empty", function()
					local deque = LinkedDeque.new()
					local retain = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:RetainAll(retain)).to.equal(false)
				end)

				it("should retain one element", function()
					local deque = LinkedDeque.new({ 1 })
					local retain = LinkedDeque.new({ 1 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(1)
				end)

				it("should return false when retaining one element", function()
					local deque = LinkedDeque.new({ 1 })
					local retain = LinkedDeque.new({ 1 })
					expect(deque:RetainAll(retain)).to.equal(false)
				end)

				it("should retain with excess elements to retain", function()
					local deque = LinkedDeque.new({ 1 })
					local retain = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(1)
				end)

				it("should return false when retaining with excess elements to retain", function()
					local deque = LinkedDeque.new({ 1 })
					local retain = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:RetainAll(retain)).to.equal(false)
				end)

				it("should not retain one element that does not match", function()
					local deque = LinkedDeque.new({ 1 })
					local retain = LinkedDeque.new({ 0 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(0)
				end)

				it("should return true when not retaining one element that does not match", function()
					local deque = LinkedDeque.new({ 1 })
					local retain = LinkedDeque.new({ 0 })
					expect(deque:RetainAll(retain)).to.equal(true)
				end)

				it("should retain one element from many", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 3 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(1)
				end)

				it("should return true when retaining one element from many", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 3 })
					expect(deque:RetainAll(retain)).to.equal(true)
				end)

				it("should retain no elements when one element does not match", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 6 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(0)
				end)

				it("should return true when not retaining one element", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 6 })
					expect(deque:RetainAll(retain)).to.equal(true)
				end)

				it("should retain multiple elements when more exist", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 1, 3, 5 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(3)
				end)

				it("should return true when retaining multiple elements when more exist", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 1, 3, 5 })
					expect(deque:RetainAll(retain)).to.equal(true)
				end)

				it("should retain multiple elements when attempting to retain excess elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 0, 1, 3 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(2)
				end)

				it("should return true when attemping to retain with excess elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 0, 1, 3 })
					expect(deque:RetainAll(retain)).to.equal(true)
				end)

				it("should retain all elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(5)
				end)

				it("should return false when retaining all elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					expect(deque:RetainAll(retain)).to.equal(false)
				end)

				it("should retain all elements when attempting to retain excess", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 0, 1, 2, 3, 4, 5 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(5)
				end)

				it("should return false when attempting to retain exceess and retaining all elements", function()
					local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
					local retain = LinkedDeque.new({ 0, 1, 2, 3, 4, 5 })
					expect(deque:RetainAll(retain)).to.equal(false)
				end)

				it("should retain all duplicates", function()
					local deque = LinkedDeque.new({ 1, 1, 2, 2, 3 })
					local retain = LinkedDeque.new({ 1, 2 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(4)
				end)

				it("should return true when retaining duplicates and more exist", function()
					local deque = LinkedDeque.new({ 1, 1, 2, 2, 3 })
					local retain = LinkedDeque.new({ 1, 2 })
					expect(deque:RetainAll(retain)).to.equal(true)
				end)

				it("should retain all duplicates when attemping to retain excess", function()
					local deque = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					local retain = LinkedDeque.new({ 1, 2 })
					deque:RetainAll(retain)
					expect(deque:Count()).to.equal(5)
				end)

				it("should return false when retaining all duplicates", function()
					local deque = LinkedDeque.new({ 1, 1, 1, 1, 1 })
					local retain = LinkedDeque.new({ 1 })
					expect(deque:RetainAll(retain)).to.equal(false)
				end)
			end)
		end)
	end)

	describe("Queue Interface", function()
		describe("First", function()
			it("should error when empty", function()
				local deque = LinkedDeque.new()
				expect(function()
					deque:First()
				end).to.throw("No first element exists.")
			end)

			it("should get the first element with one element", function()
				local deque = LinkedDeque.new({ 1 })
				expect(deque:First()).to.equal(1)
			end)

			it("should get the first element with many elements", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				expect(deque:First()).to.equal(1)
			end)

			it("should get the first element when elements are removed", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				deque:Shift()
				expect(deque:First()).to.equal(2)
			end)

			it("should error when all elements have been removed", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				while deque:Count() > 0 do
					deque:Shift()
				end
				expect(function()
					deque:First()
				end).to.throw("No first element exists.")
			end)
		end)

		describe("Push", function()
			it("should add an item to the end when empty", function()
				local deque = LinkedDeque.new()
				deque:Push(1)
				expect(deque:First()).to.equal(1)
				expect(deque:Count()).to.equal(1)
			end)

			it("should add an item to the end with one element", function()
				local deque = LinkedDeque.new({ 1 })
				deque:Push(2)
				expect(deque:Count()).to.equal(2)
				deque:Shift()
				expect(deque:First()).to.equal(2)
			end)

			it("should add an item to the end with many elements", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				deque:Push(6)
				expect(deque:Count()).to.equal(6)
				while deque:Count() > 1 do
					deque:Shift()
				end
				expect(deque:First()).to.equal(6)
			end)

			it("should return true", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				expect(deque:Push(6)).to.equal(true)
			end)
		end)

		describe("Shift", function()
			it("should error when empty", function()
				local deque = LinkedDeque.new()
				expect(function()
					deque:Shift()
				end).to.throw("No first element exists.")
			end)

			it("should remove an item from the beginning with one element", function()
				local deque = LinkedDeque.new({ 1 })
				deque:Shift()
				expect(deque:Count()).to.equal(0)
			end)

			it("should get the element when removing with one element", function()
				local deque = LinkedDeque.new({ 1 })
				expect(deque:Shift()).to.equal(1)
			end)

			it("should remove an item from the beginning with many elements", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				deque:Shift()
				expect(deque:First()).to.equal(2)
				expect(deque:Count()).to.equal(4)
			end)

			it("should get the element when removing with many elements", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				expect(deque:Shift()).to.equal(1)
			end)
		end)
	end)

	describe("Deque Interface", function()
		describe("Last", function()
			it("should error when empty", function()
				local deque = LinkedDeque.new()
				expect(function()
					deque:Last()
				end).to.throw("No last element exists.")
			end)

			it("should get the last element with one element", function()
				local deque = LinkedDeque.new({ 1 })
				expect(deque:Last()).to.equal(1)
			end)

			it("should get the last element with many elements", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				expect(deque:Last()).to.equal(5)
			end)

			it("should get the last element when elements are removed", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				deque:Pop()
				expect(deque:Last()).to.equal(4)
			end)

			it("should error when all elements have been removed", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				while deque:Count() > 0 do
					deque:Pop()
				end
				expect(function()
					deque:Last()
				end).to.throw("No last element exists.")
			end)
		end)

		describe("Unshift", function()
			it("should add an item to the beginning when empty", function()
				local deque = LinkedDeque.new()
				deque:Unshift(1)
				expect(deque:First()).to.equal(1)
				expect(deque:Count()).to.equal(1)
			end)

			it("should add an item to the beginning with one element", function()
				local deque = LinkedDeque.new({ 1 })
				deque:Unshift(2)
				expect(deque:Count()).to.equal(2)
				expect(deque:First()).to.equal(2)
			end)

			it("should add an item to the beginning with many elements", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				deque:Unshift(6)
				expect(deque:Count()).to.equal(6)
				expect(deque:First()).to.equal(6)
			end)

			it("should return true", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				expect(deque:Push(6)).to.equal(true)
			end)
		end)

		describe("Pop", function()
			it("should error when empty", function()
				local deque = LinkedDeque.new()
				expect(function()
					deque:Pop()
				end).to.throw("No last element exists.")
			end)

			it("should remove an item from the end with one element", function()
				local deque = LinkedDeque.new({ 1 })
				deque:Pop()
				expect(deque:Count()).to.equal(0)
			end)

			it("should get the element when removing with one element", function()
				local deque = LinkedDeque.new({ 1 })
				expect(deque:Pop()).to.equal(1)
			end)

			it("should remove an item from the end with many elements", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				deque:Pop()
				expect(deque:Last()).to.equal(4)
				expect(deque:Count()).to.equal(4)
			end)

			it("should get the element when removing with many elements", function()
				local deque = LinkedDeque.new({ 1, 2, 3, 4, 5 })
				expect(deque:Pop()).to.equal(5)
			end)
		end)
	end)
end
