OSDN Git Service

fix mov infinite loop (#461)
[bytom/vapor.git] / application / mov / common / type_test.go
1 package common
2
3 import (
4         "testing"
5
6         "github.com/vapor/consensus"
7         "github.com/vapor/testutil"
8 )
9
10 func TestCalcUTXOHash(t *testing.T) {
11         wantHash := "d94acbac0304e054569b0a2c2ab546be293552eb83d2d84af7234a013986a906"
12         controlProgram := testutil.MustDecodeHexString("0014d6f0330717170c838e6ac4c643de61e4c035e9b7")
13         sourceID := testutil.MustDecodeHash("3cada915465af2f08c93911bce7a100498fddb5738e5400269c4d5c2b2f5b261")
14         order := Order{
15                 FromAssetID: consensus.BTMAssetID,
16                 Utxo: &MovUtxo{
17                         SourceID:       &sourceID,
18                         SourcePos:      1,
19                         Amount:         399551000,
20                         ControlProgram: controlProgram,
21                 },
22         }
23
24         if hash := order.UTXOHash(); hash.String() != wantHash {
25                 t.Fatal("The function is incorrect")
26         }
27 }