<commit_before>/*
 * Copyright 2016 <NAME>, <EMAIL>
 * All rights reserved. Distributed under the terms of the MIT License.
 */

#ifndef TESTS_MOCK_DATABASE_SQLITE_WRAPPER_H
#define TESTS_MOCK_DATABASE_SQLITE_WRAPPER_H

#include "src/database/detail/sqlite_wrapper_interface.h"

#include <memory>
#include <gmock/gmock.h>

namespace mock
{

namespace database
{

class SQLiteWrapper : public ::database::detail::SQLiteWrapperInterface {
 public:
  virtual ~SQLiteWrapper() = default;

  MOCK_METHOD1(Open, void(const std::string &file_path));
  MOCK_METHOD0(IsOpen, bool());
  MOCK_METHOD0(Close, bool());

  MOCK_METHOD2(Prepare, void(const std::string &sql, sqlite3_stmt **ppStmt));

  MOCK_METHOD3(BindDouble, void(sqlite3_stmt *pStmt, int pos, double value));
  MOCK_METHOD3(BindInt, void(sqlite3_stmt *pStmt, int pos, int value));
  MOCK_METHOD3(BindInt64, void(sqlite3_stmt *pStmt, int pos, sqlite3_int64 value));
  MOCK_METHOD3(BindText, void(sqlite3_stmt *pStmt, int pos, const std::string &value));

  MOCK_METHOD2(ColumnDouble, double(sqlite3_stmt *pStmt, int iCol));
  MOCK_METHOD2(ColumnInt, int(sqlite3_stmt *pStmt, int iCol));
  MOCK_METHOD2(ColumnInt64, sqlite3_int64(sqlite3_stmt *pStmt, int iCol));
  MOCK_METHOD2(ColumnText, const std::string(sqlite3_stmt *pStmt, int iCol));

  MOCK_METHOD1(Step, int(sqlite3_stmt *pStmt));
  MOCK_METHOD1(Finalize, void(sqlite3_stmt *pStmt));

  MOCK_METHOD3(Exec, void(const std::string &sql, int (*callback) (void *, int, char **, char **), void *arg));

  MOCK_METHOD0(GetSQLiteHandle, sqlite3*());
};

typedef std::shared_ptr<SQLiteWrapper> SQLiteWrapperPtr;

}

}

#endif /* TESTS_MOCK_DATABASE_SQLITE_WRAPPER_H */<commit_msg>Add Create function to SQLiteWrapper mock class<commit_after>/*
 * Copyright 2016 <NAME>, <EMAIL>
 * All rights reserved. Distributed under the terms of the MIT License.
 */

#ifndef TESTS_MOCK_DATABASE_SQLITE_WRAPPER_H
#define TESTS_MOCK_DATABASE_SQLITE_WRAPPER_H

#include "src/database/detail/sqlite_wrapper_interface.h"

#include <memory>
#include <gmock/gmock.h>

namespace mock
{

namespace database
{

class SQLiteWrapper;
typedef std::shared_ptr<SQLiteWrapper> SQLiteWrapperPtr;

class SQLiteWrapper : public ::database::detail::SQLiteWrapperInterface {
 public:
  virtual ~SQLiteWrapper() = default;

  static SQLiteWrapperPtr Create() {
    return std::make_shared<SQLiteWrapper>();
  }

  MOCK_METHOD1(Open, void(const std::string &file_path));
  MOCK_METHOD0(IsOpen, bool());
  MOCK_METHOD0(Close, bool());

  MOCK_METHOD2(Prepare, void(const std::string &sql, sqlite3_stmt **ppStmt));

  MOCK_METHOD3(BindDouble, void(sqlite3_stmt *pStmt, int pos, double value));
  MOCK_METHOD3(BindInt, void(sqlite3_stmt *pStmt, int pos, int value));
  MOCK_METHOD3(BindInt64, void(sqlite3_stmt *pStmt, int pos, sqlite3_int64 value));
  MOCK_METHOD3(BindText, void(sqlite3_stmt *pStmt, int pos, const std::string &value));

  MOCK_METHOD2(ColumnDouble, double(sqlite3_stmt *pStmt, int iCol));
  MOCK_METHOD2(ColumnInt, int(sqlite3_stmt *pStmt, int iCol));
  MOCK_METHOD2(ColumnInt64, sqlite3_int64(sqlite3_stmt *pStmt, int iCol));
  MOCK_METHOD2(ColumnText, const std::string(sqlite3_stmt *pStmt, int iCol));

  MOCK_METHOD1(Step, int(sqlite3_stmt *pStmt));
  MOCK_METHOD1(Finalize, void(sqlite3_stmt *pStmt));

  MOCK_METHOD3(Exec, void(const std::string &sql, int (*callback) (void *, int, char **, char **), void *arg));

  MOCK_METHOD0(GetSQLiteHandle, sqlite3*());
};

}

}

#endif /* TESTS_MOCK_DATABASE_SQLITE_WRAPPER_H */
{'fraction_non_alphanumeric': 0.12589005981201937, 'fraction_numerical': 0.023924807747080605, 'mean_word_length': 6.927765237020316, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, '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': '7381119', 'n_tokens_mistral': 1322, 'n_tokens_neox': 1298, 'n_words': 267}