PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ nd_stats_indexing_behaviour()

static void nd_stats_indexing_behaviour ( void  )
static

Definition at line 104 of file postgis/cunit/cu_tester.c.

105{
106 ND_STATS stats;
107 const int good_index[ND_DIMS] = {1, 2, 0, 0};
108 const int bad_index[ND_DIMS] = {1, 5, 0, 0};
109
110 memset(&stats, 0, sizeof(stats));
111 stats.ndims = 3;
112 stats.size[0] = 4.0f;
113 stats.size[1] = 5.0f;
114 stats.size[2] = 3.0f;
115
116 /* Three-dimensional index (x=1, y=2, z=0) collapses into 1 + 2 * 4. */
117 CU_ASSERT_EQUAL(nd_stats_value_index(&stats, good_index), 1 + 2 * 4);
118 /* Any request outside the histogram bounds triggers a guard. */
119 CU_ASSERT_EQUAL(nd_stats_value_index(&stats, bad_index), -1);
120
121 /* Regression for #5959: ndims higher than populated sizes still honours guards. */
122 stats.ndims = 4;
123 CU_ASSERT_EQUAL(nd_stats_value_index(&stats, good_index), -1);
124}
static int nd_stats_value_index(const ND_STATS *stats, const int *indexes)

References ND_DIMS, nd_stats_value_index(), ND_STATS_T::ndims, and ND_STATS_T::size.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function: