25 #include "CUnit/Basic.h" 31 const char *hexwkb = NULL;
32 const char *out = NULL;
56 CU_ASSERT(raster != NULL);
75 CU_ASSERT_EQUAL(len, strlen(hexwkb));
114 CU_ASSERT(raster != NULL);
133 CU_ASSERT_EQUAL(len, strlen(hexwkb));
164 CU_ASSERT(raster != NULL);
179 CU_ASSERT(band != NULL);
184 CU_ASSERT_DOUBLE_EQUAL(val, 0, DBL_EPSILON);
186 CU_ASSERT_EQUAL(failure,
ES_NONE);
187 CU_ASSERT_DOUBLE_EQUAL(val, 1, DBL_EPSILON);
195 CU_ASSERT_EQUAL(len, strlen(hexwkb));
231 CU_ASSERT(raster != NULL);
247 CU_ASSERT(band != NULL);
252 CU_ASSERT_DOUBLE_EQUAL(val, -1, DBL_EPSILON);
255 CU_ASSERT_EQUAL(failure,
ES_NONE);
256 CU_ASSERT_DOUBLE_EQUAL(val, -1, DBL_EPSILON);
259 CU_ASSERT_EQUAL(failure,
ES_NONE);
260 CU_ASSERT_DOUBLE_EQUAL(val, 0, DBL_EPSILON);
263 CU_ASSERT_EQUAL(failure,
ES_NONE);
264 CU_ASSERT_DOUBLE_EQUAL(val, 1, DBL_EPSILON);
267 CU_ASSERT_EQUAL(failure,
ES_NONE);
268 CU_ASSERT_DOUBLE_EQUAL(val, 127, DBL_EPSILON);
271 CU_ASSERT_EQUAL(failure,
ES_NONE);
272 CU_ASSERT_DOUBLE_EQUAL(val, 10, DBL_EPSILON);
275 CU_ASSERT_EQUAL(failure,
ES_NONE);
276 CU_ASSERT_DOUBLE_EQUAL(val, 2, DBL_EPSILON);
284 CU_ASSERT_EQUAL(len, strlen(hexwkb));
333 CU_ASSERT(raster != NULL);
348 CU_ASSERT(band != NULL);
354 CU_ASSERT_EQUAL(failure,
ES_NONE);
355 CU_ASSERT_DOUBLE_EQUAL(val, -1, DBL_EPSILON);
358 CU_ASSERT_EQUAL(failure,
ES_NONE);
359 CU_ASSERT_DOUBLE_EQUAL(val, 0, DBL_EPSILON);
362 CU_ASSERT_EQUAL(failure,
ES_NONE);
363 CU_ASSERT_DOUBLE_EQUAL(val, -16, DBL_EPSILON);
366 CU_ASSERT_EQUAL(failure,
ES_NONE);
367 CU_ASSERT_DOUBLE_EQUAL(val, 127, DBL_EPSILON);
370 CU_ASSERT_EQUAL(failure,
ES_NONE);
371 CU_ASSERT_DOUBLE_EQUAL(val, 10, DBL_EPSILON);
374 CU_ASSERT_EQUAL(failure,
ES_NONE);
375 CU_ASSERT_DOUBLE_EQUAL(val, 2, DBL_EPSILON);
383 CU_ASSERT_EQUAL(len, strlen(hexwkb));
419 CU_ASSERT(raster != NULL);
434 CU_ASSERT(band != NULL);
440 CU_ASSERT_EQUAL(failure,
ES_NONE);
441 CU_ASSERT_DOUBLE_EQUAL(val, -1, DBL_EPSILON);
444 CU_ASSERT_EQUAL(failure,
ES_NONE);
445 CU_ASSERT_DOUBLE_EQUAL(val, 0, DBL_EPSILON);
448 CU_ASSERT_EQUAL(failure,
ES_NONE);
449 CU_ASSERT_DOUBLE_EQUAL(val, -16, DBL_EPSILON);
452 CU_ASSERT_EQUAL(failure,
ES_NONE);
453 CU_ASSERT_DOUBLE_EQUAL(val, 127, DBL_EPSILON);
456 CU_ASSERT_EQUAL(failure,
ES_NONE);
457 CU_ASSERT_DOUBLE_EQUAL(val, 10, DBL_EPSILON);
460 CU_ASSERT_EQUAL(failure,
ES_NONE);
461 CU_ASSERT_DOUBLE_EQUAL(val, 2, DBL_EPSILON);
469 CU_ASSERT_EQUAL(len, strlen(hexwkb));
498 "2F746D702F742E74696600" 502 CU_ASSERT(raster != NULL);
517 CU_ASSERT(band != NULL);
522 CU_ASSERT_DOUBLE_EQUAL(val, -1, DBL_EPSILON);
525 CU_ASSERT_EQUAL(bandnum, 3);
533 CU_ASSERT_EQUAL(len, strlen(hexwkb));
566 CU_ASSERT(raster != NULL);
581 CU_ASSERT(band != NULL);
586 CU_ASSERT_DOUBLE_EQUAL(val, 1, DBL_EPSILON);
589 CU_ASSERT_EQUAL(failure,
ES_NONE);
590 CU_ASSERT_DOUBLE_EQUAL(val, 1, DBL_EPSILON);
593 CU_ASSERT_EQUAL(failure,
ES_NONE);
594 CU_ASSERT_DOUBLE_EQUAL(val, 436, DBL_EPSILON);
597 CU_ASSERT_EQUAL(failure,
ES_NONE);
598 CU_ASSERT_DOUBLE_EQUAL(val, 431, DBL_EPSILON);
608 CU_ASSERT_EQUAL(len, strlen(hexwkb));
633 for (i = 0; i < 5; ++i)
651 "FDFEFDFEFEFDFEFEFDF9FAFEFEFCF9FBFDFEFEFDFCFAFEFEFE" 654 "4E627AADD16076B4F9FE6370A9F5FE59637AB0E54F58617087" 657 "46566487A1506CA2E3FA5A6CAFFBFE4D566DA4CB3E454C5665" 661 CU_ASSERT(raster != NULL);
677 CU_ASSERT(band != NULL);
682 CU_ASSERT_DOUBLE_EQUAL(val, 0, DBL_EPSILON);
685 CU_ASSERT_EQUAL(failure,
ES_NONE);
686 CU_ASSERT_DOUBLE_EQUAL(val, 253, DBL_EPSILON);
689 CU_ASSERT_EQUAL(failure,
ES_NONE);
690 CU_ASSERT_DOUBLE_EQUAL(val, 254, DBL_EPSILON);
693 CU_ASSERT_EQUAL(failure,
ES_NONE);
694 CU_ASSERT_DOUBLE_EQUAL(val, 253, DBL_EPSILON);
697 CU_ASSERT_EQUAL(failure,
ES_NONE);
698 CU_ASSERT_DOUBLE_EQUAL(val, 254, DBL_EPSILON);
701 CU_ASSERT_EQUAL(failure,
ES_NONE);
702 CU_ASSERT_DOUBLE_EQUAL(val, 254, DBL_EPSILON);
710 CU_ASSERT(band != NULL);
715 CU_ASSERT_DOUBLE_EQUAL(val, 0, DBL_EPSILON);
718 CU_ASSERT_EQUAL(failure,
ES_NONE);
719 CU_ASSERT_DOUBLE_EQUAL(val, 78, DBL_EPSILON);
722 CU_ASSERT_EQUAL(failure,
ES_NONE);
723 CU_ASSERT_DOUBLE_EQUAL(val, 98, DBL_EPSILON);
726 CU_ASSERT_EQUAL(failure,
ES_NONE);
727 CU_ASSERT_DOUBLE_EQUAL(val, 122, DBL_EPSILON);
730 CU_ASSERT_EQUAL(failure,
ES_NONE);
731 CU_ASSERT_DOUBLE_EQUAL(val, 173, DBL_EPSILON);
734 CU_ASSERT_EQUAL(failure,
ES_NONE);
735 CU_ASSERT_DOUBLE_EQUAL(val, 209, DBL_EPSILON);
743 CU_ASSERT(band != NULL);
748 CU_ASSERT_DOUBLE_EQUAL(val, 0, DBL_EPSILON);
751 CU_ASSERT_EQUAL(failure,
ES_NONE);
752 CU_ASSERT_DOUBLE_EQUAL(val, 70, DBL_EPSILON);
755 CU_ASSERT_EQUAL(failure,
ES_NONE);
756 CU_ASSERT_DOUBLE_EQUAL(val, 86, DBL_EPSILON);
759 CU_ASSERT_EQUAL(failure,
ES_NONE);
760 CU_ASSERT_DOUBLE_EQUAL(val, 100, DBL_EPSILON);
763 CU_ASSERT_EQUAL(failure,
ES_NONE);
764 CU_ASSERT_DOUBLE_EQUAL(val, 135, DBL_EPSILON);
767 CU_ASSERT_EQUAL(failure,
ES_NONE);
768 CU_ASSERT_DOUBLE_EQUAL(val, 161, DBL_EPSILON);
776 CU_ASSERT_EQUAL(len, strlen(hexwkb));
815 CU_pSuite suite = CU_add_suite(
"raster_wkb", NULL, NULL);
void * rt_raster_serialize(rt_raster raster)
Return this raster in serialized form.
double rt_raster_get_x_offset(rt_raster raster)
Get raster x offset, in projection units.
int rt_raster_get_num_bands(rt_raster raster)
double rt_raster_get_y_skew(rt_raster raster)
Get skew about the Y axis.
raster
Be careful!! Zeros function's input parameter can be a (height x width) array, not (width x height): ...
int rt_band_is_offline(rt_band band)
Return non-zero if the given band data is on the filesystem.
static void test_raster_wkb()
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
const char * rt_band_get_ext_path(rt_band band)
Return band's external path (only valid when rt_band_is_offline returns non-zero).
void cu_free_raster(rt_raster raster)
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
char * rt_raster_to_hexwkb(rt_raster raster, int outasin, uint32_t *hexwkbsize)
Return this raster in HEXWKB form (null-terminated hex)
#define PG_ADD_TEST(suite, testfunc)
rt_band rt_raster_get_band(rt_raster raster, int bandNum)
Return Nth band, or NULL if unavailable.
int rt_band_get_hasnodata_flag(rt_band band)
Get hasnodata flag value.
double rt_raster_get_x_scale(rt_raster raster)
Get scale X in projection units.
int32_t rt_raster_get_srid(rt_raster raster)
Get raster's SRID.
double rt_raster_get_y_scale(rt_raster raster)
Get scale Y in projection units.
double rt_raster_get_x_skew(rt_raster raster)
Get skew about the X axis.
rt_errorstate rt_band_get_ext_band_num(rt_band band, uint8_t *bandnum)
Return bands' external band number (only valid when rt_band_is_offline returns non-zero).
void raster_wkb_suite_setup(void)
uint16_t rt_raster_get_width(rt_raster raster)
rt_raster rt_raster_from_hexwkb(const char *hexwkb, uint32_t hexwkbsize)
Construct an rt_raster from a text HEXWKB representation.
rt_pixtype rt_band_get_pixtype(rt_band band)
Return pixeltype of this band.
uint16_t rt_raster_get_height(rt_raster raster)
rt_raster rt_raster_deserialize(void *serialized, int header_only)
Return a raster from a serialized form.
double rt_raster_get_y_offset(rt_raster raster)
Get raster y offset, in projection units.