(t *testing.T)
| 74 | } |
| 75 | |
| 76 | func TestTableInsert(t *testing.T) { |
| 77 | tbl := newLTable(0, 0) |
| 78 | tbl.Append(LTrue) |
| 79 | tbl.Append(LTrue) |
| 80 | tbl.Append(LTrue) |
| 81 | |
| 82 | tbl.Insert(5, LFalse) |
| 83 | errorIfNotEqual(t, LFalse, tbl.RawGetInt(5)) |
| 84 | errorIfNotEqual(t, 5, tbl.Len()) |
| 85 | |
| 86 | tbl.Insert(-10, LFalse) |
| 87 | errorIfNotEqual(t, LFalse, tbl.RawGet(LNumber(-10))) |
| 88 | errorIfNotEqual(t, 5, tbl.Len()) |
| 89 | |
| 90 | tbl = newLTable(0, 0) |
| 91 | tbl.Append(LNumber(1)) |
| 92 | tbl.Append(LNumber(2)) |
| 93 | tbl.Append(LNumber(3)) |
| 94 | tbl.Insert(1, LNumber(10)) |
| 95 | errorIfNotEqual(t, LNumber(10), tbl.RawGetInt(1)) |
| 96 | errorIfNotEqual(t, LNumber(1), tbl.RawGetInt(2)) |
| 97 | errorIfNotEqual(t, LNumber(2), tbl.RawGetInt(3)) |
| 98 | errorIfNotEqual(t, LNumber(3), tbl.RawGetInt(4)) |
| 99 | errorIfNotEqual(t, 4, tbl.Len()) |
| 100 | |
| 101 | tbl = newLTable(0, 0) |
| 102 | tbl.Insert(5, LNumber(10)) |
| 103 | errorIfNotEqual(t, LNumber(10), tbl.RawGetInt(5)) |
| 104 | |
| 105 | } |
| 106 | |
| 107 | func TestTableMaxN(t *testing.T) { |
| 108 | tbl := newLTable(0, 0) |
nothing calls this directly
no test coverage detected
searching dependent graphs…