<commit_before>#include <boost/detail/lightweight_test.hpp>
#include <iostream>
#include <mapnik/image_reader.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/util/fs.hpp>
#include <vector>
#include <algorithm>

#include "utils.hpp"

int main(int argc, char** argv)
{
    std::vector<std::string> args;
    for (int i=1;i<argc;++i)
    {
        args.push_back(argv[i]);
    }
    bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();

    std::string should_throw;
    boost::optional<std::string> type;
    try
    {
        mapnik::image_data_32 im(256,256);
        unsigned char* bytes = im.getBytes();
        mapnik::image_data_32 * im_ptr = new mapnik::image_data_32(im.width(),im.height(),static_cast<mapnik::image_data_32::pixel_type *>(bytes));
        unsigned char* same_bytes = im_ptr->getBytes();
        BOOST_TEST(bytes == same_bytes);
        delete im_ptr;
        BOOST_TEST(bytes == same_bytes);

        BOOST_TEST(set_working_dir(args));

#if defined(HAVE_JPEG)
        should_throw = "./tests/cpp_tests/data/blank.jpg";
        BOOST_TEST( mapnik::util::exists( should_throw ) );
        type = mapnik::type_from_filename(should_throw);
        BOOST_TEST( type );
        try
        {
            std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(should_throw,*type));
            BOOST_TEST( false );
        }
        catch (std::exception const&)
        {
            BOOST_TEST( true );
        }
#endif

#if defined(HAVE_PNG)
        should_throw = "./tests/cpp_tests/data/blank.png";
        BOOST_TEST( mapnik::util::exists( should_throw ) );
        type = mapnik::type_from_filename(should_throw);
        BOOST_TEST( type );
        try
        {
            std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(should_throw,*type));
            BOOST_TEST( false );<commit_msg>dodge linking error with image_data on windows - refs #2396<commit_after>#include <boost/detail/lightweight_test.hpp>
#include <iostream>
#include <mapnik/image_reader.hpp>
#include <mapnik/image_util.hpp>
#include <mapnik/util/fs.hpp>
#include <vector>
#include <algorithm>

#include "utils.hpp"

int main(int argc, char** argv)
{
    std::vector<std::string> args;
    for (int i=1;i<argc;++i)
    {
        args.push_back(argv[i]);
    }
    bool quiet = std::find(args.begin(), args.end(), "-q")!=args.end();

    std::string should_throw;
    boost::optional<std::string> type;
    try
    {
#if !defined(_MSC_VER)
        mapnik::image_data_32 im(256,256);
        mapnik::image_data_32::pixel_type * data = im.getData();
        mapnik::image_data_32 * im_ptr = new mapnik::image_data_32(im.width(),im.height(),data);
        mapnik::image_data_32::pixel_type * same_data = im_ptr->getData();
        BOOST_TEST(data == same_data);
        delete im_ptr;
        BOOST_TEST(data == same_data);
#endif
        BOOST_TEST(set_working_dir(args));

#if defined(HAVE_JPEG)
        should_throw = "./tests/cpp_tests/data/blank.jpg";
        BOOST_TEST( mapnik::util::exists( should_throw ) );
        type = mapnik::type_from_filename(should_throw);
        BOOST_TEST( type );
        try
        {
            std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(should_throw,*type));
            BOOST_TEST( false );
        }
        catch (std::exception const&)
        {
            BOOST_TEST( true );
        }
#endif

#if defined(HAVE_PNG)
        should_throw = "./tests/cpp_tests/data/blank.png";
        BOOST_TEST( mapnik::util::exists( should_throw ) );
        type = mapnik::type_from_filename(should_throw);
        BOOST_TEST( type );
        try
        {
            std::unique_ptr<mapnik::image_reader> reader(mapnik::get_image_reader(should_throw,*type));
            BOOST_TEST( false );
{'fraction_non_alphanumeric': 0.14518674381904262, 'fraction_numerical': 0.009468700683850605, 'mean_word_length': 3.089247311827957, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, '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': '6324606', 'n_tokens_mistral': 1299, 'n_tokens_neox': 1254, 'n_words': 202}