<commit_before>// ========================================================================== //
// This file is part of DO++, a basic set of libraries in C++ for computer 
// vision.
//
// Copyright (C) 2013 <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla Public 
// License v. 2.0. If a copy of the MPL was not distributed with this file, 
// you can obtain one at http://mozilla.org/MPL/2.0/.
// ========================================================================== //

#include "gtest/gtest.h"
#include "MultiArrayTestingFunctions.hpp"

template <typename T, int N, int StorageOrder>
void testMultiArrayDefaultConstructor()
{
  typedef MultiArray<T, N, StorageOrder> NDArray;
  NDArray ndarray;
  ASSERT_EQ(ndarray.data(), ndarray.begin());
  ASSERT_EQ(ndarray.begin(), ndarray.end());
  ASSERT_EQ(ndarray.sizes(), NDArray::coords_type::Zero());
}

template <typename T, int N, int StorageOrder>
MultiArray<T, N, StorageOrder> foo()
{ return MultiArray<T, N, StorageOrder>(MultiArray<T, N, StorageOrder>::coords_type::Ones()); }

template <typename T, int N, int StorageOrder>
void testMultiArrayCopyConstructor()
{
  typedef MultiArray<T, N, StorageOrder> NDArray;
  typedef NDArray::vector_type Coords;
  Coords sizes(Coords::Ones()*5);
  for (int i = 1; i < sizes.size(); ++i)
    sizes(i) = sizes(i-1)*2;

  NDArray array1(sizes);
  array1.array().fill(1);

  NDArray array2(array1);
  array2.array() *= T(2);

  for (int i = 0; i < array1.array().size(); ++i)
  {
    ASSERT_EQ(array1.array()(i), 1);
    ASSERT_EQ(array2.array()(i), 2);
  }

  array1 = foo<T,N,StorageOrder>();
}

template <typename T, int N, int StorageOrder>
void testMultiArrayAll()
{
  testMultiArrayDefaultConstructor<T, N, StorageOrder>();
  testMultiArrayCopyConstructor<T, N, StorageOrder>();
}

template <class ChannelType>
class MultiArrayTest : public testing::Test
{
protected:
  typedef testing::Test Base;
  MultiArrayTest() : Base() {}
};

typedef testing::Types<
  /*uchar, ushort, uint, char, short, int, float, double,
  Vector2i, Vector2f, Vector2d, Vector2cf, Vector2cd,
  Vector3i, Vector3f, Vector3d, Vector3cf, Vector3cd,
  Vector4i, Vector4f, Vector4d, Vector4cf, Vector4cd*/
  int
> ArrayElementTypes;

TYPED_TEST_CASE_P(MultiArrayTest);

TYPED_TEST_P(MultiArrayTest, multiArrayTest)
{
  typedef TypeParam T;

  testMultiArrayAll<T, 2, RowMajor>();
}

REGISTER_TYPED_TEST_CASE_P(MultiArrayTest, multiArrayTest);

INSTANTIATE_TYPED_TEST_CASE_P(DO_Core_Test, MultiArrayTest, ArrayElementTypes);

int main(int argc, char** argv) 
{
  testing::InitGoogleTest(&argc, argv); 
  return RUN_ALL_TESTS();
}<commit_msg>Compile fix with Clang<commit_after>// ========================================================================== //
// This file is part of DO++, a basic set of libraries in C++ for computer 
// vision.
//
// Copyright (C) 2013 <NAME> <<EMAIL>>
//
// This Source Code Form is subject to the terms of the Mozilla Public 
// License v. 2.0. If a copy of the MPL was not distributed with this file, 
// you can obtain one at http://mozilla.org/MPL/2.0/.
// ========================================================================== //

#include "gtest/gtest.h"
#include "MultiArrayTestingFunctions.hpp"

template <typename T, int N, int StorageOrder>
void testMultiArrayDefaultConstructor()
{
  typedef MultiArray<T, N, StorageOrder> NDArray;
  NDArray ndarray;
  ASSERT_EQ(ndarray.data(), ndarray.begin());
  ASSERT_EQ(ndarray.begin(), ndarray.end());
  ASSERT_EQ(ndarray.sizes(), NDArray::coords_type::Zero());
}

template <typename T, int N, int StorageOrder>
MultiArray<T, N, StorageOrder> foo()
{ return MultiArray<T, N, StorageOrder>(MultiArray<T, N, StorageOrder>::coords_type::Ones()); }

template <typename T, int N, int StorageOrder>
void testMultiArrayCopyConstructor()
{
  typedef MultiArray<T, N, StorageOrder> NDArray;
  typedef typename NDArray::vector_type Coords;
  Coords sizes(Coords::Ones()*5);
  for (int i = 1; i < sizes.size(); ++i)
    sizes(i) = sizes(i-1)*2;

  NDArray array1(sizes);
  array1.array().fill(1);

  NDArray array2(array1);
  array2.array() *= T(2);

  for (int i = 0; i < array1.array().size(); ++i)
  {
    ASSERT_EQ(array1.array()(i), 1);
    ASSERT_EQ(array2.array()(i), 2);
  }

  array1 = foo<T,N,StorageOrder>();
}

template <typename T, int N, int StorageOrder>
void testMultiArrayAll()
{
  testMultiArrayDefaultConstructor<T, N, StorageOrder>();
  testMultiArrayCopyConstructor<T, N, StorageOrder>();
}

template <class ChannelType>
class MultiArrayTest : public testing::Test
{
protected:
  typedef testing::Test Base;
  MultiArrayTest() : Base() {}
};

typedef testing::Types<
  /*uchar, ushort, uint, char, short, int, float, double,
  Vector2i, Vector2f, Vector2d, Vector2cf, Vector2cd,
  Vector3i, Vector3f, Vector3d, Vector3cf, Vector3cd,
  Vector4i, Vector4f, Vector4d, Vector4cf, Vector4cd*/
  int
> ArrayElementTypes;

TYPED_TEST_CASE_P(MultiArrayTest);

TYPED_TEST_P(MultiArrayTest, multiArrayTest)
{
  typedef TypeParam T;

  testMultiArrayAll<T, 2, RowMajor>();
}

REGISTER_TYPED_TEST_CASE_P(MultiArrayTest, multiArrayTest);

INSTANTIATE_TYPED_TEST_CASE_P(DO_Core_Test, MultiArrayTest, ArrayElementTypes);

int main(int argc, char** argv) 
{
  testing::InitGoogleTest(&argc, argv); 
  return RUN_ALL_TESTS();
}
{'fraction_non_alphanumeric': 0.1906015037593985, 'fraction_numerical': 0.015789473684210527, 'mean_word_length': 5.403128760529483, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 39, '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': '6862046', 'n_tokens_mistral': 1832, 'n_tokens_neox': 1758, 'n_words': 454}