<commit_before>#include "gtest/gtest.h"

#include "PrologInterface.h"

#include <sstream>

static int glob_argc;
static char **glob_argv;

namespace {

class PrologFunctorTest : public ::testing::Test {
  virtual void SetUp() {
    PrologLifetime::begin(glob_argc, glob_argv);
  }

  virtual void TearDown() {
    PrologLifetime::end();
  }
};

TEST_F(PrologFunctorTest, Arity) {
  PrologFunctor functor(
      "f", PrologTermVector({PrologAtom::fromString("atom")}));
  ASSERT_EQ(functor.arity(), 1);
}

TEST_F(PrologFunctorTest, Name) {
  PrologFunctor functor(
      "f", PrologTermVector({PrologAtom::fromString("atom")}));
  ASSERT_EQ(functor.name(), "f");
}

TEST_F(PrologFunctorTest, Args) {
  PrologFunctor functor(
      "f", PrologTermVector(
          {PrologAtom::fromString("atom"), PrologString("string")}));
  PrologTermVector args = functor.args();
  ASSERT_EQ(functor.arity(), 2);
  ASSERT_EQ(args.size(), 2);
  ASSERT_EQ(args.at(0).asAtom().getAtomStr(), "atom");
  ASSERT_EQ(args.at(1).asString().getStr(), "string");
}

}

int main(int argc, char **argv) {
  ::testing::InitGoogleTest(&argc, argv);
  glob_argc = argc;
  glob_argv = argv;
  return RUN_ALL_TESTS();
}
<commit_msg>Add tests for the printing of PrologFunctors<commit_after>#include "gtest/gtest.h"

#include "PrologInterface.h"

#include <sstream>

static int glob_argc;
static char **glob_argv;

namespace {

class PrologFunctorTest : public ::testing::Test {
  virtual void SetUp() {
    PrologLifetime::begin(glob_argc, glob_argv);
  }

  virtual void TearDown() {
    PrologLifetime::end();
  }
};

TEST_F(PrologFunctorTest, Arity) {
  PrologFunctor functor(
      "f", PrologTermVector({PrologAtom::fromString("atom")}));
  ASSERT_EQ(functor.arity(), 1);
}

TEST_F(PrologFunctorTest, Name) {
  PrologFunctor functor(
      "f", PrologTermVector({PrologAtom::fromString("atom")}));
  ASSERT_EQ(functor.name(), "f");
}

TEST_F(PrologFunctorTest, Args) {
  PrologFunctor functor(
      "f", PrologTermVector(
          {PrologAtom::fromString("atom"), PrologString("string")}));
  PrologTermVector args = functor.args();
  ASSERT_EQ(functor.arity(), 2);
  ASSERT_EQ(args.size(), 2);
  ASSERT_EQ(args.at(0).asAtom().getAtomStr(), "atom");
  ASSERT_EQ(args.at(1).asString().getStr(), "string");
}

TEST_F(PrologFunctorTest, PrintOstreamOneArg) {
  std::stringstream ss;
  ss << PrologFunctor("f", PrologTermVector({PrologAtom::fromString("atom")}));
  ASSERT_EQ(ss.str(), "f(atom)");
}

TEST_F(PrologFunctorTest, PrintOstreamTwoArgs) {
  std::stringstream ss;
  ss << PrologFunctor("f", PrologTermVector(
      {PrologAtom::fromString("atom"), PrologString("string")}));
  ASSERT_EQ(ss.str(), "f(atom, \"string\")");
}

}

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

{'fraction_non_alphanumeric': 0.17257102770957558, 'fraction_numerical': 0.00350754121360926, 'mean_word_length': 5.4818181818181815, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '7631001', 'n_tokens_mistral': 1070, 'n_tokens_neox': 1062, 'n_words': 175}