<commit_before>package zforwarder_test

import (
	"time"
	zmq "github.com/pebbe/zmq4"
	zforwarder "github.com/sublee/zforwarder"
	"testing"
)

func TestProxy(t *testing.T) {
	// set sockets
	pub, _ := zmq.NewSocket(zmq.PUB)
	sub, _ := zmq.NewSocket(zmq.SUB)
	xpub, _ := zmq.NewSocket(zmq.XPUB)
	xsub, _ := zmq.NewSocket(zmq.XSUB)
	xpub.Bind("inproc://xpub")
	xsub.Bind("inproc://xsub")
	pub.Connect("inproc://xsub")
	sub.Connect("inproc://xpub")
	// run forwarder
	go zforwarder.Forwarder(xpub, xsub)
	// communicate between PUB/SUB via XPUB/XSUB
	sub.SetSubscribe("")
	time.Sleep(time.Nanosecond)
	msgExpected := "Hello"
	pub.Send(msgExpected, 0)
	msg, err := sub.Recv(0)
	// check result
	if err != nil {
		t.Fatalf("An error occurs by SUB socket: %s", err)
	}
	if msg != msgExpected {<commit_msg>gofmt<commit_after>package zforwarder_test

import (
	zmq "github.com/pebbe/zmq4"
	zforwarder "github.com/sublee/zforwarder"
	"testing"
	"time"
)

func TestProxy(t *testing.T) {
	// set sockets
	pub, _ := zmq.NewSocket(zmq.PUB)
	sub, _ := zmq.NewSocket(zmq.SUB)
	xpub, _ := zmq.NewSocket(zmq.XPUB)
	xsub, _ := zmq.NewSocket(zmq.XSUB)
	xpub.Bind("inproc://xpub")
	xsub.Bind("inproc://xsub")
	pub.Connect("inproc://xsub")
	sub.Connect("inproc://xpub")
	// run forwarder
	go zforwarder.Forwarder(xpub, xsub)
	// communicate between PUB/SUB via XPUB/XSUB
	sub.SetSubscribe("")
	time.Sleep(time.Nanosecond)
	msgExpected := "Hello"
	pub.Send(msgExpected, 0)
	msg, err := sub.Recv(0)
	// check result
	if err != nil {
		t.Fatalf("An error occurs by SUB socket: %s", err)
	}
	if msg != msgExpected {
{'fraction_non_alphanumeric': 0.1710691823899371, 'fraction_numerical': 0.0037735849056603774, 'mean_word_length': 4.115755627009646, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3580531', 'n_tokens_mistral': 689, 'n_tokens_neox': 674, 'n_words': 122}