<commit_before>#include "gtest/gtest.h"

#include <stack>

// HanoiTower objects

class HanoiTower
{
  std::stack<unsigned int> towers[3];

public:
  HanoiTower() = delete;
  HanoiTower(HanoiTower const&) = delete;
  HanoiTower(HanoiTower&&) = delete;
  HanoiTower& operator=(HanoiTower const&) = delete;
  HanoiTower& operator=(HanoiTower&&) = delete;

  HanoiTower(const unsigned short height) : towers()
  {
    for (unsigned short i = 0 ; i != height ; ++i)
    {
      towers[0].push(height -i);
    }
  }

  std::size_t height_of(const std::size_t tower_id) const
  {
    EXPECT_TRUE(tower_id < 3);
    return towers[tower_id].size();
  }

  unsigned int head_of(const std::size_t tower_id) const
  {
    EXPECT_TRUE(tower_id < 3);
    return towers[tower_id].top();
  }

  void move(const std::size_t dest, const std::size_t from)
  {
    ASSERT_TRUE(dest < 3);
    ASSERT_TRUE(from < 3);
    ASSERT_TRUE(dest != from);
    ASSERT_FALSE(towers[from].empty());
    ASSERT_TRUE(towers[dest].empty() || towers[dest].top() > towers[from].top());

    towers[dest].push(towers[from].top());
    towers[from].pop();
  }

  void assert_done()
  {
    ASSERT_TRUE(towers[0].empty());
    ASSERT_TRUE(towers[1].empty());
    ASSERT_FALSE(towers[2].empty()); //by implementation it contains all the disks
  }
};

// Algorithm to be tested

// In-place

void hanoi_recurse(HanoiTower& tower)
{
}

inline void hanoi(HanoiTower& tower)
{
  #define ALGO HanoiTowers_DEFAULT
  return hanoi_recurse(tower);
}

// Running tests

TEST(ALGO, NoTower)
{
  HanoiTower tower(0);
  hanoi(tower);
  tower.assert_done();
}

TEST(ALGO, OneDisk)
{
  HanoiTower tower(1);
  hanoi(tower);
  tower.assert_done();
}

TEST(ALGO, TwoDisks)
{
  HanoiTower tower(2);
  hanoi(tower);
  tower.assert_done();
}

TEST(ALGO, FiveDisks)
{
  HanoiTower tower(5);
  hanoi(tower);
  tower.assert_done();
}

int main(int argc, char **argv)
{
  ::testing::InitGoogleTest(&argc, argv);
  int ret { RUN_ALL_TESTS() };
  return ret;
}

<commit_msg>[algorithms/recurse/hanoi-towers] Remove unecessary comment<commit_after>#include "gtest/gtest.h"

#include <stack>

// HanoiTower objects

class HanoiTower
{
  std::stack<unsigned int> towers[3];

public:
  HanoiTower() = delete;
  HanoiTower(HanoiTower const&) = delete;
  HanoiTower(HanoiTower&&) = delete;
  HanoiTower& operator=(HanoiTower const&) = delete;
  HanoiTower& operator=(HanoiTower&&) = delete;

  HanoiTower(const unsigned short height) : towers()
  {
    for (unsigned short i = 0 ; i != height ; ++i)
    {
      towers[0].push(height -i);
    }
  }

  std::size_t height_of(const std::size_t tower_id) const
  {
    EXPECT_TRUE(tower_id < 3);
    return towers[tower_id].size();
  }

  unsigned int head_of(const std::size_t tower_id) const
  {
    EXPECT_TRUE(tower_id < 3);
    return towers[tower_id].top();
  }

  void move(const std::size_t dest, const std::size_t from)
  {
    ASSERT_TRUE(dest < 3);
    ASSERT_TRUE(from < 3);
    ASSERT_TRUE(dest != from);
    ASSERT_FALSE(towers[from].empty());
    ASSERT_TRUE(towers[dest].empty() || towers[dest].top() > towers[from].top());

    towers[dest].push(towers[from].top());
    towers[from].pop();
  }

  void assert_done()
  {
    ASSERT_TRUE(towers[0].empty());
    ASSERT_TRUE(towers[1].empty());
    ASSERT_FALSE(towers[2].empty()); //by implementation it contains all the disks
  }
};

// Algorithm to be tested

void hanoi_recurse(HanoiTower& tower)
{
}

inline void hanoi(HanoiTower& tower)
{
  #define ALGO HanoiTowers_DEFAULT
  return hanoi_recurse(tower);
}

// Running tests

TEST(ALGO, NoTower)
{
  HanoiTower tower(0);
  hanoi(tower);
  tower.assert_done();
}

TEST(ALGO, OneDisk)
{
  HanoiTower tower(1);
  hanoi(tower);
  tower.assert_done();
}

TEST(ALGO, TwoDisks)
{
  HanoiTower tower(2);
  hanoi(tower);
  tower.assert_done();
}

TEST(ALGO, FiveDisks)
{
  HanoiTower tower(5);
  hanoi(tower);
  tower.assert_done();
}

int main(int argc, char **argv)
{
  ::testing::InitGoogleTest(&argc, argv);
  int ret { RUN_ALL_TESTS() };
  return ret;
}


{'fraction_non_alphanumeric': 0.1557478368355995, 'fraction_numerical': 0.0069221260815822, 'mean_word_length': 4.0638297872340425, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 9, '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': '1872682', 'n_tokens_mistral': 1677, 'n_tokens_neox': 1582, 'n_words': 294}