23 #include <boost/test/minimal.hpp>
24 #include <boost/crc.hpp>
26 #include "rawdata.hpp"
27 #include "io/file.hpp"
28 #include "rawcontainer.hpp"
29 #include "jfifcontainer.hpp"
30 #include "ljpegdecompressor.hpp"
31 #include "ljpegdecompressor_priv.hpp"
36 std::string g_testfile;
38 using namespace OpenRaw::Internals;
40 int test_main(
int argc,
char *argv[])
44 const char * srcdir = getenv(
"srcdir");
46 BOOST_ASSERT(srcdir != NULL);
47 g_testfile = std::string(srcdir);
48 g_testfile +=
"/ljpegtest1.jpg";
54 File::Ptr s(
new File(g_testfile.c_str()));
59 OpenRaw::RawDataPtr decompData = decompressor.decompress();
61 boost::crc_optimal<16, 0x1021, 0xFFFF, 0, false, false> crc_ccitt2;
62 const uint8_t * data =
static_cast<uint8_t *
>(decompData->data());
63 size_t data_len = decompData->size();
64 crc_ccitt2 = std::for_each( data, data + data_len, crc_ccitt2 );
66 BOOST_CHECK(crc_ccitt2() == 0x20cc);