24 #include "CUnit/Basic.h"
28 double rgb[3] = {0, 0, 0};
29 double hsv[3] = {0, 0, 0};
32 CU_ASSERT_DOUBLE_EQUAL(hsv[0], 0, DBL_EPSILON);
33 CU_ASSERT_DOUBLE_EQUAL(hsv[1], 0, DBL_EPSILON);
34 CU_ASSERT_DOUBLE_EQUAL(hsv[2], 0, DBL_EPSILON);
40 CU_ASSERT_DOUBLE_EQUAL(hsv[0], 2/3., DBL_EPSILON);
41 CU_ASSERT_DOUBLE_EQUAL(hsv[1], 1, DBL_EPSILON);
42 CU_ASSERT_DOUBLE_EQUAL(hsv[2], 1, DBL_EPSILON);
48 CU_ASSERT_DOUBLE_EQUAL(hsv[0], 7/12., DBL_EPSILON);
49 CU_ASSERT_DOUBLE_EQUAL(hsv[1], 1, DBL_EPSILON);
50 CU_ASSERT_DOUBLE_EQUAL(hsv[2], 0.5, DBL_EPSILON);
56 CU_ASSERT_DOUBLE_EQUAL(hsv[0], 1/3., DBL_EPSILON);
57 CU_ASSERT_DOUBLE_EQUAL(hsv[1], 0.5, DBL_EPSILON);
58 CU_ASSERT_DOUBLE_EQUAL(hsv[2], 1, DBL_EPSILON);
64 CU_ASSERT_DOUBLE_EQUAL(hsv[0], 0.5, DBL_EPSILON);
65 CU_ASSERT_DOUBLE_EQUAL(hsv[1], 0.5, DBL_EPSILON);
66 CU_ASSERT_DOUBLE_EQUAL(hsv[2], 0.4, DBL_EPSILON);
70 double hsv[3] = {0, 0, 0};
71 double rgb[3] = {0, 0, 0};
74 CU_ASSERT_DOUBLE_EQUAL(rgb[0], 0, DBL_EPSILON);
75 CU_ASSERT_DOUBLE_EQUAL(rgb[1], 0, DBL_EPSILON);
76 CU_ASSERT_DOUBLE_EQUAL(rgb[2], 0, DBL_EPSILON);
82 CU_ASSERT_DOUBLE_EQUAL(rgb[0], 0., DBL_EPSILON);
83 CU_ASSERT_DOUBLE_EQUAL(rgb[1], 0, DBL_EPSILON);
84 CU_ASSERT_DOUBLE_EQUAL(rgb[2], 1, DBL_EPSILON);
90 CU_ASSERT_DOUBLE_EQUAL(rgb[0], 0, DBL_EPSILON);
91 CU_ASSERT_DOUBLE_EQUAL(rgb[1], 0.25, DBL_EPSILON);
92 CU_ASSERT_DOUBLE_EQUAL(rgb[2], 0.5, DBL_EPSILON);
98 CU_ASSERT_DOUBLE_EQUAL(rgb[0], 0.5, DBL_EPSILON);
99 CU_ASSERT_DOUBLE_EQUAL(rgb[1], 1, DBL_EPSILON);
100 CU_ASSERT_DOUBLE_EQUAL(rgb[2], 0.5, DBL_EPSILON);
106 CU_ASSERT_DOUBLE_EQUAL(rgb[0], 0.2, DBL_EPSILON);
107 CU_ASSERT_DOUBLE_EQUAL(rgb[1], 0.4, DBL_EPSILON);
108 CU_ASSERT_DOUBLE_EQUAL(rgb[2], 0.4, DBL_EPSILON);
117 char *enabled =
"GTiff JPEG PNG";
125 CU_ASSERT(
ds == NULL);
133 ds =
rt_util_gdal_open(
"/vsicurl/http://download.osgeo.org/gdal/data/gtiff/small_world.tif", GA_ReadOnly, 0);
134 CU_ASSERT(
ds == NULL);
149 CU_pSuite suite = CU_add_suite(
"misc", NULL, NULL);
#define PG_ADD_TEST(suite, testfunc)
rt_errorstate rt_util_rgb_to_hsv(double rgb[3], double hsv[3])
int rt_util_gdal_register_all(int force_register_all)
GDALDatasetH rt_util_gdal_open(const char *fn, GDALAccess fn_access, int shared)
int rt_util_gdal_driver_registered(const char *drv)
rt_errorstate rt_util_hsv_to_rgb(double hsv[3], double rgb[3])
static void test_util_gdal_open()
void misc_suite_setup(void)
static void test_hsv_to_rgb()
static void test_rgb_to_hsv()
char * gdal_enabled_drivers