640, 'Height' => 480, 'ZoneName' => 'All', 'Units' => 'Percent', 'Area' => 10000, 'PixelDiff' => 20, 'AlarmPixels' => 3072, 'FilterPixels' => 3072, 'BlobPixels' => 3072, 'Blobs' => 1, 'MinBlobSize' => 3072, 'MaxBlobSize' => 3072, 'MinX' => 0, 'MinY' => 0, 'MaxX' => 10, 'MaxY' => 10, )); } $_REQUEST = array('eid' => '5', 'fid' => '7', 'raw' => 'true'); try { include __DIR__.'/../../web/ajax/stats.php'; } catch (Done $e) { } $row = is_array($GLOBALS['out']) ? $GLOBALS['out']['raw'][0] : array(); $failures = 0; function check($n, $got, $want) { global $failures; if ($got === $want) { echo "ok - $n\n"; } else { $failures++; echo "FAIL - $n (got ".var_export($got, true).")\n"; } } check('alarm pixels are a share of the frame pixels', $row['AlarmPixels'] ?? null, '3072 (1.0%)'); check('single blob size is a share of the frame pixels', $row['BlobSizes'] ?? null, '3072 (1.0%)'); exit($failures ? 1 : 0);