64 return [
'properties' => [
'tzid' => $zone],
'geometry' => [
'type' =>
'Polygon',
'coordinates' =>
$rings]];
68$outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
69$hole = [[3, 3], [7, 3], [7, 7], [3, 7], [3, 3]];
72$source->observe(
demoFeature(
'Etc/GMT', [[[-10, -10], [20, -10], [20, 20], [-10, 20], [-10, -10]]]));
74demoCheck([
'Zone/Inner'],
$source->zonesAt(5, 5),
'Reference honors holes and enclaves');
79demoCheck(hash(
'sha256', pack(
'd*', 0, 0, 10, 0, 10, 10, 0, 10, 0, 0)),
$source->shapes[1][
'sha256'],
'Reference storage hash');
80demoCheck([
'east' => 10,
'west' => 0,
'north' => 10,
'south' => 0],
$source->shapes[1][
'bounds'],
'Source bounding box');
83demoCheck(
true, count(
$cases) >= 8,
'Both sides of a boundary are sampled');
86 if (($case[
'pair'] ??
'') ===
'1:0') {
$firstEdge[$case[
'side']] = $case; }
88demoCheck([
'Etc/GMT'],
$firstEdge[-1][
'expected'],
'South side of the square falls in the ocean');
89demoCheck([
'Zone/Outer'],
$firstEdge[1][
'expected'],
'North side of the square falls inside the zone');
90demoCheck(
true, abs(
$firstEdge[-1][
'params'][
'lat'] * 111.32 + 5) < 1e-8,
'Outside probe is five kilometers from the edge');
91demoCheck(
true, abs(
$firstEdge[1][
'params'][
'lat'] * 111.32 - 5) < 1e-8,
'Inside probe is five kilometers from the edge');
97 $circle .= pack(
'd2', 5 * cos($angle), 5 * sin($angle));
99foreach ([0, 1022, 1023, 1024, 2047, 2048, 2052] as $index) {
demoCheck($expected, $actual, string $label)
This compares one test result with its expected value.