Skip to content

Commit

Permalink
Add test for Unknown InMsgBody sumtype
Browse files Browse the repository at this point in the history
  • Loading branch information
erokhinav committed Oct 3, 2024
1 parent 35fe4dd commit 996d9dc
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions abi/messages_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package abi

import (
"fmt"
"github.com/tonkeeper/tongo/boc"
"github.com/tonkeeper/tongo/tlb"
"github.com/tonkeeper/tongo/ton"
Expand Down Expand Up @@ -39,3 +40,24 @@ func TestEncodeAndDecodeInMsgBody(t *testing.T) {
t.Fatalf("got different result")
}
}

func TestDecodeAndEncodeUnknownInMsgBody(t *testing.T) {
data := "b5ee9c720101010100350000650000022800000000000000005012a05f200800c46663fd6592a0ca9ff0f04ed928fe74019bac1756d06092c14464fb3ce8d373"
boc1, _ := boc.DeserializeBocHex(data)

var x InMsgBody
if err := tlb.Unmarshal(boc1[0], &x); err != nil {
t.Fatalf("Unable to unmarshal: %v", err)
}

boc2 := boc.NewCell()
if err := tlb.Marshal(boc2, x); err != nil {
t.Fatalf("Unable to marshal: %v", err)
}

b, _ := boc2.ToBoc()
res := fmt.Sprintf("%x", b)
if res != data {
t.Fatalf("got different result")
}
}

0 comments on commit 996d9dc

Please sign in to comment.