24 #include "CUnit/Basic.h" 43 CU_ASSERT(rast != NULL);
46 CU_ASSERT(band != NULL);
48 for (x = 0; x < maxX; x++) {
49 for (y = 0; y < maxY; y++) {
80 CU_ASSERT_EQUAL(rtn, 3);
92 CU_ASSERT_EQUAL(rtn, 6);
104 CU_ASSERT_EQUAL(rtn, 7);
116 CU_ASSERT_EQUAL(rtn, 19);
128 CU_ASSERT_EQUAL(rtn, 1);
140 CU_ASSERT_EQUAL(rtn, 0);
152 CU_ASSERT_EQUAL(rtn, 3);
164 CU_ASSERT_EQUAL(rtn, 0);
176 CU_ASSERT_EQUAL(rtn, 2);
188 CU_ASSERT_EQUAL(dimx, 3);
189 CU_ASSERT_EQUAL(dimy, 3);
191 for (x = 0; x < dimx; x++) {
207 CU_ASSERT_EQUAL(rtn, 0);
219 CU_ASSERT_EQUAL(rtn, 0);
231 CU_ASSERT_EQUAL(rtn, 48);
243 CU_ASSERT_EQUAL(rtn, 27);
255 CU_ASSERT_EQUAL(rtn, 13);
267 CU_ASSERT_EQUAL(rtn, 3);
273 CU_ASSERT(band != NULL);
283 CU_ASSERT_EQUAL(rtn, 8);
299 double search0[1] = {0};
300 double search1[1] = {1};
301 double search2[2] = {3, 5};
304 CU_ASSERT(rast != NULL);
307 CU_ASSERT(band != NULL);
309 for (x = 0; x < maxX; x++) {
310 for (y = 0; y < maxY; y++) {
339 CU_ASSERT_EQUAL(rtn, 83);
349 CU_ASSERT_EQUAL(rtn, 17);
363 CU_ASSERT_EQUAL(rtn, 3);
390 CU_ASSERT(rast != NULL);
393 CU_ASSERT(band != NULL);
395 for (x = 0; x < maxX; x++) {
396 for (y = 0; y < maxY; y++) {
403 CU_ASSERT_EQUAL(nod,0);
404 CU_ASSERT_DOUBLE_EQUAL(val,1,.01);
409 CU_ASSERT(mask != NULL);
413 for( i = 0; i < maskY; i++) {
418 CU_ASSERT(mask->
values != NULL);
419 CU_ASSERT(mask->
nodata != NULL);
423 for(y = 0; y < maskY; y++) {
424 for(x = 0; x < maskX; x++){
442 CU_ASSERT_EQUAL(rtn,8);
456 CU_ASSERT_EQUAL(dimx, 3);
457 CU_ASSERT_EQUAL(dimy, 3);
458 CU_ASSERT_EQUAL(nodata[1][1],1);
460 for (x = 0; x < dimx; x++) {
470 for(y = 0; y < maskY; y++) {
471 for(x = 0; x < maskX; x++){
490 CU_ASSERT_EQUAL(rtn,8);
504 CU_ASSERT_EQUAL(dimx, 3);
505 CU_ASSERT_EQUAL(dimy, 3);
506 CU_ASSERT_NOT_EQUAL(nodata[0][0],1);
507 CU_ASSERT_DOUBLE_EQUAL(value[0][0],1,.01);
509 for (x = 0; x < dimx; x++) {
519 for(y = 0; y < maskY; y++) {
520 for(x = 0; x < maskX; x++){
538 CU_ASSERT_EQUAL(rtn,8);
552 CU_ASSERT_EQUAL(dimx, 3);
553 CU_ASSERT_EQUAL(dimy, 3);
554 CU_ASSERT_NOT_EQUAL(nodata[0][0],1);
555 CU_ASSERT_DOUBLE_EQUAL(value[0][0],0.5,0.1);
557 for (x = 0; x < dimx; x++) {
565 for( i = 0; i < maskY; i++) {
585 CU_pSuite suite = CU_add_suite(
"band_misc", NULL, NULL);
static void test_band_get_nearest_pixel()
rt_errorstate rt_pixel_set_to_array(rt_pixel npixel, int count, rt_mask mask, int x, int y, uint16_t distancex, uint16_t distancey, double ***value, int ***nodata, int *dimx, int *dimy)
static void test_pixel_set_to_array()
void * rtalloc(size_t size)
Wrappers used for managing memory.
int rt_band_get_pixel_of_value(rt_band band, int exclude_nodata_value, double *searchset, int searchcount, rt_pixel *pixels)
Search band for pixel(s) with search values.
void band_misc_suite_setup(void)
void cu_free_raster(rt_raster raster)
rt_band cu_add_band(rt_raster raster, rt_pixtype pixtype, int hasnodata, double nodataval)
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
#define PG_ADD_TEST(suite, testfunc)
static void test_band_get_pixel_of_value()
rt_raster rt_raster_new(uint32_t width, uint32_t height)
Construct a raster with given dimensions.
struct rt_mask_t * rt_mask
void rtdealloc(void *mem)
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
int rt_band_get_nearest_pixel(rt_band band, int x, int y, uint16_t distancex, uint16_t distancey, int exclude_nodata_value, rt_pixel *npixels)
Get nearest pixel(s) with value (not NODATA) to specified pixel.