feat(application): integrate measured-load ingestion training and planner source
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
// OFFLINE ONLY: no Symcon kernel, HTTP requests, timers or connected devices.
|
||||
if (PHP_SAPI !== 'cli' || function_exists('IPS_GetVariable')) {
|
||||
fwrite(STDERR, "This is an isolated CLI test, not a Symcon runtime script.\n");
|
||||
exit(2);
|
||||
}
|
||||
set_error_handler(static function (int $severity, string $message, string $file, int $line): bool {
|
||||
throw new ErrorException($message, 0, $severity, $file, $line);
|
||||
});
|
||||
try {
|
||||
$manifest = json_decode(file_get_contents(__DIR__ . '/SOURCE_MANIFEST.json'), true, 512, JSON_THROW_ON_ERROR);
|
||||
foreach ($manifest as $relative => $expected) {
|
||||
$path = __DIR__ . '/' . $relative;
|
||||
if (!is_file($path) || hash_file('sha256', $path) !== $expected) {
|
||||
throw new RuntimeException('Source manifest mismatch: ' . $relative);
|
||||
}
|
||||
$command = escapeshellarg(PHP_BINARY) . ' -l ' . escapeshellarg($path);
|
||||
$lines = [];
|
||||
exec($command, $lines, $code);
|
||||
if ($code !== 0) {
|
||||
throw new RuntimeException('PHP syntax failure: ' . $relative);
|
||||
}
|
||||
}
|
||||
require __DIR__ . '/libs/NetzfahrplanV4Bezugszaehler.php';
|
||||
require __DIR__ . '/libs/NetzfahrplanV4Betriebsdaten.php';
|
||||
require __DIR__ . '/libs/ManagerNetzfahrplanV4Trait.php';
|
||||
require __DIR__ . '/tests/fixtures/NativeV4Scenarios.php';
|
||||
require __DIR__ . '/tests/fixtures/V4BezugszaehlerScenarios.php';
|
||||
$native = \Belevo\EnelixEMS\Tests\NativeV4Scenarios::run();
|
||||
$meters = \Belevo\EnelixEMS\Tests\V4BezugszaehlerScenarios::run();
|
||||
if (count($native) !== 24 || count($meters) !== 20) {
|
||||
throw new RuntimeException('Expected 24 native and 20 meter scenarios.');
|
||||
}
|
||||
foreach (array_merge($native, $meters) as $name) {
|
||||
echo 'PASS ', $name, "\n";
|
||||
}
|
||||
echo 'PHP ', PHP_VERSION, ': 44 offline conversion scenarios passed.', "\n";
|
||||
echo "NOT a full EMS suite and NOT an IP-Symcon runtime/physical test.\n";
|
||||
} catch (Throwable $error) {
|
||||
fwrite(STDERR, 'FAIL: ' . $error->getMessage() . "\n");
|
||||
exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user