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

#include "json/json_spirit_reader_template.h"
#include "json/json_spirit_writer_template.h"
#include "json/json_spirit_utils.h"

#include "base58.h"
#include "util.h"

#include <boost/algorithm/hex.hpp>

using namespace json_spirit;
extern Array read_json(const std::string& filename);

// Goal: test low-level base58 encoding functionality
TEST(base58_tests, base58_EncodeBase58)
{
    Array tests = read_json("base58_encode_decode.json");

    BOOST_FOREACH(Value& tv, tests)
    {
        Array test = tv.get_array();
        std::string strTest = write_string(tv, false);
        if (test.size() < 2) // Allow for extra stuff (useful for comments)
        {
            ADD_FAILURE() << "Bad test: " << strTest;
            continue;
        }
        std::vector<unsigned char> sourcedata = ParseHex(test[0].get_str());
        std::string base58string = test[1].get_str();
        EXPECT_TRUE(EncodeBase58(&sourcedata[0], &sourcedata[sourcedata.size()]) == base58string) << strTest;<commit_msg>Removed unnecessary include<commit_after>#include "googletest/googletest/include/gtest/gtest.h"

#include "json/json_spirit_reader_template.h"
#include "json/json_spirit_writer_template.h"
#include "json/json_spirit_utils.h"

#include "base58.h"
#include "util.h"

using namespace json_spirit;
extern Array read_json(const std::string& filename);

// Goal: test low-level base58 encoding functionality
TEST(base58_tests, base58_EncodeBase58)
{
    Array tests = read_json("base58_encode_decode.json");

    BOOST_FOREACH(Value& tv, tests)
    {
        Array test = tv.get_array();
        std::string strTest = write_string(tv, false);
        if (test.size() < 2) // Allow for extra stuff (useful for comments)
        {
            ADD_FAILURE() << "Bad test: " << strTest;
            continue;
        }
        std::vector<unsigned char> sourcedata = ParseHex(test[0].get_str());
        std::string base58string = test[1].get_str();
        EXPECT_TRUE(EncodeBase58(&sourcedata[0], &sourcedata[sourcedata.size()]) == base58string) << strTest;
{'fraction_non_alphanumeric': 0.1320754716981132, 'fraction_numerical': 0.020754716981132074, 'mean_word_length': 3.8983833718244805, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 6, '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': '326551', 'n_tokens_mistral': 729, 'n_tokens_neox': 685, 'n_words': 137}