stackitem: use Bool item directly

It is always copied.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2021-08-03 19:37:06 +03:00
parent 5aff82aef4
commit cff8b1c24e
6 changed files with 40 additions and 44 deletions

View file

@ -63,11 +63,11 @@ var makeStackItemTestCases = []struct {
},
{
input: true,
result: &Bool{value: true},
result: Bool(true),
},
{
input: false,
result: &Bool{value: false},
result: Bool(false),
},
{
input: []Item{&BigInteger{value: big.NewInt(3)}, &ByteArray{value: []byte{1, 2, 3}}},
@ -459,8 +459,8 @@ func TestMarshalJSON(t *testing.T) {
switch testCase.input.(type) {
case *BigInteger:
actual, err = testCase.input.(*BigInteger).MarshalJSON()
case *Bool:
actual, err = testCase.input.(*Bool).MarshalJSON()
case Bool:
actual, err = testCase.input.(Bool).MarshalJSON()
case *ByteArray:
actual, err = testCase.input.(*ByteArray).MarshalJSON()
case *Array:
@ -532,7 +532,9 @@ func TestDeepCopy(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
actual := DeepCopy(tc.item)
require.Equal(t, tc.item, actual)
require.False(t, actual == tc.item)
if tc.item.Type() != BooleanT {
require.False(t, actual == tc.item)
}
})
}