<commit_before>
/*
 * Author: <NAME> <<EMAIL>>
 * Sep 23, 2014
 *
 * This class is for creating tests that require assembly code as inputs.  To
 * use it, one creates a subclass and then uses it as a "test case name" in a
 * TEST_F macro.
 */

#ifndef __STOKE_TEST_CODETEST
#define __STOKE_TEST_CODETEST

#include <vector>
#include <sstream>
#include <iostream>

#include "src/ext/x64asm/src/code.h"

class CodeTest : public ::testing::Test {

  protected:

      virtual void SetUp() {

        x64asm::Code fixture1;
        std::stringstream ss;
        ss << "incq %rax" << std::endl;
        ss >> fixture1;

        fixtures_.push_back(fixture1);
        fixture_sizes_.push_back(1);
      }
      
      std::vector<x64asm::Code> fixtures_;
      std::vector<int> fixture_sizes_;
};

TEST_F(CodeTest, SizesTriviallyWork) {

  size_t len = fixtures_.size();
  ASSERT_EQ(fixtures_.size(), fixture_sizes_.size());

  for(size_t i = 0; i < len; ++i) {
    ASSERT_EQ(fixtures_[i].size(), fixture_sizes_[i]);
  }
<commit_msg>updated code_tests.h<commit_after>
/*
 * Author: <NAME> <<EMAIL>>
 * Sep 23, 2014
 *
 * This class is for creating tests that require assembly code as inputs.  To
 * use it, one creates a subclass and then uses it as a "test case name" in a
 * TEST_F macro.
 */

#ifndef __STOKE_TEST_CODETEST
#define __STOKE_TEST_CODETEST

#include <vector>
#include <sstream>
#include <iostream>

#include "src/ext/x64asm/src/code.h"

class CodeTest : public ::testing::Test {

  protected:
    // TODO:
    // create standard file format
    // read fixtures in through this format
    // write code to go through directory and load all of them

      virtual void SetUp() {

        x64asm::Code fixture1;
        std::stringstream ss;
        ss << "incq %rax" << std::endl;
        ss >> fixture1;

        fixtures_.push_back(fixture1);
        fixture_sizes_.push_back(1);
      }
      
      std::vector<x64asm::Code> fixtures_;
      std::vector<int> fixture_sizes_;
};

TEST_F(CodeTest, SizesTriviallyWork) {

  size_t len = fixtures_.size();
  ASSERT_EQ(fixtures_.size(), fixture_sizes_.size());

  for(size_t i = 0; i < len; ++i) {
    ASSERT_EQ(fixtures_[i].size(), fixture_sizes_[i]);
  }

{'fraction_non_alphanumeric': 0.12827461607949414, 'fraction_numerical': 0.015356820234869015, 'mean_word_length': 3.1713747645951034, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 23, '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': '1260052', 'n_tokens_mistral': 788, 'n_tokens_neox': 760, 'n_words': 203}