2018-09-19 13:31:06 +00:00
|
|
|
package globalplatform
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2018-09-27 09:23:12 +00:00
|
|
|
"github.com/status-im/status-go/smartcard/hexutils"
|
2018-09-19 13:31:06 +00:00
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCommandSelect(t *testing.T) {
|
|
|
|
aid := []byte{}
|
|
|
|
cmd := NewCommandSelect(aid)
|
|
|
|
|
2018-09-25 15:43:26 +00:00
|
|
|
assert.Equal(t, uint8(0x00), cmd.Cla)
|
|
|
|
assert.Equal(t, uint8(0xA4), cmd.Ins)
|
|
|
|
assert.Equal(t, uint8(0x04), cmd.P1)
|
|
|
|
assert.Equal(t, uint8(0x00), cmd.P2)
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestCommandInitializeUpdate(t *testing.T) {
|
2018-09-27 09:23:12 +00:00
|
|
|
challenge := hexutils.HexToBytes("010203")
|
2018-09-25 15:43:26 +00:00
|
|
|
cmd := NewCommandInitializeUpdate(challenge)
|
|
|
|
|
|
|
|
assert.Equal(t, uint8(0x80), cmd.Cla)
|
|
|
|
assert.Equal(t, uint8(0x50), cmd.Ins)
|
|
|
|
assert.Equal(t, uint8(0x00), cmd.P1)
|
|
|
|
assert.Equal(t, uint8(0x00), cmd.P2)
|
|
|
|
assert.Equal(t, challenge, cmd.Data)
|
2018-09-19 13:31:06 +00:00
|
|
|
}
|