<commit_before>/**
 * file_loader_test.cpp

 *
 *  Created on: Feb 18, 2014
 *      Author: tpan
 */


#include "config.hpp"    // for location of data.

#if defined(USE_MPI)
#include "mpi.h"
#endif

// include google test
#include <gtest/gtest.h>
#include <cstdint> // for uint64_t, etc.
#include <string>

#include "io/file_loader.hpp"

using namespace bliss::io;

template <typename T,
  bool L2Buffering = true,
  bool L1Buffering = false,
  typename L2PartitionerT = bliss::partition::DemandDrivenPartitioner<bliss::partition::range<size_t> >,
  typename L1PartitionerT = bliss::partition::BlockPartitioner<bliss::partition::range<size_t> > >
class TestableFileLoader :
    public bliss::io::FileLoader<T, L2Buffering, L1Buffering, L2PartitionerT, L1PartitionerT,
    void > {
      public:
        using MyType = TestableFileLoader<T, L2Buffering, L1Buffering, L2PartitionerT, L1PartitionerT>;
        using SuperType = bliss::io::FileLoader<T, L2Buffering, L1Buffering, L2PartitionerT, L1PartitionerT,
            void >;


        using L1BlockType = typename SuperType::L1BlockType;
        using L2BlockType = typename SuperType::L2BlockType;
        using RangeType   = typename SuperType::RangeType;

        TestableFileLoader(const MyType& other) = delete;
        /// Removed default copy assignment operator
        TestableFileLoader& operator=(const MyType& other) = delete;
        TestableFileLoader(const std::string &_filename,
                                    const int _nConcurrentLoaders = 1, const int _loaderId = 0,
                                    const size_t _nThreads = 1, const size_t _L2BlockSize = 1 ) throw (bliss::io::IOException) :
                                    SuperType(_nConcurrentLoaders, _loaderId, _filename, _nThreads, _L2BlockSize) {};
#if defined(USE_MPI)
        TestableFileLoader(const std::string &_filename, const MPI_Comm& _comm, const size_t _nThreads = 1, const size_t _L2BlockSize = 1) throw (bliss::io::IOException)
            : SuperType(_filename, _comm, _nThreads, _L2BlockSize) {};
#endif
        TestableFileLoader(MyType&& other) : SuperType(std::forward(other)) {}
        TestableFileLoader& operator=(MyType&& other) {
          return this->SuperType::operator=(std::forward(other));
        }
        virtual ~TestableFileLoader() {};
<commit_msg>FIX: MPI_Comm is defined as int in MPICH and Mac MPI, but not openMPI.  if 'int', then FASTQLoader constructors become ambiguous.  changing the order of the parameters so that filename string occurs at a different place for the 2 constructors<commit_after>/**
 * file_loader_test.cpp

 *
 *  Created on: Feb 18, 2014
 *      Author: tpan
 */


#include "config.hpp"    // for location of data.

#if defined(USE_MPI)
#include "mpi.h"
#endif

// include google test
#include <gtest/gtest.h>
#include <cstdint> // for uint64_t, etc.
#include <string>

#include "io/file_loader.hpp"

using namespace bliss::io;

template <typename T,
  bool L2Buffering = true,
  bool L1Buffering = false,
  typename L2PartitionerT = bliss::partition::DemandDrivenPartitioner<bliss::partition::range<size_t> >,
  typename L1PartitionerT = bliss::partition::BlockPartitioner<bliss::partition::range<size_t> > >
class TestableFileLoader :
    public bliss::io::FileLoader<T, L2Buffering, L1Buffering, L2PartitionerT, L1PartitionerT,
    void > {
      public:
        using MyType = TestableFileLoader<T, L2Buffering, L1Buffering, L2PartitionerT, L1PartitionerT>;
        using SuperType = bliss::io::FileLoader<T, L2Buffering, L1Buffering, L2PartitionerT, L1PartitionerT,
            void >;


        using L1BlockType = typename SuperType::L1BlockType;
        using L2BlockType = typename SuperType::L2BlockType;
        using RangeType   = typename SuperType::RangeType;

        TestableFileLoader(const MyType& other) = delete;
        /// Removed default copy assignment operator
        TestableFileLoader& operator=(const MyType& other) = delete;
        TestableFileLoader(const int _nConcurrentLoaders = 1, const int _loaderId = 0, const std::string &_filename,
                                    const size_t _nThreads = 1, const size_t _L2BlockSize = 1 ) throw (bliss::io::IOException) :
                                    SuperType(_nConcurrentLoaders, _loaderId, _filename, _nThreads, _L2BlockSize) {};
#if defined(USE_MPI)
        TestableFileLoader(const MPI_Comm& _comm, const std::string &_filename, const size_t _nThreads = 1, const size_t _L2BlockSize = 1) throw (bliss::io::IOException)
            : SuperType(_comm, _filename, _nThreads, _L2BlockSize) {};
#endif
        TestableFileLoader(MyType&& other) : SuperType(std::forward(other)) {}
        TestableFileLoader& operator=(MyType&& other) {
          return this->SuperType::operator=(std::forward(other));
        }
        virtual ~TestableFileLoader() {};

{'fraction_non_alphanumeric': 0.10460078399009697, 'fraction_numerical': 0.015886115122756343, 'mean_word_length': 3.547842401500938, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 5, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4418723', 'n_tokens_mistral': 1545, 'n_tokens_neox': 1477, 'n_words': 363}