<commit_before>#include "BitsTests.h"
#include "Bits.h"
using namespace std;

CPPUNIT_TEST_SUITE_REGISTRATION(BitsTests);

BitsTests::BitsTests(){
}

BitsTests::~BitsTests(){
}

void BitsTests::setUp(){
	//Starting tests...
}

void BitsTests::tearDown(){
	//Finishing tests...
}

void BitsTests::testFromFile(){
    unsigned char chunk[] = "This is a test!";
    int64_t size = sizeof(chunk) - 1;

    char tmpfn[L_tmpnam];
    CPPUNIT_ASSERT(tmpnam(tmpfn) != NULL);

    ofstream tmpf(tmpfn);
    CPPUNIT_ASSERT(tmpf.is_open() == true);
    tmpf << chunk;
    tmpf.close();

    Bits bits;
    bool result = bits.fromFile(tmpfn);
    CPPUNIT_ASSERT(result);
    CPPUNIT_ASSERT(bits.getMaxPosition() == size);

    unsigned char *f2 = bits.read(2);
    unsigned int c_f2 = memcmp(f2, "Th", 2);
    CPPUNIT_ASSERT(c_f2 == 0);

    CPPUNIT_ASSERT(remove(tmpfn) == 0);
}

void BitsTests::testFromMem(){
	unsigned char chunk[] = "This is a test!";
	int64_t size = sizeof(chunk) - 1;

	Bits bits;
	bool result = bits.fromMem(chunk, size);
	CPPUNIT_ASSERT(result);
	CPPUNIT_ASSERT(bits.getMaxPosition() == size);<commit_msg>Fail a test on purpose (testing Travis CI)<commit_after>#include "BitsTests.h"
#include "Bits.h"
using namespace std;

CPPUNIT_TEST_SUITE_REGISTRATION(BitsTests);

BitsTests::BitsTests(){
}

BitsTests::~BitsTests(){
}

void BitsTests::setUp(){
	//Starting tests...
}

void BitsTests::tearDown(){
	//Finishing tests...
}

void BitsTests::testFromFile(){
    unsigned char chunk[] = "This is a test!";
    int64_t size = sizeof(chunk) - 1;

    char tmpfn[L_tmpnam];
    CPPUNIT_ASSERT(tmpnam(tmpfn) != NULL);

    ofstream tmpf(tmpfn);
    CPPUNIT_ASSERT(tmpf.is_open() == true);
    tmpf << chunk;
    tmpf.close();

    Bits bits;
    bool result = bits.fromFile(tmpfn);
    CPPUNIT_ASSERT(result);
    CPPUNIT_ASSERT(bits.getMaxPosition() == size);

    unsigned char *f2 = bits.read(2);
    unsigned int c_f2 = memcmp(f2, "Th", 2);
    CPPUNIT_ASSERT(c_f2 == 0);

    CPPUNIT_ASSERT(remove(tmpfn) == 0);
	CPPUNIT_ASSERT(1 == 2);
}

void BitsTests::testFromMem(){
	unsigned char chunk[] = "This is a test!";
	int64_t size = sizeof(chunk) - 1;

	Bits bits;
	bool result = bits.fromMem(chunk, size);
	CPPUNIT_ASSERT(result);
	CPPUNIT_ASSERT(bits.getMaxPosition() == size);
{'fraction_non_alphanumeric': 0.15502183406113537, 'fraction_numerical': 0.013100436681222707, 'mean_word_length': 4.230593607305936, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1506541', 'n_tokens_mistral': 876, 'n_tokens_neox': 831, 'n_words': 180}