<commit_before>//
// Copyright (c) 2017 <NAME> <<EMAIL>>
// Copyright 2017 <NAME> <<EMAIL>>
// Copyright 2017 Capitar IT Group BV <<EMAIL>>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
// file was obtained (LICENSE.txt).  A copy of the license may also be
// found online at https://opensource.org/licenses/MIT.
//

#include <catch.hpp>

#include <nngcpp.h>

#include <string>
#include <chrono>
#include <ostream>

CATCH_TRANSLATE_EXCEPTION(nng::nng_exception& ex) {
    // TODO: TBD: consider making this a part of the nng::nng_exception::what method...
    std::ostringstream os;
    const auto errnum = to_int(ex.error_code);
    os << "nng::nng_exception: " << "error_code = " << errnum;
    return os.str();
}

namespace constants {
    const std::string dev1_addr = "inproc://dev1";
    const std::string dev2_addr = "inproc://dev2";
}

#define CAST_DURATION_TO_USEC std::chrono::duration_cast<microseconds>

TEST_CASE("Test that device functions properly", "[device]") {

    using namespace Catch;
    using namespace Catch::Matchers;
    using namespace std;
    using namespace std::chrono;
    using namespace nng;
    using namespace nng::protocol;
    using namespace constants;
    using _opt_ = option_names;

    session _session_;

    SECTION("nng::protocol::v1::pair_socket based device functions properly") {

		SECTION("We can create a nng::protocol::v1::pair_socket device") {

            shared_ptr<latest_pair_socket> sp1, sp2;

            REQUIRE_NOTHROW(sp1 = _session_.create_pair_socket());
            REQUIRE_NOTHROW(sp2 = _session_.create_pair_socket());<commit_msg>re-factored bits of code to the headers<commit_after>//
// Copyright (c) 2017 <NAME> <<EMAIL>>
// Copyright 2017 <NAME> <<EMAIL>>
// Copyright 2017 Capitar IT Group BV <<EMAIL>>
//
// This software is supplied under the terms of the MIT License, a
// copy of which should be located in the distribution where this
// file was obtained (LICENSE.txt).  A copy of the license may also be
// found online at https://opensource.org/licenses/MIT.
//

#include <catch.hpp>

#include <nngcpp.h>

#include <string>
#include <chrono>
#include <ostream>

#include "../catch/catch_exception_translations.hpp"

namespace constants {
    const std::string dev1_addr = "inproc://dev1";
    const std::string dev2_addr = "inproc://dev2";
}

#define CAST_DURATION_TO_USEC std::chrono::duration_cast<microseconds>

TEST_CASE("Test that device functions properly", "[device]") {

    using namespace Catch;
    using namespace Catch::Matchers;
    using namespace std;
    using namespace std::chrono;
    using namespace nng;
    using namespace nng::protocol;
    using namespace constants;
    using _opt_ = option_names;

    session _session_;

    SECTION("nng::protocol::v1::pair_socket based device functions properly") {

		SECTION("We can create a nng::protocol::v1::pair_socket device") {

            shared_ptr<latest_pair_socket> sp1, sp2;

            REQUIRE_NOTHROW(sp1 = _session_.create_pair_socket());
            REQUIRE_NOTHROW(sp2 = _session_.create_pair_socket());
{'fraction_non_alphanumeric': 0.12029123140234252, 'fraction_numerical': 0.013928458372902817, 'mean_word_length': 3.9144634525660966, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 33, 'https://': 2, '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': '3493294', 'n_tokens_mistral': 1020, 'n_tokens_neox': 972, 'n_words': 290}