<commit_before>#include <QTest>
#include <QSignalSpy>
#include <QTcpServer>
#include <QTcpSocket>
#include <QRegularExpression>
#include <QBuffer>

#include <msgpackiodevice.h>
#include <msgpackrequest.h>
#include "common.h"

namespace NeovimQt {

/**
 * A dummy request handler to help testing, it responds to all calls
 * with response
 */
class RequestHandler: public QObject, public MsgpackRequestHandler
{
	Q_OBJECT
public:
	RequestHandler(QObject *parent=0):QObject(parent) {}
	virtual void handleRequest(MsgpackIODevice* dev, quint32 msgid, const QByteArray& method, const QVariantList& params) {
		dev->sendResponse(msgid, QVariant(), response);
		emit receivedRequest(msgid, method, params);
	}
	QVariant response;
signals:
	void receivedRequest(quint32 msgid, const QByteArray&, const QVariantList&);

};

class Test: public QObject
{
	Q_OBJECT
private:
	MsgpackIODevice *one, *two;
	void resetLoop() {
		QTcpServer *server = new QTcpServer();
		server->listen(QHostAddress::LocalHost);

		QVERIFY(server->isListening());

		QTcpSocket *client = new QTcpSocket(this);
		QSignalSpy onConnected(client, SIGNAL(connected()));
		QVERIFY(onConnected.isValid());

		client->connectToHost(server->serverAddress(), server->serverPort());
		QVERIFY(SPYWAIT(onConnected));
		QVERIFY(server->hasPendingConnections());

		QTcpSocket *other = server->nextPendingConnection();

		one = new MsgpackIODevice(client);
		two = new MsgpackIODevice(other);
		QVERIFY(one->isOpen());
		QVERIFY(two->isOpen());
	}
private slots:
	void init() {
		resetLoop();
	}

	void cleanup() {<commit_msg>Fix tst_msgpackiodevice assertions<commit_after>#include <QTest>
#include <QSignalSpy>
#include <QTcpServer>
#include <QTcpSocket>
#include <QRegularExpression>
#include <QBuffer>

#include <msgpackiodevice.h>
#include <msgpackrequest.h>
#include "common.h"

namespace NeovimQt {

/**
 * A dummy request handler to help testing, it responds to all calls
 * with response
 */
class RequestHandler: public QObject, public MsgpackRequestHandler
{
	Q_OBJECT
public:
	RequestHandler(QObject *parent=0):QObject(parent) {}
	virtual void handleRequest(MsgpackIODevice* dev, quint32 msgid, const QByteArray& method, const QVariantList& params) {
		dev->sendResponse(msgid, QVariant(), response);
		emit receivedRequest(msgid, method, params);
	}
	QVariant response;
signals:
	void receivedRequest(quint32 msgid, const QByteArray&, const QVariantList&);

};

class Test: public QObject
{
	Q_OBJECT
private:
	MsgpackIODevice *one, *two;
	void resetLoop() {
		QTcpServer *server = new QTcpServer();
		QVERIFY(server->listen(QHostAddress::LocalHost));

		QVERIFY(server->isListening());

		QTcpSocket *client = new QTcpSocket(this);
		QSignalSpy onConnected(client, SIGNAL(connected()));
		QVERIFY(onConnected.isValid());
		QSignalSpy onNewConnection(server, SIGNAL(newConnection()));
		QVERIFY(onNewConnection.isValid());

		client->connectToHost(server->serverAddress(), server->serverPort());
		QVERIFY(SPYWAIT(onConnected));
		QVERIFY(SPYWAIT(onNewConnection));

		QTcpSocket *other = server->nextPendingConnection();

		one = new MsgpackIODevice(client);
		two = new MsgpackIODevice(other);
		QVERIFY(one->isOpen());
		QVERIFY(two->isOpen());
	}
private slots:
	void init() {
		resetLoop();
	}

	void cleanup() {
{'fraction_non_alphanumeric': 0.12911084043848964, 'fraction_numerical': 0.0030450669914738123, 'mean_word_length': 6.382022471910112, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 38, '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': '2947879', 'n_tokens_mistral': 1170, 'n_tokens_neox': 1091, 'n_words': 246}