<commit_before>/** Copyright (C) 2016, 2017 European Spallation Source ERIC */

#include <readout/ReadoutDummy.h>
#include <readout/ReadoutTestData.h>
#include <test/TestBase.h>

#define DETECTOR_TYPE 1

class ReadoutDummyTest : public TestBase {
protected:
  char buffer[9000];
  virtual void SetUp() {
    memset(buffer, 0, sizeof(buffer));
  }
  virtual void TearDown() {}
};


TEST_F(ReadoutDummyTest, Parser) {
  ReadoutDummy readout(DETECTOR_TYPE);

  int size = ok_one_hit.size();

  auto res = readout.parse((char *)&ok_one_hit[0], size);
  ASSERT_EQ(res, 0);
}

int main(int argc, char **argv) {
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}
<commit_msg>added a couple of tests<commit_after>/** Copyright (C) 2016, 2017 European Spallation Source ERIC */

#include <readout/ReadoutDummy.h>
#include <readout/ReadoutTestData.h>
#include <test/TestBase.h>

#define DETECTOR_TYPE 1

class ReadoutDummyTest : public TestBase {
protected:
  char buffer[9000];
  virtual void SetUp() {
    memset(buffer, 0, sizeof(buffer));
  }
  virtual void TearDown() {}
};

TEST_F(ReadoutDummyTest, ValidateFail) {
  ReadoutDummy readout(DETECTOR_TYPE);
  auto res = readout.parse(0, 64);
  ASSERT_EQ(res, -1);
}

TEST_F(ReadoutDummyTest, TypeFail) {
  ReadoutDummy readout(DETECTOR_TYPE + 1);
  int size = ok_one_hit.size();

  auto res = readout.parse((char *)&ok_one_hit[0], size);
  ASSERT_EQ(res, -1);
}

TEST_F(ReadoutDummyTest, Parser) {
  ReadoutDummy readout(DETECTOR_TYPE);

  int size = ok_one_hit.size();

  auto res = readout.parse((char *)&ok_one_hit[0], size);
  ASSERT_EQ(res, 0);
}

int main(int argc, char **argv) {
  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}

{'fraction_non_alphanumeric': 0.14110787172011663, 'fraction_numerical': 0.022740524781341108, 'mean_word_length': 5.063604240282685, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5381718', 'n_tokens_mistral': 681, 'n_tokens_neox': 639, 'n_words': 143}