<commit_before>#include <thread>

#include <boost/asio.hpp>

#include <blackhole/trace.hpp>

#include "global.hpp"
#include "mocks/trace.hpp"

TEST(Context, Initiating) {
    auto& distribution = random_t<mock::distribution_t>::instance().distribution();
    EXPECT_CALL(distribution, next())
            .Times(1)
            .WillOnce(Return(42));

    EXPECT_EQ(0, this_thread::current_span().trace);
    EXPECT_EQ(0, this_thread::current_span().span);
    EXPECT_EQ(0, this_thread::current_span().parent);

    trace::context_t<random_t<mock::distribution_t>> context;
    EXPECT_EQ(42, this_thread::current_span().trace);
    EXPECT_EQ(42, this_thread::current_span().span);
    EXPECT_EQ(0, this_thread::current_span().parent);
}

TEST(Context, ResetContextAfterLeavingScope) {
    auto& distribution = random_t<mock::distribution_t>::instance().distribution();
    EXPECT_CALL(distribution, next())
            .Times(1)
            .WillOnce(Return(42));

    EXPECT_EQ(0, this_thread::current_span().trace);
    EXPECT_EQ(0, this_thread::current_span().span);<commit_msg>[Unit Testing] Forgotten include added.<commit_after>#include <thread>

#include <boost/asio.hpp>

#include <blackhole/trace.hpp>
#include <blackhole/utils/atomic.hpp>

#include "global.hpp"
#include "mocks/trace.hpp"

TEST(Context, Initiating) {
    auto& distribution = random_t<mock::distribution_t>::instance().distribution();
    EXPECT_CALL(distribution, next())
            .Times(1)
            .WillOnce(Return(42));

    EXPECT_EQ(0, this_thread::current_span().trace);
    EXPECT_EQ(0, this_thread::current_span().span);
    EXPECT_EQ(0, this_thread::current_span().parent);

    trace::context_t<random_t<mock::distribution_t>> context;
    EXPECT_EQ(42, this_thread::current_span().trace);
    EXPECT_EQ(42, this_thread::current_span().span);
    EXPECT_EQ(0, this_thread::current_span().parent);
}

TEST(Context, ResetContextAfterLeavingScope) {
    auto& distribution = random_t<mock::distribution_t>::instance().distribution();
    EXPECT_CALL(distribution, next())
            .Times(1)
            .WillOnce(Return(42));

    EXPECT_EQ(0, this_thread::current_span().trace);
    EXPECT_EQ(0, this_thread::current_span().span);
{'fraction_non_alphanumeric': 0.15782374100719423, 'fraction_numerical': 0.014388489208633094, 'mean_word_length': 5.029810298102981, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, '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': '1415401', 'n_tokens_mistral': 735, 'n_tokens_neox': 720, 'n_words': 97}