<commit_before>// Copyright (c) 2018 <NAME>, <NAME>, <NAME>

// We are making my contributions/submissions to this project solely in our
// personal capacity and are not conveying any rights to any intellectual
// property of any third parties.

#include "gtest/gtest.h"
#include <Utils/TestUtils.h>

#include <hspp/Managers/GameAgent.h>
#include <hspp/Tasks/BasicTasks/DestroyTask.h>

using namespace Hearthstonepp;

TEST(DestroyTask, GetTaskID)
{
    const BasicTasks::DestroyTask task(EntityType::EMPTY);
    EXPECT_EQ(task.GetTaskID(), +TaskID::DESTROY);
}

TEST(DestroyTask, Run)
{
    GameAgent agent(CardClass::ROGUE, CardClass::DRUID, 1);
    Player& player1 = agent.GetPlayer1();
    Player& player2 = agent.GetPlayer2();

    auto card = TestUtils::GenerateMinionCard("minion1", 1, 1);

    // Destroy Source Minion
    player1.field.emplace_back(new Minion(card));

    BasicTasks::DestroyTask task(EntityType::SOURCE);
    task.source = player1.field[0];

    MetaData result = task.Run(player1);
    EXPECT_EQ(result, MetaData::DESTROY_MINION_SUCCESS);
    EXPECT_EQ(player1.field.size(), static_cast<size_t>(0));

    // Destroy Target Minion
    player2.field.emplace_back(new Minion(card));

    BasicTasks::DestroyTask task2(EntityType::TARGET);
    task2.target = player2.field[0];

    MetaData result2 = task2.Run(player1);
    EXPECT_EQ(result2, MetaData::DESTROY_MINION_SUCCESS);
    EXPECT_EQ(player2.field.size(), static_cast<size_t>(0));

    // Destroy Target Weapon
    Card weaponCard;
    player2.hero->weapon = new Weapon(weaponCard);

    BasicTasks::DestroyTask task3(EntityType::ENEMY_WEAPON);
<commit_msg>test: Apply changes of DestroyTask class<commit_after>// Copyright (c) 2018 <NAME>, <NAME>, <NAME>

// We are making my contributions/submissions to this project solely in our
// personal capacity and are not conveying any rights to any intellectual
// property of any third parties.

#include <Utils/TestUtils.h>
#include "gtest/gtest.h"

#include <hspp/Managers/GameAgent.h>
#include <hspp/Tasks/BasicTasks/DestroyTask.h>

using namespace Hearthstonepp;
using namespace BasicTasks;

TEST(DestroyTask, GetTaskID)
{
    const DestroyTask task(EntityType::EMPTY, nullptr, nullptr);
    EXPECT_EQ(task.GetTaskID(), +TaskID::DESTROY);
}

TEST(DestroyTask, Run)
{
    GameAgent agent(CardClass::ROGUE, CardClass::DRUID, 1);
    Player& player1 = agent.GetPlayer1();
    Player& player2 = agent.GetPlayer2();

    auto card = TestUtils::GenerateMinionCard("minion1", 1, 1);

    // Destroy Source Minion
    player1.field.emplace_back(new Minion(card));

    DestroyTask task(EntityType::SOURCE, player1.field[0], nullptr);

    MetaData result = task.Run(player1);
    EXPECT_EQ(result, MetaData::DESTROY_MINION_SUCCESS);
    EXPECT_EQ(player1.field.size(), static_cast<size_t>(0));

    // Destroy Target Minion
    player2.field.emplace_back(new Minion(card));

    DestroyTask task2(EntityType::TARGET, nullptr, player2.field[0]);

    MetaData result2 = task2.Run(player1);
    EXPECT_EQ(result2, MetaData::DESTROY_MINION_SUCCESS);
    EXPECT_EQ(player2.field.size(), static_cast<size_t>(0));

    // Destroy Target Weapon
    Card weaponCard;
    player2.hero->weapon = new Weapon(weaponCard);

    DestroyTask task3(EntityType::ENEMY_WEAPON, nullptr, nullptr);

{'fraction_non_alphanumeric': 0.1265899454875833, 'fraction_numerical': 0.018473652331920047, 'mean_word_length': 4.784588441330998, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, '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': '2363858', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1080, 'n_words': 234}