fix(front, back) -> undefined exception; feat(resize)
This commit is contained in:
@ -49,7 +49,7 @@ test('move, empty', () => {
|
||||
|
||||
test('constructor, assign', () => {
|
||||
expect(new List().size()).toEqual(0)
|
||||
expect(new List().back).toEqual(undefined)
|
||||
expect(() => new List().back).toThrow()
|
||||
expect(listEquArray(new List(null), [null])).toBeTruthy()
|
||||
expect(listEquArray(new List(null, 2), [null, null])).toBeTruthy()
|
||||
{
|
||||
@ -60,6 +60,19 @@ test('constructor, assign', () => {
|
||||
}
|
||||
})
|
||||
|
||||
test('resize', () => {
|
||||
{
|
||||
const list = List.from([1, 2, 3])
|
||||
list.resize(1)
|
||||
expect(listEquArray(list, [1])).toBeTruthy()
|
||||
}
|
||||
{
|
||||
const list = List.from([1])
|
||||
list.resize(3, 2)
|
||||
expect(listEquArray(list, [1, 2, 2])).toBeTruthy()
|
||||
}
|
||||
})
|
||||
|
||||
test('insert, clone', () => {
|
||||
{
|
||||
const list = List.from([1, 2])
|
||||
@ -135,4 +148,4 @@ test('pushBack, pushFront, popBack, popFront, back, front', () => {
|
||||
test('toJSON, toString', () => {
|
||||
expect(List.from([1, 2]).toJSON()).toEqual('[ 1, 2 ]')
|
||||
expect(List.from([0n]).toString()).toEqual('[ 0 ]')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user