public static function NumberTest::providerTestValidStep in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Component/Utility/NumberTest.php \Drupal\Tests\Component\Utility\NumberTest::providerTestValidStep()
Provides data for self::testNumberStep().
See also
\Drupal\Tests\Component\Utility\Number::testValidStep
File
- core/
tests/ Drupal/ Tests/ Component/ Utility/ NumberTest.php, line 62
Class
- NumberTest
- Tests number manipulation utilities.
Namespace
Drupal\Tests\Component\UtilityCode
public static function providerTestValidStep() {
return [
// Value and step equal.
[
10.3,
10.3,
TRUE,
],
// Valid integer steps.
[
42,
21,
TRUE,
],
[
42,
3,
TRUE,
],
// Valid float steps.
[
42,
10.5,
TRUE,
],
[
1,
1 / 3,
TRUE,
],
[
-100,
100 / 7,
TRUE,
],
[
1000,
-10,
TRUE,
],
// Valid and very small float steps.
[
1000.12345,
1.0E-10,
TRUE,
],
[
3.9999999999999,
1.0E-13,
TRUE,
],
// Invalid integer steps.
[
100,
30,
FALSE,
],
[
-10,
4,
FALSE,
],
// Invalid float steps.
[
6,
5 / 7,
FALSE,
],
[
10.3,
10.25,
FALSE,
],
// Step mismatches very close to being valid.
[
70 + 9.0E-7,
10 + 9.0E-7,
FALSE,
],
[
1936.5,
3.0E-8,
FALSE,
],
];
}