vm: allow to convert stack to a slice
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
805f746f15
commit
7b4acd5a7f
2 changed files with 25 additions and 0 deletions
|
@ -237,6 +237,22 @@ func TestPushVal(t *testing.T) {
|
|||
assert.IsType(t, elem.value, &stackitem.Array{})
|
||||
}
|
||||
|
||||
func TestStack_ToArray(t *testing.T) {
|
||||
t.Run("Empty", func(t *testing.T) {
|
||||
s := NewStack("test")
|
||||
items := s.ToArray()
|
||||
require.Equal(t, 0, len(items))
|
||||
})
|
||||
t.Run("NonEmpty", func(t *testing.T) {
|
||||
s := NewStack("test")
|
||||
expected := []stackitem.Item{stackitem.Make(1), stackitem.Make(true)}
|
||||
for i := range expected {
|
||||
s.PushVal(expected[i])
|
||||
}
|
||||
require.Equal(t, expected, s.ToArray())
|
||||
})
|
||||
}
|
||||
|
||||
func TestSwapElemValues(t *testing.T) {
|
||||
s := NewStack("test")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue