64 lines
1.5 KiB
Plaintext
64 lines
1.5 KiB
Plaintext
|
|
2
|
||
|
|
-- concat tests
|
||
|
|
onetwothree
|
||
|
|
one--two--three
|
||
|
|
two,three
|
||
|
|
two
|
||
|
|
|
||
|
|
onetwothreefourfive
|
||
|
|
one--two--three--four--five
|
||
|
|
two,three,four,five
|
||
|
|
two
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
-- insert, len tests
|
||
|
|
{[1]=one,[2]=two,[3]=three,[a]=aaa,[b]=bbb,[c]=ccc} 3
|
||
|
|
{[1]=one,[2]=two,[3]=three,[4]=six,[a]=aaa,[b]=bbb,[c]=ccc} 4
|
||
|
|
{[1]=seven,[2]=one,[3]=two,[4]=three,[5]=six,[a]=aaa,[b]=bbb,[c]=ccc} 5
|
||
|
|
{[1]=seven,[2]=one,[3]=two,[4]=eight,[5]=three,[6]=six,[a]=aaa,[b]=bbb,[c]=ccc} 6
|
||
|
|
{[1]=seven,[2]=one,[3]=two,[4]=eight,[5]=three,[6]=six,[7]=nine,[a]=aaa,[b]=bbb,[c]=ccc} 7
|
||
|
|
#{} 0
|
||
|
|
#{"a"} 1
|
||
|
|
#{"a","b"} 2
|
||
|
|
#{"a",nil} 1
|
||
|
|
#{nil,nil} 0
|
||
|
|
#{nil,"b"} true
|
||
|
|
#{"a","b","c"} 3
|
||
|
|
#{"a","b",nil} 2
|
||
|
|
#{"a",nil,nil} 1
|
||
|
|
#{nil,nil,nil} 0
|
||
|
|
#{nil,nil,"c"} true
|
||
|
|
#{nil,"b","c"} true
|
||
|
|
#{nil,"b",nil} true
|
||
|
|
#{"a",nil,"c"} true
|
||
|
|
-- remove tests
|
||
|
|
{[10]=ten,[1]=one,[2]=two,[3]=three,[4]=four,[5]=five,[6]=six,[7]=seven,[a]=aaa,[b]=bbb,[c]=ccc} 7
|
||
|
|
table.remove(t) seven
|
||
|
|
{[10]=ten,[1]=one,[2]=two,[3]=three,[4]=four,[5]=five,[6]=six,[a]=aaa,[b]=bbb,[c]=ccc} 6
|
||
|
|
table.remove(t,1) one
|
||
|
|
{[10]=ten,[1]=two,[2]=three,[3]=four,[4]=five,[5]=six,[a]=aaa,[b]=bbb,[c]=ccc} 5
|
||
|
|
table.remove(t,3) four
|
||
|
|
{[10]=ten,[1]=two,[2]=three,[3]=five,[4]=six,[a]=aaa,[b]=bbb,[c]=ccc} 4
|
||
|
|
table.remove(t,5)
|
||
|
|
{[10]=ten,[1]=two,[2]=three,[3]=five,[4]=six,[a]=aaa,[b]=bbb,[c]=ccc} 4
|
||
|
|
-- sort tests
|
||
|
|
one-two-three
|
||
|
|
one-three-two
|
||
|
|
www-vvv-uuu-ttt-sss-zzz-yyy-xxx
|
||
|
|
sss-ttt-uuu-vvv-www-xxx-yyy-zzz
|
||
|
|
www-vvv-uuu-ttt-sss-zzz-yyy-xxx
|
||
|
|
zzz-yyy-xxx-www-vvv-uuu-ttt-sss
|
||
|
|
----- unpack tests -------
|
||
|
|
pcall(unpack) false
|
||
|
|
pcall(unpack,nil) false
|
||
|
|
pcall(unpack,"abc") false
|
||
|
|
pcall(unpack,1) false
|