mirror of
https://github.com/luxfi/vm.git
synced 2026-10-30 15:13:40 +00:00
35 lines
778 B
Go
35 lines
778 B
Go
// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package atomic_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/luxfi/database/memdb"
|
|
"github.com/luxfi/database/prefixdb"
|
|
"github.com/luxfi/ids"
|
|
"github.com/luxfi/vm/chains/atomic/atomictest"
|
|
|
|
. "github.com/luxfi/vm/chains/atomic"
|
|
)
|
|
|
|
func TestSharedMemory(t *testing.T) {
|
|
chainID0 := ids.GenerateTestID()
|
|
chainID1 := ids.GenerateTestID()
|
|
|
|
for _, test := range atomictest.SharedMemoryTests {
|
|
baseDB := memdb.New()
|
|
|
|
memoryDB := prefixdb.New([]byte{0}, baseDB)
|
|
testDB := prefixdb.New([]byte{1}, baseDB)
|
|
|
|
m := NewMemory(memoryDB)
|
|
|
|
sm0 := m.NewSharedMemory(chainID0)
|
|
sm1 := m.NewSharedMemory(chainID1)
|
|
|
|
test(t, chainID0, chainID1, sm0, sm1, testDB)
|
|
}
|
|
}
|