224 {
226 uint8_t *
data = NULL;
228 int width = 5;
229 int height = 5;
230 int err = 0;
231 int clamped = 0;
232 double val = 0;
235
236
238 CU_ASSERT(data != NULL);
240
242 width, height,
243 pixtype,
244 0, 0,
245 data
246 );
247 CU_ASSERT(band != NULL);
250
253 CU_ASSERT(!clamped);
255 CU_ASSERT_DOUBLE_EQUAL(val, 1, DBL_EPSILON);
256
259 CU_ASSERT(!clamped);
261 CU_ASSERT_DOUBLE_EQUAL(val, 0, DBL_EPSILON);
262
265 CU_ASSERT(!clamped);
267 CU_ASSERT_DOUBLE_EQUAL(val, 2, DBL_EPSILON);
268
271 CU_ASSERT(!clamped);
273 CU_ASSERT_DOUBLE_EQUAL(val, 3, DBL_EPSILON);
274
277 CU_ASSERT(clamped);
278
281 CU_ASSERT(clamped);
282
285 CU_ASSERT(clamped);
286
289 CU_ASSERT(clamped);
290
297 CU_ASSERT_DOUBLE_EQUAL(val, 1, DBL_EPSILON);
298
303 CU_ASSERT_DOUBLE_EQUAL(val, 2, DBL_EPSILON);
304
309 CU_ASSERT_DOUBLE_EQUAL(val, 3, DBL_EPSILON);
310 }
311 }
312
314}
rt_band rt_band_new_inline(uint16_t width, uint16_t height, rt_pixtype pixtype, uint32_t hasnodata, double nodataval, uint8_t *data)
Create an in-db rt_band with no data.
void rt_band_set_ownsdata_flag(rt_band band, int flag)
void * rtalloc(size_t size)
Wrappers used for managing memory.
uint16_t rt_band_get_width(rt_band band)
Return width of this band.
rt_errorstate rt_band_get_pixel(rt_band band, int x, int y, double *value, int *nodata)
Get pixel value.
rt_errorstate rt_band_set_nodata(rt_band band, double val, int *converted)
Set nodata value.
rt_errorstate rt_band_set_pixel(rt_band band, int x, int y, double val, int *converted)
Set single pixel's value.
void rt_band_destroy(rt_band band)
Destroy a raster band.
rt_errorstate rt_band_get_nodata(rt_band band, double *nodata)
Get NODATA value.
int rt_band_get_ownsdata_flag(rt_band band)
Return 0 (FALSE) or non-zero (TRUE) indicating if rt_band is responsible for managing the memory for ...
uint16_t rt_band_get_height(rt_band band)
Return height of this band.
int rt_pixtype_size(rt_pixtype pixtype)
Return size in bytes of a value in the given pixtype.