<commit_before>// Copyright 2014-2015 Project Vogue. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ELANG_LIR_TESTING_LIR_TEST_H_
#define ELANG_LIR_TESTING_LIR_TEST_H_

#include <string>
#include <memory>
#include <vector>

#include "base/macros.h"
#include "base/strings/string_piece.h"
#include "elang/base/float_types.h"
#include "elang/lir/factory_user.h"
#include "elang/lir/printer_generic.h"
#include "elang/lir/value.h"
#include "gtest/gtest.h"

namespace elang {
namespace lir {
class Editor;
class Factory;
class Function;
class Literal;
struct Value;
namespace testing {

//////////////////////////////////////////////////////////////////////
//
// LirTest offers LIR factories.
//
class LirTest : public ::testing::Test, public FactoryUser {
 protected:
  LirTest();
  ~LirTest() override;

  // Returns instruction dump with register allocation results for |function|.
  std::string LirTest::Allocate(Function* function);

  // Returns validation results as string after calling |Editor::Commit()|.
  std::string Commit(Editor* editor);

  // Returns virtual registers in |function|.
  std::vector<Value> CollectRegisters(const Function* function);

  // TODO(eval1749) Should we move |Run<Pass>()| somewhere?
  // Note: |::testing::Test| also defines |Run<T>()|.
  template <typename Pass>
  void Run(Editor* editor) {<commit_msg>elang/lir/testing: Tidy up "elang/lir/testing/lir_test.h".<commit_after>// Copyright 2014-2015 Project Vogue. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ELANG_LIR_TESTING_LIR_TEST_H_
#define ELANG_LIR_TESTING_LIR_TEST_H_

#include <string>
#include <memory>
#include <vector>

#include "base/macros.h"
#include "base/strings/string_piece.h"
#include "elang/base/float_types.h"
#include "elang/lir/factory_user.h"
#include "elang/lir/printer_generic.h"
#include "elang/lir/value.h"
#include "gtest/gtest.h"

namespace elang {
namespace lir {
class Editor;
class Factory;
class Function;
class Literal;
struct Value;
namespace testing {

//////////////////////////////////////////////////////////////////////
//
// LirTest offers LIR factories.
//
class LirTest : public ::testing::Test, public FactoryUser {
 protected:
  LirTest();
  ~LirTest() override;

  // Returns instruction dump with register allocation results for |function|.
  std::string Allocate(Function* function);

  // Returns validation results as string after calling |Editor::Commit()|.
  std::string Commit(Editor* editor);

  // Returns virtual registers in |function|.
  std::vector<Value> CollectRegisters(const Function* function);

  // TODO(eval1749) Should we move |Run<Pass>()| somewhere?
  // Note: |::testing::Test| also defines |Run<T>()|.
  template <typename Pass>
  void Run(Editor* editor) {
{'fraction_non_alphanumeric': 0.16770186335403728, 'fraction_numerical': 0.008281573498964804, 'mean_word_length': 3.729200652528548, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '1852999', 'n_tokens_mistral': 923, 'n_tokens_neox': 896, 'n_words': 263}