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";
123 gdal_enabled_drivers = disable_all;
125 CU_ASSERT(ds == NULL);
132 gdal_enabled_drivers = enabled;
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);
int rt_util_gdal_register_all(int force_register_all)
static void test_rgb_to_hsv()
int rt_util_gdal_driver_registered(const char *drv)
static void test_hsv_to_rgb()
rt_errorstate rt_util_rgb_to_hsv(double rgb[3], double hsv[3])
#define PG_ADD_TEST(suite, testfunc)
char * gdal_enabled_drivers
static void test_util_gdal_open()
void misc_suite_setup(void)
GDALDatasetH rt_util_gdal_open(const char *fn, GDALAccess fn_access, int shared)
rt_errorstate rt_util_hsv_to_rgb(double hsv[3], double rgb[3])