<commit_before>/**
 *  @autors tekatod, arssivka
 *  @date 2/13/17
 */

#include <gtest/gtest.h>
#include <rrc/rrc.h>

using namespace rrc;

class service_holder_fixture
        : public ::testing::Test {
protected:

    virtual void SetUp() override {
        m_flage = false;
        m_toli_esho_budet = false;
        m_message = shared_buffer("meow!");
        m_callback = service_callback(
                [this](const shared_buffer& in, shared_buffer& out) -> status {
            m_flage = true;
            out = in;
            out[0] = 'M';
            return status::success;
        });
        m_listener = service_result_callback(
                [this](status status, const shared_buffer& msg) {
                    m_toli_esho_budet = status::success == status;
                    m_message = msg;
                    m_message[1] = 'E';
                }
        );
    }

    virtual void TearDown() override {
    }


protected:
    bool m_flage; // it's not a mistake! O_O
    bool m_toli_esho_budet;
    service_callback m_callback;
    service_result_callback m_listener;
    shared_buffer m_message;
    service_holder m_holder;
};


TEST_F(service_holder_fixture, add_service) {
    EXPECT_TRUE(m_callback.unique());
    m_holder.add_service("fuck", m_callback);
    EXPECT_EQ(m_callback.use_count(), 2);
}

TEST_F(service_holder_fixture, remove_service) {
    EXPECT_TRUE(m_callback.unique());
    m_holder.add_service("fuck", m_callback);
    EXPECT_EQ(m_callback.use_count(), 2);
    m_holder.remove_service(m_callback);<commit_msg>Service holder test fix<commit_after>/**
 *  @autors tekatod, arssivka
 *  @date 2/13/17
 */

#include <gtest/gtest.h>
#include <rrc/rrc.h>

using namespace rrc;

class service_holder_fixture
        : public ::testing::Test {
protected:

    virtual void SetUp() override {
        m_flage = false;
        m_toli_esho_budet = false;
        m_message = shared_buffer("meow!");
        m_callback = service_callback(
                [this](const shared_buffer& in, shared_buffer& out) -> status {
            m_flage = true;
            out = in;
            out[0] = 'M';
            return status::success;
        });
        m_listener = service_result_callback(
                [this](status stat, const shared_buffer& msg) {
                    m_toli_esho_budet = status::success == stat;
                    m_message = msg;
                    m_message[1] = 'E';
                }
        );
    }

    virtual void TearDown() override {
    }


protected:
    bool m_flage; // it's not a mistake! O_O
    bool m_toli_esho_budet;
    service_callback m_callback;
    service_result_callback m_listener;
    shared_buffer m_message;
    service_holder m_holder;
};


TEST_F(service_holder_fixture, add_service) {
    EXPECT_TRUE(m_callback.unique());
    m_holder.add_service("fuck", m_callback);
    EXPECT_EQ(m_callback.use_count(), 2);
}

TEST_F(service_holder_fixture, remove_service) {
    EXPECT_TRUE(m_callback.unique());
    m_holder.add_service("fuck", m_callback);
    EXPECT_EQ(m_callback.use_count(), 2);
    m_holder.remove_service(m_callback);
{'fraction_non_alphanumeric': 0.10997442455242967, 'fraction_numerical': 0.005754475703324808, 'mean_word_length': 2.4844097995545655, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7038480', 'n_tokens_mistral': 1050, 'n_tokens_neox': 1025, 'n_words': 192}