<commit_before>#include <archie/utils/fused/holder.h>
#include <archie/utils/test.h>

namespace fused = archie::utils::fused;
namespace traits = archie::utils::traits;

struct type_ {
  type_() = default;
  template <typename Tp>
  explicit type_(Tp t)
      : v{t} {}

  unsigned v = 0;
};

bool operator==(type_ const& lhs, type_ const& rhs) { return lhs.v == rhs.v; }
bool operator<(type_ const& lhs, type_ const& rhs) { return lhs.v < rhs.v; }

void canCreateHolder() {
  auto h = fused::holder<type_>{};
  EXPECT_EQ(0u, h.get().v);
}

void canAssignValueToHolder() {
  static_assert(
      traits::is_equality_comparable<fused::holder<type_>, type_>::value, "");
  static_assert(
      traits::is_less_than_comparable<fused::holder<type_>, type_>::value, "");
  auto h = fused::holder<type_>{3u};
  auto t = type_{5u};
  EXPECT_EQ(3u, h.get().v);
  h = t;
  EXPECT_EQ(5u, h.get().v);
  EXPECT_EQ(h, t);
  t.v = 6u;
  EXPECT_TRUE(h < t);
  h = std::move(t);
  EXPECT_EQ(6u, h.get().v);
}

int main() {
  canCreateHolder();
  canAssignValueToHolder();
  return 0;
}
<commit_msg>compareable test<commit_after>#include <archie/utils/fused/holder.h>
#include <archie/utils/test.h>

namespace fused = archie::utils::fused;
namespace traits = archie::utils::traits;

struct type_ {
  type_() = default;
  template <typename Tp>
  explicit type_(Tp t)
      : v{t} {}

  unsigned v = 0;
};

bool operator==(type_ const& lhs, type_ const& rhs) { return lhs.v == rhs.v; }
bool operator<(type_ const& lhs, type_ const& rhs) { return lhs.v < rhs.v; }

void canCreateHolder() {
  auto h = fused::holder<type_>{};
  EXPECT_EQ(0u, h.get().v);
}

void canAssignValueToHolder() {
  static_assert(
      traits::is_equality_comparable<fused::holder<type_>, type_>::value, "");
  static_assert(
      traits::is_less_than_comparable<fused::holder<type_>, type_>::value, "");
  auto h = fused::holder<type_>{3u};
  auto t = type_{5u};
  EXPECT_EQ(3u, h.get().v);
  h = t;
  EXPECT_EQ(5u, h.get().v);
  EXPECT_EQ(h, t);
  t.v = 6u;
  EXPECT_TRUE(h < t);
  h = std::move(t);
  EXPECT_EQ(6u, h.get().v);
}

void canCompareHolders() {
  static_assert(traits::is_equality_comparable<fused::holder<type_>,
                                               fused::holder<type_>>::value,
                "");
  static_assert(
      traits::is_equality_comparable<fused::holder<type_>, type_>::value, "");

  auto a = fused::holder<type_>{1u};
  auto b = fused::holder<type_>{1u};
  auto c = fused::holder<type_>{2u};
  auto d = type_{1u};
  auto e = type_{0u};

  EXPECT_TRUE(a == b);
  EXPECT_FALSE(a == c);
  EXPECT_TRUE(a == d);
  EXPECT_FALSE(a == e);
}

int main() {
  canCreateHolder();
  canAssignValueToHolder();
  canCompareHolders();
  return 0;
}

{'fraction_non_alphanumeric': 0.17898975109809664, 'fraction_numerical': 0.00841874084919473, 'mean_word_length': 3.9872262773722627, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5600087', 'n_tokens_mistral': 1076, 'n_tokens_neox': 1069, 'n_words': 206}