func compareMatchers(t *testing.T, orderPairs, depth int, lowPrice, highPrice uint64) {
	refIn := coordinator.NewChanReaderWriter(1)
	refOut := coordinator.NewChanReaderWriter(orderPairs * 4)
	refm := newRefmatcher(lowPrice, highPrice)
	refm.Config("Reference Matcher", refIn, refOut)
	in := coordinator.NewChanReaderWriter(1)
	out := coordinator.NewChanReaderWriter(orderPairs * 4)
	m := NewMatcher(orderPairs * 4)
	m.Config("Real Matcher", in, out)
	testSet, err := cmprMaker.RndTradeSet(orderPairs, depth, lowPrice, highPrice)
	if err != nil {
		panic(err.Error())
	}
	go m.Run()
	go refm.Run()
	for i := 0; i < len(testSet); i++ {
		refIn.Write(testSet[i])
		in.Write(testSet[i])
	}
	refIn.Write(msg.Message{Kind: msg.SHUTDOWN})
	in.Write(msg.Message{Kind: msg.SHUTDOWN})
	checkBuffers(t, refOut, out)
}
Beispiel #2
0
func multiThreadedChan(log bool, data []msg.Message) {
	in := coordinator.NewChanReaderWriter(1024)
	out := coordinator.NewChanReaderWriter(1024)
	multiThreaded(log, data, in, out)
}