<commit_before>// __BEGIN_LICENSE__
// Copyright (C) 2006, 2007 United States Government as represented by
// the Administrator of the National Aeronautics and Space Administration.
// All Rights Reserved.
// __END_LICENSE__


// TestDiskImageResource.h
//#define CXXTEST_ABORT_TEST_ON_FAIL
#include <cxxtest/TestSuite.h>
#include <vw/FileIO/DiskImageResource.h>
#include <vw/FileIO/DiskImageResource_internal.h>

#include <vw/config.h>
#include <vw/Image/PixelTypes.h>
#include <vw/Image/ImageView.h>

using namespace vw;
using namespace vw::internal;

using std::string;
using std::set;

template <class PixelT>
static void test_extension(string const& fn)
{
  ImageView<PixelT> img1(1,1), img2;

  try {
    write_image(fn, img1);
    TS_ASSERT_THROWS_NOTHING(read_image(img2, fn));
  } catch (vw::NoImplErr &e) {
    // this doesn't represent a test failure, just a lack of test coverage
    //TS_WARN(string("Failed to test ") + fn + " : " + e.what());
    return;
  }

  TS_ASSERT_EQUALS(img1.cols()        , img2.cols());
  TS_ASSERT_EQUALS(img1.rows()        , img2.rows());
  TS_ASSERT_EQUALS(img1.planes()      , img2.planes());
  TS_ASSERT_EQUALS(img1.channels()    , img2.channels());
  TS_ASSERT_EQUALS(img1.channel_type(), img2.channel_type());
}

class TestDiskImageResource : public CxxTest::TestSuite
{
public:

  void test_write_read_view() {
    set<string> exclude;
    const char *ex_list[] = {"img", "lbl", "pds", "cub"}; // skip the ro PDS formats
    exclude.insert(ex_list, ex_list+4);

    TS_ASSERT_THROWS_NOTHING(foreach_ext(TEST_SRCDIR"/rwtest", test_extension<PixelRGB<float> >,   exclude));
    TS_ASSERT_THROWS_NOTHING(foreach_ext(TEST_SRCDIR"/rwtest", test_extension<PixelRGB<uint8> >,   exclude));<commit_msg>increase image size, since ecw j2k gets mad with smaller image sizes<commit_after>// __BEGIN_LICENSE__
// Copyright (C) 2006, 2007 United States Government as represented by
// the Administrator of the National Aeronautics and Space Administration.
// All Rights Reserved.
// __END_LICENSE__


// TestDiskImageResource.h
//#define CXXTEST_ABORT_TEST_ON_FAIL
#include <cxxtest/TestSuite.h>
#include <vw/FileIO/DiskImageResource.h>
#include <vw/FileIO/DiskImageResource_internal.h>

#include <vw/config.h>
#include <vw/Image/PixelTypes.h>
#include <vw/Image/ImageView.h>

using namespace vw;
using namespace vw::internal;

using std::string;
using std::set;

template <class PixelT>
static void test_extension(string const& fn)
{
  ImageView<PixelT> img1(4,4), img2;

  try {
    write_image(fn, img1);
    TS_ASSERT_THROWS_NOTHING(read_image(img2, fn));
  } catch (vw::NoImplErr &e) {
    // this doesn't represent a test failure, just a lack of test coverage
    //TS_WARN(string("Failed to test ") + fn + " : " + e.what());
    return;
  }

  TS_ASSERT_EQUALS(img1.cols()        , img2.cols());
  TS_ASSERT_EQUALS(img1.rows()        , img2.rows());
  TS_ASSERT_EQUALS(img1.planes()      , img2.planes());
  TS_ASSERT_EQUALS(img1.channels()    , img2.channels());
  TS_ASSERT_EQUALS(img1.channel_type(), img2.channel_type());
}

class TestDiskImageResource : public CxxTest::TestSuite
{
public:

  void test_write_read_view() {
    set<string> exclude;
    const char *ex_list[] = {"img", "lbl", "pds", "cub"}; // skip the ro PDS formats
    exclude.insert(ex_list, ex_list+4);

    TS_ASSERT_THROWS_NOTHING(foreach_ext(TEST_SRCDIR"/rwtest", test_extension<PixelRGB<float> >,   exclude));
    TS_ASSERT_THROWS_NOTHING(foreach_ext(TEST_SRCDIR"/rwtest", test_extension<PixelRGB<uint8> >,   exclude));
{'fraction_non_alphanumeric': 0.13527252188647274, 'fraction_numerical': 0.014967523298503248, 'mean_word_length': 4.694533762057878, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '7547848', 'n_tokens_mistral': 1308, 'n_tokens_neox': 1258, 'n_words': 262}