github.com/true-sqn/fabric@v2.1.1+incompatible/core/ledger/util/txvalidationflags_test.go (about) 1 /* 2 Copyright IBM Corp. All Rights Reserved. 3 4 SPDX-License-Identifier: Apache-2.0 5 */ 6 7 package util 8 9 import ( 10 "testing" 11 12 "github.com/hyperledger/fabric-protos-go/peer" 13 "github.com/stretchr/testify/assert" 14 ) 15 16 func TestTransactionValidationFlags(t *testing.T) { 17 txFlags := NewTxValidationFlagsSetValue(10, peer.TxValidationCode_VALID) 18 assert.Equal(t, 10, len(txFlags)) 19 20 txFlags.SetFlag(0, peer.TxValidationCode_VALID) 21 assert.Equal(t, peer.TxValidationCode_VALID, txFlags.Flag(0)) 22 assert.Equal(t, true, txFlags.IsValid(0)) 23 24 txFlags.SetFlag(1, peer.TxValidationCode_MVCC_READ_CONFLICT) 25 assert.Equal(t, true, txFlags.IsInvalid(1)) 26 }