diff --git a/BaseType.cc b/BaseType.cc index 37feb2da9..7500239fc 100644 --- a/BaseType.cc +++ b/BaseType.cc @@ -837,12 +837,13 @@ BaseType::intern_data(ConstraintEvaluator &, DDS &dds) * @param dmr DMR for the whole dataset */ void -BaseType::intern_data(Crc32 &checksum/*, DMR &, ConstraintEvaluator &*/) +BaseType::intern_data(/*Crc32 &checksum, DMR &, ConstraintEvaluator &*/) { if (!read_p()) read(); // read() throws Error and InternalErr - +#if 0 compute_checksum(checksum); +#endif } bool diff --git a/BaseType.h b/BaseType.h index 0d105f8e9..070e0bd7d 100644 --- a/BaseType.h +++ b/BaseType.h @@ -475,7 +475,7 @@ class BaseType : public DapObj */ virtual void compute_checksum(Crc32 &checksum) = 0; - virtual void intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval*/); + virtual void intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eval*/); /** * @brief The DAP4 serialization method. diff --git a/Constructor.cc b/Constructor.cc index 8a1fdecc6..060d56eb0 100644 --- a/Constructor.cc +++ b/Constructor.cc @@ -527,11 +527,11 @@ Constructor::compute_checksum(Crc32 &) } void -Constructor::intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator & eval*/) +Constructor::intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator & eval*/) { for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) { if ((*i)->send_p()) { - (*i)->intern_data(checksum/*, dmr, eval*/); + (*i)->intern_data(/*checksum, dmr, eval*/); } } } diff --git a/Constructor.h b/Constructor.h index 995cca1f1..961c83163 100644 --- a/Constructor.h +++ b/Constructor.h @@ -107,7 +107,7 @@ class Constructor: public BaseType // DAP4 virtual void compute_checksum(Crc32 &checksum); - virtual void intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval*/); + virtual void intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eval*/); virtual void serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter = false); virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr); diff --git a/D4Enum.cc b/D4Enum.cc index 090c94d35..575835b80 100644 --- a/D4Enum.cc +++ b/D4Enum.cc @@ -25,7 +25,7 @@ #include "config.h" -// #define DODS_DEBUG 1 +//#define DODS_DEBUG 1 #include #include @@ -52,6 +52,8 @@ #include "Operators.h" #include "InternalErr.h" +#include "dods-datatypes.h" +#include "dods-limits.h" #include "util.h" #include "debug.h" @@ -69,13 +71,93 @@ void D4Enum::m_duplicate(const D4Enum &src) d_is_signed = src.d_is_signed; } +void D4Enum::m_check_value(int64_t v) const +{ + switch (d_element_type) { + case dods_byte_c: + case dods_uint8_c: + if ((uint64_t)v > DODS_UCHAR_MAX || v < 0) { + ostringstream oss; + oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")"; + throw Error(oss.str()); + } + break; + case dods_uint16_c: + if ((uint64_t)v > DODS_USHRT_MAX || v < 0) { + ostringstream oss; + oss << "The value " << v << " will not fit in an unsigned 16-bit integer. (" << __func__ << ")"; + throw Error(oss.str()); + } + break; + case dods_uint32_c: + if ((uint64_t)v > DODS_UINT_MAX || v < 0) { + ostringstream oss; + oss << "The value " << v << " will not fit in an unsigned 32-bit integer. (" << __func__ << ")"; + throw Error(oss.str()); + } + break; + case dods_uint64_c: + // If 'v' can never be bigger than ULLONG_MAX + break; + + case dods_int8_c: + if (v > DODS_SCHAR_MAX || v < DODS_SCHAR_MIN) { + ostringstream oss; + oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")"; + throw Error(oss.str()); + } + + break; + case dods_int16_c: + if (v > DODS_SHRT_MAX || v < DODS_SHRT_MIN) { + ostringstream oss; + oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")"; + throw Error(oss.str()); + } + break; + case dods_int32_c: + if (v > DODS_INT_MAX || v < DODS_INT_MIN) { + ostringstream oss; + oss << "The value " << v << " will not fit in an unsigned byte. (" << __func__ << ")"; + throw Error(oss.str()); + } + break; + case dods_int64_c: + // There's no value 'v' can have that won't fit into a 64-bit int. + break; + default: + assert(!"illegal type for D4Enum"); + } +} + +D4Enum::D4Enum(const string &name, const string &enum_type) : + BaseType(name, dods_enum_c, true /*is_dap4*/), d_buf(0), d_element_type(dods_null_c), d_enum_def(0) +{ + d_element_type = get_type(enum_type.c_str()); + + if (!is_integer_type(d_element_type)) d_element_type = dods_uint64_c; + set_is_signed(d_element_type); +} + +D4Enum::D4Enum(const string &name, Type type) : + BaseType(name, dods_enum_c, true /*is_dap4*/), d_buf(0), d_element_type(type), d_enum_def(0) +{ + if (!is_integer_type(d_element_type)) d_element_type = dods_uint64_c; + set_is_signed(d_element_type); +} + +D4Enum::D4Enum(const string &name, const string &dataset, Type type) : + BaseType(name, dataset, dods_enum_c, true /*is_dap4*/), d_buf(0), d_element_type(type), d_enum_def(0) +{ + if (!is_integer_type(d_element_type)) d_element_type = dods_uint64_c; + set_is_signed(d_element_type); +} + // Explicit instantiation of the template member function 'value(T *)'. // This is required in order to have the library contain these member // functions when its own code does not use them. Normally, C++ instantiates // templates when they are used, and this forces that process so the // library file contains the various versions of the member function. -// -// NB: I could not get this syntax to work in the header file. jhrg 8/19/13 template void D4Enum::value(dods_byte *v) const; template void D4Enum::value(dods_int16 *v) const; template void D4Enum::value(dods_uint16 *v) const; @@ -84,13 +166,13 @@ template void D4Enum::value(dods_uint32 *v) const; template void D4Enum::value(dods_int64 *v) const; template void D4Enum::value(dods_uint64 *v) const; -template void D4Enum::set_value(dods_byte v); -template void D4Enum::set_value(dods_int16 v); -template void D4Enum::set_value(dods_uint16 v); -template void D4Enum::set_value(dods_int32 v); -template void D4Enum::set_value(dods_uint32 v); -template void D4Enum::set_value(dods_int64 v); -template void D4Enum::set_value(dods_uint64 v); +template void D4Enum::set_value(dods_byte v, bool check_value); +template void D4Enum::set_value(dods_int16 v, bool check_value); +template void D4Enum::set_value(dods_uint16 v, bool check_value); +template void D4Enum::set_value(dods_int32 v, bool check_value); +template void D4Enum::set_value(dods_uint32 v, bool check_value); +template void D4Enum::set_value(dods_int64 v, bool check_value); +template void D4Enum::set_value(dods_uint64 v, bool check_value); void D4Enum::set_enumeration(D4EnumDef *enum_def) { @@ -101,20 +183,28 @@ D4Enum::set_enumeration(D4EnumDef *enum_def) { void D4Enum::compute_checksum(Crc32 &checksum) { + DBG(cerr << __func__ << ": element type: " << ::libdap::type_name(d_element_type) << endl); + switch (d_element_type) { case dods_byte_c: case dods_uint8_c: - case dods_int8_c: - checksum.AddData(reinterpret_cast(&d_buf), sizeof(uint8_t)); + case dods_int8_c: { + dods_byte v = static_cast(d_buf); + checksum.AddData(reinterpret_cast(&v), sizeof(uint8_t)); break; + } case dods_uint16_c: - case dods_int16_c: - checksum.AddData(reinterpret_cast(&d_buf), sizeof(uint16_t)); + case dods_int16_c: { + dods_int16 v = static_cast(d_buf); + checksum.AddData(reinterpret_cast(&v), sizeof(uint16_t)); break; + } case dods_uint32_c: - case dods_int32_c: - checksum.AddData(reinterpret_cast(&d_buf), sizeof(uint32_t)); + case dods_int32_c: { + dods_int32 v = static_cast(d_buf); + checksum.AddData(reinterpret_cast(&v), sizeof(uint32_t)); break; + } case dods_uint64_c: case dods_int64_c: checksum.AddData(reinterpret_cast(&d_buf), sizeof(uint64_t)); @@ -125,6 +215,32 @@ D4Enum::compute_checksum(Crc32 &checksum) } } +void +D4Enum::set_is_signed(Type t) +{ + switch (t) { + case dods_byte_c: + case dods_uint8_c: + case dods_uint16_c: + case dods_uint32_c: + case dods_uint64_c: + d_is_signed = false; + break; + + case dods_int8_c: + case dods_int16_c: + case dods_int32_c: + case dods_int64_c: + d_is_signed = true; + break; + + default: + assert(!"illegal type for D4Enum"); + throw InternalErr(__FILE__, __LINE__, "Illegal type"); + } +} + + /** * @brief Serialize a D4Enum * Use the (integer) data type associated with an Enumeration definition to diff --git a/D4Enum.h b/D4Enum.h index 9d81e685a..5679d6b61 100644 --- a/D4Enum.h +++ b/D4Enum.h @@ -29,10 +29,14 @@ #include #include "BaseType.h" +#include "dods-datatypes.h" +#if 0 #include "InternalErr.h" #include "dods-datatypes.h" +#include "dods-limits.h" #include "util.h" +#endif namespace libdap { @@ -58,52 +62,18 @@ class D4Enum: public BaseType { friend class D4EnumTest; -public: -#if 0 - union enum_value { - int8_t i8; - uint8_t ui8; - int16_t i16; - uint16_t ui16; - int32_t i32; - uint32_t ui32; - int64_t i64; - uint64_t ui64; - - enum_value() : ui64(0) { } - - enum_value(int8_t i) : i8(i) {} - enum_value(uint8_t i) : ui8(i) {} - enum_value(int16_t i) : i16(i) {} - enum_value(uint16_t i) : ui16(i) {} - enum_value(int32_t i) : i32(i) {} - enum_value(uint32_t i) : ui32(i) {} - enum_value(int64_t i) : i64(i) {} - enum_value(uint64_t i) : ui64(i) {} - - // cast operators; use by set_value() - operator int8_t() const { return i8; } - operator uint8_t() const { return ui8; } - operator int16_t() const { return i16; } - operator uint16_t() const { return ui16; } - operator int32_t() const { return i32; } - operator uint32_t() const { return ui32; } - operator int64_t() const { return i64; } - operator uint64_t() const { return ui64; } - }; -#endif -private: -#if 0 - enum_value d_buf; -#endif - +protected: + // Use an unsigned 64-bit int. the value() and set_value() + // accessors cast to other types as needed, including signed ones. uint64_t d_buf; +private: Type d_element_type; D4EnumDef *d_enum_def; // The enumeration defined in the DMR, not an integer type bool d_is_signed; void m_duplicate(const D4Enum &src); + void m_check_value(int64_t v) const; unsigned int m_type_width() const { switch(d_element_type) { @@ -130,29 +100,11 @@ class D4Enum: public BaseType D4Enum(); // No empty constructor public: - // TODO add a way to set the EnumDef to these - D4Enum(const string &name, const string &enum_type) : - BaseType(name, dods_enum_c, true /*is_dap4*/), d_buf(/*(uint64_t)*/ 0), d_element_type(dods_null_c), d_enum_def(0) - { - d_element_type = get_type(enum_type.c_str()); + D4Enum(const string &name, const string &enum_type); - if (!is_integer_type(d_element_type)) d_element_type = dods_uint64_c; - set_is_signed(d_element_type); - } - - D4Enum(const string &name, Type type) : - BaseType(name, dods_enum_c, true /*is_dap4*/), d_buf(/*(uint64_t)*/ 0), d_element_type(type), d_enum_def(0) - { - if (!is_integer_type(d_element_type)) d_element_type = dods_uint64_c; - set_is_signed(d_element_type); - } + D4Enum(const string &name, Type type); - D4Enum(const string &name, const string &dataset, Type type) : - BaseType(name, dataset, dods_enum_c, true /*is_dap4*/), d_buf(/*(uint64_t)*/ 0), d_element_type(type), d_enum_def(0) - { - if (!is_integer_type(d_element_type)) d_element_type = dods_uint64_c; - set_is_signed(d_element_type); - } + D4Enum(const string &name, const string &dataset, Type type); D4Enum(const D4Enum &src) : BaseType(src) { m_duplicate(src); } @@ -175,30 +127,12 @@ class D4Enum: public BaseType void set_element_type(Type type) { d_element_type = type; } bool is_signed() const { return d_is_signed; } - void set_is_signed(Type t) { - switch (t) { - case dods_byte_c: - case dods_uint8_c: - case dods_uint16_c: - case dods_uint32_c: - case dods_uint64_c: - d_is_signed = false; - break; - - case dods_int8_c: - case dods_int16_c: - case dods_int32_c: - case dods_int64_c: - d_is_signed = true; - break; - - default: - assert(!"illegal type for D4Enum"); - throw InternalErr(__FILE__, __LINE__, "Illegal type"); - } - } + void set_is_signed(Type t); + /** - * @todo Hack! + * @brief Get the value of an Enum + * Get the value of this instance. The caller is responsible + * for using a type T than can hold the value. * * @param v Value-result parameter; return the value of the Enum * in this variable. @@ -207,7 +141,6 @@ class D4Enum: public BaseType *v = static_cast(d_buf); } - /** * @brief Set the value of the Enum * Template member function to set the value of the Enum. The libdap library @@ -215,56 +148,31 @@ class D4Enum: public BaseType * types for the parameter \c v. * * @param v Set the Enum to this value. + * @param check_value If true test the value 'v' against the type of the + * Enum. Defaults to true. */ - template void set_value(T v) + template void set_value(T v, bool check_value = true) { - d_buf = v; -#if 0 - // save this for use later for type checking - switch (d_element_type) { - case dods_byte_c: - case dods_uint8_c: - if (v > 255 || v < 0) - blah... - break; - case dods_uint16_c: - d_buf.ui16 = v; - break; - case dods_uint32_c: - d_buf.ui32 = v; - break; - case dods_uint64_c: - d_buf.ui64 = v; - break; - - case dods_int8_c: - d_buf.i8 = v; - break; - case dods_int16_c: - d_buf.i16 = v; - break; - case dods_int32_c: - d_buf.i32 = v; - break; - case dods_int64_c: - d_buf.i64 = v; - break; - default: - assert(!"illegal type for D4Enum"); - } -#endif + if (check_value) m_check_value(v); + d_buf = static_cast(v); } /** * @brief Return the number of bytes in an instance of an Enum. * This returns the number of bytes an instance of Enum will use - * either in memory or on the wire (i.e., in a serialization of - * the type). + * in memory or on the wire (i.e., in a serialization of + * the type). On the wire this type uses the minimum number of + * bytes for the given Enum type - an Enum with type Byte uses + * one byte, Int16 uses two, and so on. In memory, a single instance + * uses 64-bits but a vector of these will use the same number of + * bytes per value as the on-the-wire representation. + * + * @note The private method m_type_width() returns the byte width + * used for the on-the-wire representation of values. * - * @note This version of the method works for scalar Enums only. * @return The number of bytes used by a value. */ - virtual unsigned int width(bool /* constrained */ = false) const { return m_type_width(); } + virtual unsigned int width(bool /* constrained */ = false) const { return /*sizeof(int64_t);*/ m_type_width();} // DAP4 virtual void compute_checksum(Crc32 &checksum); diff --git a/D4Group.cc b/D4Group.cc index 0b45e1f2f..334af6ade 100644 --- a/D4Group.cc +++ b/D4Group.cc @@ -430,11 +430,11 @@ D4Group::set_send_p(bool state) } void -D4Group::intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval*/) +D4Group::intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eval*/) { groupsIter g = d_groups.begin(); while (g != d_groups.end()) - (*g++)->intern_data(checksum/*, dmr, eval*/); + (*g++)->intern_data(/*checksum, dmr, eval*/); // Specialize how the top-level variables in any Group are sent; include // a checksum for them. A subset operation might make an interior set of @@ -446,10 +446,11 @@ D4Group::intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval*/) for (Vars_iter i = d_vars.begin(); i != d_vars.end(); i++) { // Only send the stuff in the current subset. if ((*i)->send_p()) { - checksum.Reset(); - - (*i)->intern_data(checksum/*, dmr, eval*/); - +#if 0 + checksum.Reset(); +#endif + (*i)->intern_data(/*checksum, dmr, eval*/); +#if 0 D4Attribute *a = new D4Attribute("DAP4_Checksum_CRC32", attr_str_c); ostringstream oss; oss.setf(ios::hex, ios::basefield); @@ -457,6 +458,7 @@ D4Group::intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval*/) a->add_value(oss.str()); (*i)->attributes()->add_attribute_nocopy(a); DBG(cerr << "CRC32: " << oss.str() << " for " << (*i)->name() << endl); +#endif } } } diff --git a/D4Group.h b/D4Group.h index 2dfec5cbf..e99d509f0 100644 --- a/D4Group.h +++ b/D4Group.h @@ -132,7 +132,7 @@ class D4Group :public Constructor { virtual void set_read_p(bool state); // DAP4 - virtual void intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval*/); + virtual void intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eval*/); virtual void serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter = false); virtual void deserialize(D4StreamUnMarshaller &um, DMR &dmr); diff --git a/D4Sequence.cc b/D4Sequence.cc index 4df1b925b..df9a362bb 100644 --- a/D4Sequence.cc +++ b/D4Sequence.cc @@ -280,7 +280,7 @@ D4Sequence::compute_checksum(Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eva } #endif -void D4Sequence::intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval*/) +void D4Sequence::intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eval*/) { // Read the data values, then serialize. while (read_next_instance(/*dmr, eval,*/true /*filter*/)) { @@ -293,10 +293,12 @@ void D4Sequence::intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &e // below in the nested for loops from triggering a second call to // read(). row->back()->set_read_p(true); +#if 0 // Do not compute the checksum for constructor types; those // types will compute the checksum on the values they contain. // TODO Check on this if (!row->back()->is_constructor_type()) row->back()->compute_checksum(checksum); +#endif } } d_values.push_back(row); diff --git a/D4Sequence.h b/D4Sequence.h index 26006c046..51daf9796 100644 --- a/D4Sequence.h +++ b/D4Sequence.h @@ -188,7 +188,7 @@ class D4Sequence: public Constructor } // DAP4 - virtual void intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval*/); + virtual void intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eval*/); virtual void serialize(D4StreamMarshaller &m, DMR &dmr, /*ConstraintEvaluator &eval,*/ bool filter = false); #if 0 virtual void serialize_no_release(D4StreamMarshaller &m, DMR &dmr, bool filter = false); diff --git a/Vector.cc b/Vector.cc index 7768da5dc..5187fd931 100644 --- a/Vector.cc +++ b/Vector.cc @@ -845,7 +845,7 @@ void Vector::compute_checksum(Crc32 &checksum) } } -void Vector::intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval*/) +void Vector::intern_data(/*Crc32 &checksum, DMR &dmr, ConstraintEvaluator &eval*/) { if (!read_p()) read(); // read() throws Error and InternalErr @@ -869,7 +869,9 @@ void Vector::intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval* case dods_str_c: case dods_url_c: +#if 0 compute_checksum(checksum); +#endif break; case dods_opaque_c: @@ -878,7 +880,7 @@ void Vector::intern_data(Crc32 &checksum/*, DMR &dmr, ConstraintEvaluator &eval* assert(d_compound_buf.capacity() != 0); for (int i = 0, e = length(); i < e; ++i) - d_compound_buf[i]->intern_data(checksum/*, dmr, eval*/); + d_compound_buf[i]->intern_data(/*checksum, dmr, eval*/); break; case dods_array_c: // No Array of Array in DAP4 either... diff --git a/Vector.h b/Vector.h index a21e25b57..c20d1f341 100644 --- a/Vector.h +++ b/Vector.h @@ -190,7 +190,7 @@ class Vector: public BaseType // DAP4 virtual void compute_checksum(Crc32 &checksum); - virtual void intern_data(Crc32 &checksum); + virtual void intern_data(/*Crc32 &checksum*/); virtual void serialize(D4StreamMarshaller &m, DMR &dmr, bool filter = false); #if 0 virtual void serialize_no_release(D4StreamMarshaller &m, DMR &dmr, bool filter = false); diff --git a/tests/DMRTest.at b/tests/DMRTest.at index 5e1bd63dc..2dc1e35ee 100644 --- a/tests/DMRTest.at +++ b/tests/DMRTest.at @@ -126,16 +126,24 @@ m4_define([DMR_INTERN], [ AT_SETUP([intern $1]) AT_KEYWORDS([intern]) + # WORD_ORDER is set by configure in atlocal. + # This is a fix for the issue where the CRC32 checksum is different + # on little- and big-endian machines, so we use different baseline + # files. jhrg 9/30/15 input=$abs_srcdir/dmr-testsuite/$1 - baseline=$abs_srcdir/dmr-testsuite/$WORD_ORDER/$1.trans_base - - dnl AS_IF([test -n $baselines -a $baselines = yes] - dnl These tests use teh same baselines as the 'trans' tests. jhrg 10/1/15 + baseline=$abs_srcdir/dmr-testsuite/$WORD_ORDER/$1.intern_base - AT_CHECK([$abs_builddir/dmr-test -x -i $input || true], [], [stdout], [stderr]) - AT_CHECK([diff -b -B $baseline stdout || diff -b -B $baseline stderr], [], [ignore],[],[]) + AS_IF([test -n "$baselines" -a x$baselines = xyes], + [ + AT_CHECK([$abs_builddir/dmr-test -x -i $input], [], [stdout], []) + AT_CHECK([mv stdout $baseline.tmp]) + ], + [ + AT_CHECK([$abs_builddir/dmr-test -x -i $input || true], [], [stdout], [stderr]) + AT_CHECK([diff -b -B $baseline stdout], [], [ignore], [], []) - AT_XFAIL_IF([test "$2" = "xfail"]) + AT_XFAIL_IF([test "$2" = "xfail"]) + ]) AT_CLEANUP ]) diff --git a/tests/TestD4Enum.cc b/tests/TestD4Enum.cc index 254539cf9..8612525c4 100644 --- a/tests/TestD4Enum.cc +++ b/tests/TestD4Enum.cc @@ -107,7 +107,7 @@ bool TestD4Enum::read() { set_read_p(true); - DBG(cerr << "In TestD4Enum::read, _buf = " << d_buf.i64 << endl); + DBG(cerr << "In TestD4Enum::read, _buf = " << d_buf << endl); return true; } diff --git a/tests/dmr-test.cc b/tests/dmr-test.cc index 72f295f04..d9d402164 100644 --- a/tests/dmr-test.cc +++ b/tests/dmr-test.cc @@ -206,10 +206,10 @@ intern_data(DMR *dataset, /*const string &constraint,*/ bool series_values) // Mark all variables to be sent in their entirety. No CEs are used // when 'interning' variables' data. dataset->root()->set_send_p(true); - +#if 0 Crc32 checksum; - - dataset->root()->intern_data(checksum/*, *dataset, eval*/); +#endif + dataset->root()->intern_data(/*checksum, *dataset, eval*/); } DMR * diff --git a/tests/dmr-testsuite/big-endian/test_array_1.xml.intern_base b/tests/dmr-testsuite/big-endian/test_array_1.xml.intern_base new file mode 100644 index 000000000..03726e505 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_array_1.xml.intern_base @@ -0,0 +1,17 @@ +Parse successful + + + + + + + + + + + + + + +The data: +{ {123456789, 123456789, 123456789, 123456789, 123456789} } diff --git a/tests/dmr-testsuite/big-endian/test_array_10.xml.intern_base b/tests/dmr-testsuite/big-endian/test_array_10.xml.intern_base new file mode 100644 index 000000000..cb3703fd4 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_array_10.xml.intern_base @@ -0,0 +1,29 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5}, {{1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5},{1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5},{1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5},{1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5},{1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5}} } diff --git a/tests/dmr-testsuite/big-endian/test_array_11.xml.intern_base b/tests/dmr-testsuite/big-endian/test_array_11.xml.intern_base new file mode 100644 index 000000000..19701dde1 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_array_11.xml.intern_base @@ -0,0 +1,39 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {1, 1, 1, 1, 1}, {{1, 1, 1},{1, 1, 1},{1, 1, 1},{1, 1, 1},{1, 1, 1}} } diff --git a/tests/dmr-testsuite/big-endian/test_array_2.xml.intern_base b/tests/dmr-testsuite/big-endian/test_array_2.xml.intern_base new file mode 100644 index 000000000..363c92b22 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_array_2.xml.intern_base @@ -0,0 +1,19 @@ +Parse successful + + + + + + + + + + + + + + + + +The data: +{ {{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789}} } diff --git a/tests/dmr-testsuite/big-endian/test_array_3.xml.intern_base b/tests/dmr-testsuite/big-endian/test_array_3.xml.intern_base new file mode 100644 index 000000000..aa1600474 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_array_3.xml.intern_base @@ -0,0 +1,21 @@ +Parse successful + + + + + + + + + + + + + + + + + + +The data: +{ {{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1"}} } diff --git a/tests/dmr-testsuite/big-endian/test_array_4.xml.intern_base b/tests/dmr-testsuite/big-endian/test_array_4.xml.intern_base new file mode 100644 index 000000000..74583b3e2 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_array_4.xml.intern_base @@ -0,0 +1,103 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {{255, 255, 255, 255},{255, 255, 255, 255},{255, 255, 255, 255}}, {{32000, 32000, 32000, 32000},{32000, 32000, 32000, 32000},{32000, 32000, 32000, 32000}}, {{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789}}, {{64000, 64000, 64000, 64000},{64000, 64000, 64000, 64000},{64000, 64000, 64000, 64000}}, {{4026531840, 4026531840, 4026531840, 4026531840},{4026531840, 4026531840, 4026531840, 4026531840},{4026531840, 4026531840, 4026531840, 4026531840}}, {{99.999, 99.999, 99.999, 99.999},{99.999, 99.999, 99.999, 99.999},{99.999, 99.999, 99.999, 99.999}}, {{99.999, 99.999, 99.999, 99.999},{99.999, 99.999, 99.999, 99.999},{99.999, 99.999, 99.999, 99.999}}, {{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1", "Silly test string: 1"}}, {{"http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html"},{"http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html"},{"http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html"}}, {{123456789, 123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789, 123456789}}, {{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789}} } diff --git a/tests/dmr-testsuite/big-endian/test_array_5.xml.intern_base b/tests/dmr-testsuite/big-endian/test_array_5.xml.intern_base new file mode 100644 index 000000000..ed63c695a --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_array_5.xml.intern_base @@ -0,0 +1,47 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {{127, 127, 127, 127},{127, 127, 127, 127},{127, 127, 127, 127}}, {{255, 255, 255, 255},{255, 255, 255, 255},{255, 255, 255, 255}}, {{72057594037927935, 72057594037927935, 72057594037927935, 72057594037927935},{72057594037927935, 72057594037927935, 72057594037927935, 72057594037927935},{72057594037927935, 72057594037927935, 72057594037927935, 72057594037927935}}, {{18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615},{18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615},{18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615}} } diff --git a/tests/dmr-testsuite/big-endian/test_array_6.xml.intern_base b/tests/dmr-testsuite/big-endian/test_array_6.xml.intern_base new file mode 100644 index 000000000..6bfb604b8 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_array_6.xml.intern_base @@ -0,0 +1,27 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {{{ 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }},{{ 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }},{{ 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }}} } diff --git a/tests/dmr-testsuite/big-endian/test_array_7.xml.intern_base b/tests/dmr-testsuite/big-endian/test_array_7.xml.intern_base new file mode 100644 index 000000000..da7e14ba7 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_array_7.xml.intern_base @@ -0,0 +1,21 @@ +Parse successful + + + + + + + + + + + + + + + + + + +The data: +{ {{ { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }, { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }} } diff --git a/tests/dmr-testsuite/big-endian/test_array_8.xml.intern_base b/tests/dmr-testsuite/big-endian/test_array_8.xml.intern_base new file mode 100644 index 000000000..90ed9c24b --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_array_8.xml.intern_base @@ -0,0 +1,25 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {{{ { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }, { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }, { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }},{{ { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }, { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }, { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }}} } diff --git a/tests/dmr-testsuite/big-endian/test_simple_1.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_1.xml.intern_base new file mode 100644 index 000000000..4b6ab9723 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_1.xml.intern_base @@ -0,0 +1,13 @@ +Parse successful + + + + + + + + + + +The data: +{ 123456789 } diff --git a/tests/dmr-testsuite/big-endian/test_simple_10.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_10.xml.intern_base new file mode 100644 index 000000000..a26522621 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_10.xml.intern_base @@ -0,0 +1,13 @@ +Parse successful + + + + + + + + + + +The data: +{ 1,2,3,4,5 } diff --git a/tests/dmr-testsuite/big-endian/test_simple_2.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_2.xml.intern_base new file mode 100644 index 000000000..09b834006 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_2.xml.intern_base @@ -0,0 +1,37 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ 255, 127, 255, 32000, 64000, 123456789, 4026531840, 72057594037927935, 18446744073709551615, 99.999, 99.999, "Silly test string: 1", "http://dcz.gso.uri.edu/avhrr-archive/archive.html" } diff --git a/tests/dmr-testsuite/big-endian/test_simple_3.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_3.xml.intern_base new file mode 100644 index 000000000..ee45c203f --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_3.xml.intern_base @@ -0,0 +1,21 @@ +Parse successful + + + + + + + + + + + + + + + + + + +The data: +{ 123456789 } diff --git a/tests/dmr-testsuite/big-endian/test_simple_4.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_4.xml.intern_base new file mode 100644 index 000000000..14f262e4d --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_4.xml.intern_base @@ -0,0 +1,21 @@ +Parse successful + + + + + x_axis_value + + + + + + + + + x_axis_value + + + + +The data: +{ 123456789 } diff --git a/tests/dmr-testsuite/big-endian/test_simple_5.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_5.xml.intern_base new file mode 100644 index 000000000..74bd6bae5 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_5.xml.intern_base @@ -0,0 +1,29 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ 127, 32000, 123456789, 72057594037927935, 255, 255, 64000, 4026531840, 18446744073709551615 } diff --git a/tests/dmr-testsuite/big-endian/test_simple_6.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_6.xml.intern_base new file mode 100644 index 000000000..492e4be13 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_6.xml.intern_base @@ -0,0 +1,19 @@ +Parse successful + + + + + + + + + + + + + + + + +The data: +{ { 123456789, "Silly test string: 1" } } diff --git a/tests/dmr-testsuite/big-endian/test_simple_7.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_7.xml.intern_base new file mode 100644 index 000000000..1ab9b0e83 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_7.xml.intern_base @@ -0,0 +1,19 @@ +Parse successful + + + + + + + + + + + + + + + + +The data: +{ { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } } } diff --git a/tests/dmr-testsuite/big-endian/test_simple_8.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_8.xml.intern_base new file mode 100644 index 000000000..db42cfaa3 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_8.xml.intern_base @@ -0,0 +1,23 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + +The data: +{ { { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } } } } diff --git a/tests/dmr-testsuite/big-endian/test_simple_9.1.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_9.1.xml.intern_base new file mode 100644 index 000000000..42fff0218 --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_9.1.xml.intern_base @@ -0,0 +1,37 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ 1, 1 } diff --git a/tests/dmr-testsuite/big-endian/test_simple_9.xml.intern_base b/tests/dmr-testsuite/big-endian/test_simple_9.xml.intern_base new file mode 100644 index 000000000..f2ba8fa6f --- /dev/null +++ b/tests/dmr-testsuite/big-endian/test_simple_9.xml.intern_base @@ -0,0 +1,23 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + +The data: +{ 1 } diff --git a/tests/dmr-testsuite/little-endian/test_array_1.xml.intern_base b/tests/dmr-testsuite/little-endian/test_array_1.xml.intern_base new file mode 100644 index 000000000..03726e505 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_array_1.xml.intern_base @@ -0,0 +1,17 @@ +Parse successful + + + + + + + + + + + + + + +The data: +{ {123456789, 123456789, 123456789, 123456789, 123456789} } diff --git a/tests/dmr-testsuite/little-endian/test_array_10.xml.intern_base b/tests/dmr-testsuite/little-endian/test_array_10.xml.intern_base new file mode 100644 index 000000000..cb3703fd4 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_array_10.xml.intern_base @@ -0,0 +1,29 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5}, {{1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5},{1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5},{1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5},{1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5},{1,2,3,4,5, 1,2,3,4,5, 1,2,3,4,5}} } diff --git a/tests/dmr-testsuite/little-endian/test_array_11.xml.intern_base b/tests/dmr-testsuite/little-endian/test_array_11.xml.intern_base new file mode 100644 index 000000000..19701dde1 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_array_11.xml.intern_base @@ -0,0 +1,39 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {1, 1, 1, 1, 1}, {{1, 1, 1},{1, 1, 1},{1, 1, 1},{1, 1, 1},{1, 1, 1}} } diff --git a/tests/dmr-testsuite/little-endian/test_array_2.xml.intern_base b/tests/dmr-testsuite/little-endian/test_array_2.xml.intern_base new file mode 100644 index 000000000..363c92b22 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_array_2.xml.intern_base @@ -0,0 +1,19 @@ +Parse successful + + + + + + + + + + + + + + + + +The data: +{ {{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789}} } diff --git a/tests/dmr-testsuite/little-endian/test_array_3.xml.intern_base b/tests/dmr-testsuite/little-endian/test_array_3.xml.intern_base new file mode 100644 index 000000000..aa1600474 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_array_3.xml.intern_base @@ -0,0 +1,21 @@ +Parse successful + + + + + + + + + + + + + + + + + + +The data: +{ {{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1"}} } diff --git a/tests/dmr-testsuite/little-endian/test_array_4.xml.intern_base b/tests/dmr-testsuite/little-endian/test_array_4.xml.intern_base new file mode 100644 index 000000000..74583b3e2 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_array_4.xml.intern_base @@ -0,0 +1,103 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {{255, 255, 255, 255},{255, 255, 255, 255},{255, 255, 255, 255}}, {{32000, 32000, 32000, 32000},{32000, 32000, 32000, 32000},{32000, 32000, 32000, 32000}}, {{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789}}, {{64000, 64000, 64000, 64000},{64000, 64000, 64000, 64000},{64000, 64000, 64000, 64000}}, {{4026531840, 4026531840, 4026531840, 4026531840},{4026531840, 4026531840, 4026531840, 4026531840},{4026531840, 4026531840, 4026531840, 4026531840}}, {{99.999, 99.999, 99.999, 99.999},{99.999, 99.999, 99.999, 99.999},{99.999, 99.999, 99.999, 99.999}}, {{99.999, 99.999, 99.999, 99.999},{99.999, 99.999, 99.999, 99.999},{99.999, 99.999, 99.999, 99.999}}, {{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1", "Silly test string: 1"},{"Silly test string: 1", "Silly test string: 1", "Silly test string: 1", "Silly test string: 1"}}, {{"http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html"},{"http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html"},{"http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html", "http://dcz.gso.uri.edu/avhrr-archive/archive.html"}}, {{123456789, 123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789, 123456789}}, {{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789},{123456789, 123456789, 123456789, 123456789}} } diff --git a/tests/dmr-testsuite/little-endian/test_array_5.xml.intern_base b/tests/dmr-testsuite/little-endian/test_array_5.xml.intern_base new file mode 100644 index 000000000..ed63c695a --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_array_5.xml.intern_base @@ -0,0 +1,47 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {{127, 127, 127, 127},{127, 127, 127, 127},{127, 127, 127, 127}}, {{255, 255, 255, 255},{255, 255, 255, 255},{255, 255, 255, 255}}, {{72057594037927935, 72057594037927935, 72057594037927935, 72057594037927935},{72057594037927935, 72057594037927935, 72057594037927935, 72057594037927935},{72057594037927935, 72057594037927935, 72057594037927935, 72057594037927935}}, {{18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615},{18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615},{18446744073709551615, 18446744073709551615, 18446744073709551615, 18446744073709551615}} } diff --git a/tests/dmr-testsuite/little-endian/test_array_6.xml.intern_base b/tests/dmr-testsuite/little-endian/test_array_6.xml.intern_base new file mode 100644 index 000000000..6bfb604b8 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_array_6.xml.intern_base @@ -0,0 +1,27 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {{{ 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }},{{ 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }},{{ 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }, { 123456789, 123456789 }}} } diff --git a/tests/dmr-testsuite/little-endian/test_array_7.xml.intern_base b/tests/dmr-testsuite/little-endian/test_array_7.xml.intern_base new file mode 100644 index 000000000..da7e14ba7 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_array_7.xml.intern_base @@ -0,0 +1,21 @@ +Parse successful + + + + + + + + + + + + + + + + + + +The data: +{ {{ { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }, { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }} } diff --git a/tests/dmr-testsuite/little-endian/test_array_8.xml.intern_base b/tests/dmr-testsuite/little-endian/test_array_8.xml.intern_base new file mode 100644 index 000000000..90ed9c24b --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_array_8.xml.intern_base @@ -0,0 +1,25 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + +The data: +{ {{{ { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }, { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }, { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }},{{ { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }, { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }, { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } }}} } diff --git a/tests/dmr-testsuite/little-endian/test_simple_1.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_1.xml.intern_base new file mode 100644 index 000000000..4b6ab9723 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_1.xml.intern_base @@ -0,0 +1,13 @@ +Parse successful + + + + + + + + + + +The data: +{ 123456789 } diff --git a/tests/dmr-testsuite/little-endian/test_simple_10.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_10.xml.intern_base new file mode 100644 index 000000000..a26522621 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_10.xml.intern_base @@ -0,0 +1,13 @@ +Parse successful + + + + + + + + + + +The data: +{ 1,2,3,4,5 } diff --git a/tests/dmr-testsuite/little-endian/test_simple_2.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_2.xml.intern_base new file mode 100644 index 000000000..09b834006 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_2.xml.intern_base @@ -0,0 +1,37 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ 255, 127, 255, 32000, 64000, 123456789, 4026531840, 72057594037927935, 18446744073709551615, 99.999, 99.999, "Silly test string: 1", "http://dcz.gso.uri.edu/avhrr-archive/archive.html" } diff --git a/tests/dmr-testsuite/little-endian/test_simple_3.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_3.xml.intern_base new file mode 100644 index 000000000..ee45c203f --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_3.xml.intern_base @@ -0,0 +1,21 @@ +Parse successful + + + + + + + + + + + + + + + + + + +The data: +{ 123456789 } diff --git a/tests/dmr-testsuite/little-endian/test_simple_4.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_4.xml.intern_base new file mode 100644 index 000000000..14f262e4d --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_4.xml.intern_base @@ -0,0 +1,21 @@ +Parse successful + + + + + x_axis_value + + + + + + + + + x_axis_value + + + + +The data: +{ 123456789 } diff --git a/tests/dmr-testsuite/little-endian/test_simple_5.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_5.xml.intern_base new file mode 100644 index 000000000..74bd6bae5 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_5.xml.intern_base @@ -0,0 +1,29 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ 127, 32000, 123456789, 72057594037927935, 255, 255, 64000, 4026531840, 18446744073709551615 } diff --git a/tests/dmr-testsuite/little-endian/test_simple_6.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_6.xml.intern_base new file mode 100644 index 000000000..492e4be13 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_6.xml.intern_base @@ -0,0 +1,19 @@ +Parse successful + + + + + + + + + + + + + + + + +The data: +{ { 123456789, "Silly test string: 1" } } diff --git a/tests/dmr-testsuite/little-endian/test_simple_7.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_7.xml.intern_base new file mode 100644 index 000000000..1ab9b0e83 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_7.xml.intern_base @@ -0,0 +1,19 @@ +Parse successful + + + + + + + + + + + + + + + + +The data: +{ { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } } } diff --git a/tests/dmr-testsuite/little-endian/test_simple_8.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_8.xml.intern_base new file mode 100644 index 000000000..db42cfaa3 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_8.xml.intern_base @@ -0,0 +1,23 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + +The data: +{ { { { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" }, { 123456789, "Silly test string: 1" } } } } diff --git a/tests/dmr-testsuite/little-endian/test_simple_9.1.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_9.1.xml.intern_base new file mode 100644 index 000000000..42fff0218 --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_9.1.xml.intern_base @@ -0,0 +1,37 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +The data: +{ 1, 1 } diff --git a/tests/dmr-testsuite/little-endian/test_simple_9.xml.intern_base b/tests/dmr-testsuite/little-endian/test_simple_9.xml.intern_base new file mode 100644 index 000000000..f2ba8fa6f --- /dev/null +++ b/tests/dmr-testsuite/little-endian/test_simple_9.xml.intern_base @@ -0,0 +1,23 @@ +Parse successful + + + + + + + + + + + + + + + + + + + + +The data: +{ 1 } diff --git a/unit-tests/D4-marshaller/test_cmp.dat b/unit-tests/D4-marshaller/big-endian/test_cmp.dat similarity index 100% rename from unit-tests/D4-marshaller/test_cmp.dat rename to unit-tests/D4-marshaller/big-endian/test_cmp.dat diff --git a/unit-tests/D4-marshaller/big-endian/test_opaque_1_bin.dat b/unit-tests/D4-marshaller/big-endian/test_opaque_1_bin.dat new file mode 100644 index 000000000..71b72686a Binary files /dev/null and b/unit-tests/D4-marshaller/big-endian/test_opaque_1_bin.dat differ diff --git a/unit-tests/D4-marshaller/big-endian/test_scalars_1_bin.dat b/unit-tests/D4-marshaller/big-endian/test_scalars_1_bin.dat new file mode 100644 index 000000000..0eb0077a6 Binary files /dev/null and b/unit-tests/D4-marshaller/big-endian/test_scalars_1_bin.dat differ diff --git a/unit-tests/D4-marshaller/big-endian/test_scalars_2_bin.dat b/unit-tests/D4-marshaller/big-endian/test_scalars_2_bin.dat new file mode 100644 index 000000000..d8acf843c Binary files /dev/null and b/unit-tests/D4-marshaller/big-endian/test_scalars_2_bin.dat differ diff --git a/unit-tests/D4-marshaller/big-endian/test_scalars_3_bin.dat b/unit-tests/D4-marshaller/big-endian/test_scalars_3_bin.dat new file mode 100644 index 000000000..0b8d84455 Binary files /dev/null and b/unit-tests/D4-marshaller/big-endian/test_scalars_3_bin.dat differ diff --git a/unit-tests/D4-marshaller/big-endian/test_vector_1_bin.dat b/unit-tests/D4-marshaller/big-endian/test_vector_1_bin.dat new file mode 100644 index 000000000..e0e8df4c8 Binary files /dev/null and b/unit-tests/D4-marshaller/big-endian/test_vector_1_bin.dat differ diff --git a/unit-tests/D4-marshaller/little-endian/test_cmp.dat b/unit-tests/D4-marshaller/little-endian/test_cmp.dat new file mode 100644 index 000000000..b66efb8ad Binary files /dev/null and b/unit-tests/D4-marshaller/little-endian/test_cmp.dat differ diff --git a/unit-tests/D4-marshaller/test_opaque_1_bin.dat b/unit-tests/D4-marshaller/little-endian/test_opaque_1_bin.dat similarity index 100% rename from unit-tests/D4-marshaller/test_opaque_1_bin.dat rename to unit-tests/D4-marshaller/little-endian/test_opaque_1_bin.dat diff --git a/unit-tests/D4-marshaller/test_scalars_1.dat b/unit-tests/D4-marshaller/little-endian/test_scalars_1.dat similarity index 100% rename from unit-tests/D4-marshaller/test_scalars_1.dat rename to unit-tests/D4-marshaller/little-endian/test_scalars_1.dat diff --git a/unit-tests/D4-marshaller/test_scalars_1_bin.dat b/unit-tests/D4-marshaller/little-endian/test_scalars_1_bin.dat similarity index 100% rename from unit-tests/D4-marshaller/test_scalars_1_bin.dat rename to unit-tests/D4-marshaller/little-endian/test_scalars_1_bin.dat diff --git a/unit-tests/D4-marshaller/test_scalars_2.dat b/unit-tests/D4-marshaller/little-endian/test_scalars_2.dat similarity index 100% rename from unit-tests/D4-marshaller/test_scalars_2.dat rename to unit-tests/D4-marshaller/little-endian/test_scalars_2.dat diff --git a/unit-tests/D4-marshaller/test_scalars_2_bin.dat b/unit-tests/D4-marshaller/little-endian/test_scalars_2_bin.dat similarity index 100% rename from unit-tests/D4-marshaller/test_scalars_2_bin.dat rename to unit-tests/D4-marshaller/little-endian/test_scalars_2_bin.dat diff --git a/unit-tests/D4-marshaller/test_scalars_3_bin.dat b/unit-tests/D4-marshaller/little-endian/test_scalars_3_bin.dat similarity index 100% rename from unit-tests/D4-marshaller/test_scalars_3_bin.dat rename to unit-tests/D4-marshaller/little-endian/test_scalars_3_bin.dat diff --git a/unit-tests/D4-marshaller/test_vector_1_bin.dat b/unit-tests/D4-marshaller/little-endian/test_vector_1_bin.dat similarity index 100% rename from unit-tests/D4-marshaller/test_vector_1_bin.dat rename to unit-tests/D4-marshaller/little-endian/test_vector_1_bin.dat diff --git a/unit-tests/D4-marshaller/test_vector_2_bin.dat b/unit-tests/D4-marshaller/little-endian/test_vector_2_bin.dat similarity index 100% rename from unit-tests/D4-marshaller/test_vector_2_bin.dat rename to unit-tests/D4-marshaller/little-endian/test_vector_2_bin.dat diff --git a/unit-tests/D4EnumTest.cc b/unit-tests/D4EnumTest.cc index acbcd4d16..ffbb7222d 100644 --- a/unit-tests/D4EnumTest.cc +++ b/unit-tests/D4EnumTest.cc @@ -101,19 +101,19 @@ class D4EnumTest: public TestFixture { D4Enum e("second", dods_byte_c); dods_byte db = 200; e.set_value(db); - CPPUNIT_ASSERT(e.d_buf.ui8 == 200); + CPPUNIT_ASSERT(e.d_buf == 200); } void test_set_value2() { D4Enum e("second", dods_byte_c); e.set_value(200); - CPPUNIT_ASSERT(e.d_buf.ui8 == 200); + CPPUNIT_ASSERT(e.d_buf == 200); } void test_set_value3() { D4Enum e("third", dods_int32_c); e.set_value(-65535); - CPPUNIT_ASSERT(e.d_buf.i32 == -65535); + CPPUNIT_ASSERT(e.d_buf == -65535); } void test_value() { @@ -139,7 +139,7 @@ class D4EnumTest: public TestFixture { D4Enum f(e); CPPUNIT_ASSERT(f.d_element_type == dods_byte_c); CPPUNIT_ASSERT(f.name() == "second"); - CPPUNIT_ASSERT(f.d_buf.ui8 == 200); + CPPUNIT_ASSERT(f.d_buf == 200); } void test_assignment() { @@ -149,7 +149,7 @@ class D4EnumTest: public TestFixture { D4Enum f = e; CPPUNIT_ASSERT(f.d_element_type == dods_byte_c); CPPUNIT_ASSERT(f.name() == "second"); - CPPUNIT_ASSERT(f.d_buf.ui8 == 200); + CPPUNIT_ASSERT(f.d_buf == 200); } void test_print() { diff --git a/unit-tests/D4MarshallerTest.cc b/unit-tests/D4MarshallerTest.cc index b309acf2f..6211cb0fa 100644 --- a/unit-tests/D4MarshallerTest.cc +++ b/unit-tests/D4MarshallerTest.cc @@ -38,8 +38,6 @@ #include #include -// #define DODS_DEBUG 1 - #include #include #include @@ -54,11 +52,16 @@ static bool debug = false; static bool write_baselines = false; -const string path = (string)TEST_SRC_DIR + "/D4-marshaller"; #undef DBG #define DBG(x) do { if (debug) (x); } while(false); +#ifdef __BIG_ENDIAN__ +const static string path = (string)TEST_SRC_DIR + "/D4-marshaller/big-endian"; +#else +const static string path = (string)TEST_SRC_DIR + "/D4-marshaller/little-endian"; +#endif + using namespace std; using namespace libdap; @@ -124,6 +127,7 @@ class D4MarshallerTest: public CppUnit::TestFixture { void test_cmp() { char buf[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; + DBG(cerr << "Path: " << path << endl); CPPUNIT_ASSERT(cmp(buf, 16, path + "/test_cmp.dat")); } diff --git a/unit-tests/D4UnMarshallerTest.cc b/unit-tests/D4UnMarshallerTest.cc index 9a4ccced3..26443c61d 100644 --- a/unit-tests/D4UnMarshallerTest.cc +++ b/unit-tests/D4UnMarshallerTest.cc @@ -52,11 +52,16 @@ #include "test_config.h" static bool debug = false; -const string path = (string)TEST_SRC_DIR + "/D4-marshaller"; #undef DBG #define DBG(x) do { if (debug) (x); } while(false); +#ifdef __BIG_ENDIAN__ +const static string path = string(TEST_SRC_DIR) + "/D4-marshaller/big-endian"; +#else +const static string path = string(TEST_SRC_DIR) + "/D4-marshaller/little-endian"; +#endif + using namespace std; using namespace libdap; @@ -82,7 +87,7 @@ class D4UnMarshallerTest: public CppUnit::TestFixture { #else -#ifdef WORDS_BIGENDIAN +#ifdef __BIG_ENDIAN__ return true; #else return false; @@ -111,56 +116,62 @@ class D4UnMarshallerTest: public CppUnit::TestFixture { string file = path + "/test_scalars_1_bin.dat"; DBG(cerr << "file: " << file << endl); in.open(file.c_str(), fstream::binary | fstream::in); - D4StreamUnMarshaller dsm(in, is_host_big_endian()); + + // Don't use is_host_big_endian() because these tests should + // never 'twiddle bytes' They are always testing little to little + // of big to big + D4StreamUnMarshaller dsm(in, 0 /*is_host_big_endian()*/); dods_byte b; dsm.get_byte(b); CPPUNIT_ASSERT(b == 17); string ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); + DBG(cerr << "ck: " << ck << endl); + // Same checksum for both big- and little-endian CPPUNIT_ASSERT(ck == "b8b2cf7f"); dods_int16 i1; dsm.get_int16(i1); CPPUNIT_ASSERT(i1 == 17); ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "120031ef"); + DBG(cerr << "ck: " << ck << endl); + // little-endian || big-endian checksum values + CPPUNIT_ASSERT(ck == "120031ef" || ck == "2b69320d"); dods_int32 i2; dsm.get_int32(i2); CPPUNIT_ASSERT(i2 == 17); ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "c9e1efe6"); + DBG(cerr << "ck: " << ck << endl); + CPPUNIT_ASSERT(ck == "c9e1efe6" || ck == "4bf4ffee"); dods_int64 i3; dsm.get_int64(i3); CPPUNIT_ASSERT(i3 == 17); ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "d533eedc"); + DBG(cerr << "ck: " << ck << endl); + CPPUNIT_ASSERT(ck == "d533eedc" || ck == "0f92ff9b"); dods_uint16 ui1; dsm.get_uint16(ui1); CPPUNIT_ASSERT(ui1 == 17); ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "120031ef"); + DBG(cerr << "ck: " << ck << endl); + CPPUNIT_ASSERT(ck == "120031ef" || ck == "2b69320d"); dods_uint32 ui2; dsm.get_uint32(ui2); CPPUNIT_ASSERT(ui2 == 17); ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "c9e1efe6"); + DBG(cerr << "ck: " << ck << endl); + CPPUNIT_ASSERT(ck == "c9e1efe6" || ck == "4bf4ffee"); dods_uint64 ui3; dsm.get_uint64(ui3); CPPUNIT_ASSERT(ui3 == 17); ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "d533eedc"); + DBG(cerr << "ck: " << ck << endl); + CPPUNIT_ASSERT(ck == "d533eedc" || ck == "0f92ff9b"); } catch (Error &e) { cerr << "Error: " << e.get_error_message() << endl; @@ -181,21 +192,21 @@ class D4UnMarshallerTest: public CppUnit::TestFixture { try { string file = path + "/test_scalars_2_bin.dat"; in.open(file.c_str(), fstream::binary | fstream::in); - D4StreamUnMarshaller dsm(in, is_host_big_endian()); + D4StreamUnMarshaller dsm(in, 0); dods_float32 r1; dsm.get_float32(r1); CPPUNIT_ASSERT(r1 == 17.0); string ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "d3c5bc59"); + DBG(cerr << "ck: " << ck << endl); + CPPUNIT_ASSERT(ck == "d3c5bc59" || ck == "edcaaa7c"); dods_float64 r2; dsm.get_float64(r2); CPPUNIT_ASSERT(r2 == 17.0); ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "d5a3994b"); + DBG(cerr << "ck: " << ck << endl); + CPPUNIT_ASSERT(ck == "d5a3994b" || ck == "42abb362"); } catch (Error &e) { cerr << "Error: " << e.get_error_message() << endl; @@ -215,20 +226,20 @@ class D4UnMarshallerTest: public CppUnit::TestFixture { try { string file = path + "/test_scalars_3_bin.dat"; in.open(file.c_str(), fstream::binary | fstream::in); - D4StreamUnMarshaller dsm(in, is_host_big_endian()); + D4StreamUnMarshaller dsm(in, 0); string s; dsm.get_str(s); CPPUNIT_ASSERT(s == "This is a test string with 40 characters"); string ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); + DBG(cerr << "ck: " << ck << endl); CPPUNIT_ASSERT(ck == "af117544"); string u; dsm.get_url(u); CPPUNIT_ASSERT(u == "http://www.opendap.org/lame/unit/test"); ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); + DBG(cerr << "ck: " << ck << endl); CPPUNIT_ASSERT(ck == "41e10081"); } catch (Error &e) { @@ -249,7 +260,7 @@ class D4UnMarshallerTest: public CppUnit::TestFixture { try { string file = path + "/test_opaque_1_bin.dat"; in.open(file.c_str(), fstream::binary | fstream::in); - D4StreamUnMarshaller dsm(in, is_host_big_endian()); + D4StreamUnMarshaller dsm(in, 0); char *buf2; int64_t len; @@ -258,7 +269,7 @@ class D4UnMarshallerTest: public CppUnit::TestFixture { for (int i = 0; i < 32768; ++i) CPPUNIT_ASSERT(buf2[i] == i % (1 << 7)); string ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); + DBG(cerr << "ck: " << ck << endl); CPPUNIT_ASSERT(ck == "199ad7f5"); delete buf2; @@ -281,23 +292,23 @@ class D4UnMarshallerTest: public CppUnit::TestFixture { try { string file = path + "/test_vector_1_bin.dat"; in.open(file.c_str(), fstream::binary | fstream::in); - D4StreamUnMarshaller dsm(in, is_host_big_endian()); + D4StreamUnMarshaller dsm(in, 0); vector buf1(32768); dsm.get_vector(reinterpret_cast(&buf1[0]), 32768); for (int i = 0; i < 32768; ++i) CPPUNIT_ASSERT(buf1[i] == i % (1 << 7)); string ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "199ad7f5"); + DBG(cerr << "ck: " << ck << endl); + CPPUNIT_ASSERT(ck == "199ad7f5" || ck == "199ad7f5"); vector buf2(32768); dsm.get_vector(reinterpret_cast(&buf2[0]), 32768, sizeof(dods_int32)); for (int i = 0; i < 32768; ++i) CPPUNIT_ASSERT(buf2[i] == i % (1 << 9)); ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "5c1bf29f"); + DBG(cerr << "ck: " << ck << endl); + CPPUNIT_ASSERT(ck == "5c1bf29f" || ck == "8efd2d3d"); vector buf3(32768); dsm.get_vector_float64(reinterpret_cast(&buf3[0]), 32768); @@ -307,8 +318,8 @@ class D4UnMarshallerTest: public CppUnit::TestFixture { CPPUNIT_ASSERT(buf3[i] == i % (1 << 9)); } ck = dsm.get_checksum_str(); - DBG2(cerr << "ck: " << ck << endl); - CPPUNIT_ASSERT(ck == "aafc2a91"); + DBG(cerr << "ck: " << ck << endl); + CPPUNIT_ASSERT(ck == "aafc2a91" || ck == "7bdf9931"); } catch (Error &e) { cerr << "Error: " << e.get_error_message() << endl; diff --git a/util.cc b/util.cc index d56813ba5..9b4a9b3f6 100644 --- a/util.cc +++ b/util.cc @@ -100,7 +100,7 @@ bool is_host_big_endian() #else -#ifdef WORDS_BIGENDIAN +#ifdef __BIG_ENDIAN__ return true; #else return false;