(t *testing.T)
| 895 | } |
| 896 | |
| 897 | func TestScript_PushMultData(t *testing.T) { |
| 898 | tests := []struct { |
| 899 | in [][]byte |
| 900 | wantScriptData []byte |
| 901 | wantError error |
| 902 | description string |
| 903 | }{ |
| 904 | // Single data |
| 905 | {nil, []byte{}, nil, "Nil data to test."}, |
| 906 | {[][]byte{{0x00}, {0x00}, {0x00}}, []byte{0x01, 0x00, 0x01, 0x00, 0x01, 0x00}, nil, "Less 0x4c data to test."}, |
| 907 | { |
| 908 | [][]byte{bytes.Repeat([]byte{0x00}, OP_PUSHDATA1)}, |
| 909 | combineBytes([]byte{0x4c, 0x4c}, bytes.Repeat([]byte{0x00}, 0x4c)), |
| 910 | nil, |
| 911 | "Push 0X4c data to test.", |
| 912 | }, |
| 913 | { |
| 914 | [][]byte{bytes.Repeat([]byte{0x00}, 0xff)}, |
| 915 | combineBytes([]byte{0x4c, 0xff}, bytes.Repeat([]byte{0x00}, 0xff)), |
| 916 | nil, |
| 917 | "Push 0xff data to test.", |
| 918 | }, |
| 919 | { |
| 920 | [][]byte{bytes.Repeat([]byte{0x00}, 0xffff)}, |
| 921 | combineBytes([]byte{0x4d, 0xff, 0xff}, bytes.Repeat([]byte{0x00}, 0xffff)), |
| 922 | nil, |
| 923 | "Push 0xffff data to test.", |
| 924 | }, |
| 925 | { |
| 926 | [][]byte{bytes.Repeat([]byte{0x00}, 0x010000)}, |
| 927 | combineBytes([]byte{0x4e, 0x00, 0x00, 0x01, 0x00}, bytes.Repeat([]byte{0x00}, 0x010000)), |
| 928 | nil, |
| 929 | "Push 0x010000 data to test.", |
| 930 | }, |
| 931 | |
| 932 | // Multi data |
| 933 | {[][]byte{nil, nil, nil}, []byte{0x00, 0x00, 0x00}, nil, "Multi Nil data to test."}, |
| 934 | { |
| 935 | [][]byte{bytes.Repeat([]byte{0x00}, OP_PUSHDATA1), bytes.Repeat([]byte{0x00}, OP_PUSHDATA1)}, |
| 936 | combineBytes([]byte{0x4c, 0x4c}, bytes.Repeat([]byte{0x00}, 0x4c), |
| 937 | []byte{0x4c, 0x4c}, bytes.Repeat([]byte{0x00}, 0x4c)), |
| 938 | nil, |
| 939 | "Multi Push 0X4c data to test.", |
| 940 | }, |
| 941 | { |
| 942 | [][]byte{bytes.Repeat([]byte{0x00}, 0xff), bytes.Repeat([]byte{0x00}, 0xff)}, |
| 943 | combineBytes([]byte{0x4c, 0xff}, bytes.Repeat([]byte{0x00}, 0xff), |
| 944 | []byte{0x4c, 0xff}, bytes.Repeat([]byte{0x00}, 0xff)), |
| 945 | nil, |
| 946 | "Multi Push 0xff data to test.", |
| 947 | }, |
| 948 | { |
| 949 | [][]byte{bytes.Repeat([]byte{0x00}, 0x1fff), bytes.Repeat([]byte{0x00}, 0x1fff)}, |
| 950 | combineBytes([]byte{0x4d, 0xff, 0x1f}, bytes.Repeat([]byte{0x00}, 0x1fff), |
| 951 | []byte{0x4d, 0xff, 0x1f}, bytes.Repeat([]byte{0x00}, 0x1fff)), |
| 952 | nil, |
| 953 | "Multi Push 0xffff data to test.", |
| 954 | }, |
nothing calls this directly
no test coverage detected