mirror of
https://github.com/emirpasic/gods.git
synced 2026-06-15 16:16:35 +03:00
- make ArrayStack make use of our ArrayList
- add Values() method to stacks interface - write tests
This commit is contained in:
@@ -27,7 +27,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
package arraystack
|
||||
|
||||
import (
|
||||
"github.com/emirpasic/gods/utils"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -44,8 +43,8 @@ func TestArrayStack(t *testing.T) {
|
||||
stack.Push(2)
|
||||
stack.Push(3)
|
||||
|
||||
if actualValue := stack.Values(); !utils.IdenticalSlices(actualValue, []interface{}{3, 2, 1}) {
|
||||
t.Errorf("Got %v expected %v", actualValue, []interface{}{3, 2, 1})
|
||||
if actualValue := stack.Values(); actualValue[0].(int) != 3 || actualValue[1].(int) != 2 || actualValue[2].(int) != 1 {
|
||||
t.Errorf("Got %v expected %v", actualValue, "[3,2,1]")
|
||||
}
|
||||
|
||||
if actualValue := stack.Empty(); actualValue != false {
|
||||
@@ -82,8 +81,8 @@ func TestArrayStack(t *testing.T) {
|
||||
t.Errorf("Got %v expected %v", actualValue, true)
|
||||
}
|
||||
|
||||
if actualValue := stack.Values(); !utils.IdenticalSlices(actualValue, []interface{}{}) {
|
||||
t.Errorf("Got %v expected %v", actualValue, []interface{}{})
|
||||
if actualValue := stack.Values(); len(actualValue) != 0 {
|
||||
t.Errorf("Got %v expected %v", actualValue, "[]")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user