<commit_before>// Copyright (c) 2015-2016 <NAME> (at gmail dot com)
// This file is distributed under the MIT License.

#include "ofp/protocoliterator.h"
#include "ofp/unittest.h"

using namespace ofp;

TEST(protocoliterator, ProtocolRangeItemCount) {
  UInt64 buffer;
  ByteRange data{&buffer, 0UL};
  const size_t unused = ~0UL;

  EXPECT_EQ(
      0, detail::ProtocolRangeItemCount(8, data, PROTOCOL_ITERATOR_SIZE_FIXED));

  for (size_t offset = 0; offset < 32; offset += 2) {
    EXPECT_EQ(0, detail::ProtocolRangeItemCount(unused, data, offset));
  }
}

TEST(protocoliterator, ProtocolRangeSplitOffset) {
  UInt64 buffer = 0;
  ByteRange data{&buffer, 0UL};
  const size_t unused = ~0UL;

  EXPECT_EQ(0, detail::ProtocolRangeSplitOffset(8, unused, data, 0));

  *Big16_cast(&buffer) = 8;
  ByteRange data8{&buffer, sizeof(buffer)};
  EXPECT_EQ(8, detail::ProtocolRangeSplitOffset(8, unused, data8, 0));
}<commit_msg>Fix ambiguity for 32-bit gcc.<commit_after>// Copyright (c) 2015-2016 <NAME> (at gmail dot com)
// This file is distributed under the MIT License.

#include "ofp/protocoliterator.h"
#include "ofp/unittest.h"

using namespace ofp;

TEST(protocoliterator, ProtocolRangeItemCount) {
  UInt64 buffer;
  ByteRange data{&buffer, static_cast<size_t>(0)};
  const size_t unused = ~0UL;

  EXPECT_EQ(
      0, detail::ProtocolRangeItemCount(8, data, PROTOCOL_ITERATOR_SIZE_FIXED));

  for (size_t offset = 0; offset < 32; offset += 2) {
    EXPECT_EQ(0, detail::ProtocolRangeItemCount(unused, data, offset));
  }
}

TEST(protocoliterator, ProtocolRangeSplitOffset) {
  UInt64 buffer = 0;
  ByteRange data{&buffer, static_cast<size_t>(0)};
  const size_t unused = ~0UL;

  EXPECT_EQ(0, detail::ProtocolRangeSplitOffset(8, unused, data, 0));

  *Big16_cast(&buffer) = 8;
  ByteRange data8{&buffer, sizeof(buffer)};
  EXPECT_EQ(8, detail::ProtocolRangeSplitOffset(8, unused, data8, 0));
}
{'fraction_non_alphanumeric': 0.13171759747102213, 'fraction_numerical': 0.037934668071654375, 'mean_word_length': 5.351170568561873, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '3418128', 'n_tokens_mistral': 703, 'n_tokens_neox': 659, 'n_words': 162}