<commit_before>package god

import (
	"ext"
	"testing"
	"time"

	"github.com/golang/protobuf/proto"
)

func TestGod(t *testing.T) {
	ext.AssertNoError(t,
		Start("amqp://guest:guest@localhost:5672/", 0, ext.RandomUint64()),
		"start god")

	var producer, consumer *Session
	var err error

	consumer, err = NewSession()
	ext.AssertNoError(t, err, "new consumer")

	exchange := "god.test"
	routingKeyType := ext.RandomUint16()
	routingKey := ext.RandomUint64()

	q, err := consumer.Subscribe(exchange, routingKeyType, routingKey)
	ext.AssertNoError(t, err, "pull msgs")
	ci := int64(0)
	go consumer.Handle(q,
		func(method string, msg proto.Message) error {
			ext.CheckEqual(t, method, "Test")
			test := msg.(*Test)
			ext.CheckEqual(t, test.Count, ci)
			ci++
			return nil
		})

	producer, err = NewSession()
	ext.AssertNoError(t, err, "new producer")

	for i := int64(0); i < 1000; i++ {
		var test Test
		test.Count = i
		err = producer.Post(exchange,
			routingKeyType, routingKey,
			"Test", &test)
		ext.AssertNoError(t, err, "post")
	}

	time.Sleep(time.Millisecond * 100)
}

func BenchmarkStartNode(b *testing.B) {
}
<commit_msg>use testify/require<commit_after>package god

import (
	"ext"
	"testing"
	"time"

	"github.com/golang/protobuf/proto"
	"github.com/stretchr/testify/require"
)

func TestGod(t *testing.T) {
	require.NoError(t,
		Start("amqp://guest:guest@localhost:5672/", 0, ext.RandomUint64()),
		"start god")

	var producer, consumer *Session
	var err error

	consumer, err = NewSession()
	require.NoError(t, err, "new consumer")

	exchange := "god.test"
	routingKeyType := ext.RandomUint16()
	routingKey := ext.RandomUint64()

	q, err := consumer.Subscribe(exchange, routingKeyType, routingKey)
	require.NoError(t, err, "pull msgs")
	ci := int64(0)
	go consumer.Handle(q,
		func(method string, msg proto.Message) error {
			require.Equal(t, method, "Test")
			test := msg.(*Test)
			require.Equal(t, test.Count, ci)
			ci++
			return nil
		})

	producer, err = NewSession()
	require.NoError(t, err, "new producer")

	for i := int64(0); i < 1000; i++ {
		var test Test
		test.Count = i
		err = producer.Post(exchange,
			routingKeyType, routingKey,
			"Test", &test)
		require.NoError(t, err, "post")
	}

	time.Sleep(time.Millisecond * 100)
}

func BenchmarkStartNode(b *testing.B) {
}

{'fraction_non_alphanumeric': 0.1563447379818103, 'fraction_numerical': 0.02078822000866176, 'mean_word_length': 4.191011235955056, 'pattern_counts': {'":': 0, '<': 5, '<?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': '285209', 'n_tokens_mistral': 967, 'n_tokens_neox': 858, 'n_words': 196}