github.com/tursom/GoCollections@v0.3.10/util/arrayList_test.go (about)

     1  /*
     2   * Copyright (c) 2022 tursom. All rights reserved.
     3   * Use of this source code is governed by a GPL-3
     4   * license that can be found in the LICENSE file.
     5   */
     6  
     7  package util
     8  
     9  import (
    10  	"fmt"
    11  	"testing"
    12  
    13  	"github.com/tursom/GoCollections/lang"
    14  )
    15  
    16  func Test_arrayList_Get(t *testing.T) {
    17  	l := arrayList[lang.Int]{array: []lang.Int{1, 2}}
    18  	for i := 0; i < l.Size()+1; i++ {
    19  		r, err := l.Get(i)
    20  		if err != nil {
    21  			err.PrintStackTrace()
    22  		} else {
    23  			fmt.Println(r)
    24  		}
    25  	}
    26  }