mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-17 15:09:59 +00:00
29 lines
526 B
Go
29 lines
526 B
Go
package orderbook
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/gofrs/uuid"
|
|
)
|
|
|
|
var unsafeID, _ = uuid.NewV4()
|
|
|
|
type externalBook struct{}
|
|
|
|
func (e *externalBook) Lock() {}
|
|
func (e *externalBook) Unlock() {}
|
|
|
|
func TestUnsafe(t *testing.T) {
|
|
d := newDepth(unsafeID)
|
|
ob := d.GetUnsafe()
|
|
if ob.AskHead == nil || ob.BidHead == nil || ob.m == nil {
|
|
t.Fatal("these items should not be nil")
|
|
}
|
|
|
|
ob2 := &externalBook{}
|
|
ob.Lock()
|
|
ob.Unlock() // nolint:staticcheck, gocritic // Not needed in test
|
|
ob.LockWith(ob2)
|
|
ob.UnlockWith(ob2)
|
|
}
|