Source
$generator = yieldGraphScaleInterval($args['min'], $args['max'], $args['units'], $args['power'], $args['rows']);
<?php declare(strict_types = 0);
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
** without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
** See the GNU Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
use PHPUnit\Framework\TestCase;
class function_yieldGraphScaleIntervalTest extends TestCase {
public static function dataProvider() {
return [
// Non-binary, non-time units, one row only.
[
['min' => 0, 'max' => 1, 'units' => '', 'power' => 0, 'rows' => 1],
[1, 2, 5, 10]
],
[
['min' => 100, 'max' => 101, 'units' => '', 'power' => 0, 'rows' => 1],
[1, 2, 5, 10]
],
[
['min' => -101, 'max' => -100, 'units' => '', 'power' => 0, 'rows' => 1],
[1, 2, 5, 10]
],
[
['min' => -0.5, 'max' => 0.5, 'units' => '', 'power' => 0, 'rows' => 1],
[1, 2, 5, 10]
],
[
['min' => 0.001, 'max' => 0.005, 'units' => '', 'power' => 0, 'rows' => 1],
[0.005, 0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10]
],
[
['min' => 1003, 'max' => 1006, 'units' => '', 'power' => 0, 'rows' => 1],
[5, 10]
],
[
['min' => 1e307, 'max' => 2e307, 'units' => '', 'power' => 0, 'rows' => 1],
[1e307, 2e307, 5e307, 1e308, INF]
],
[
['min' => -2e307, 'max' => -1e307, 'units' => '', 'power' => 0, 'rows' => 1],
[1e307, 2e307, 5e307, 1e308, INF]
],
[
['min' => 0, 'max' => 3, 'units' => '', 'power' => 0, 'rows' => 1],
[5, 10]
],
[
['min' => 0, 'max' => 6, 'units' => '', 'power' => 0, 'rows' => 1],
[10, 20]
],