-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFloating.php
More file actions
57 lines (47 loc) · 1.43 KB
/
Floating.php
File metadata and controls
57 lines (47 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
declare(strict_types=1);
/*
* This file is part of the QuidPHP package <https://quidphp.com>
* Author: Pierre-Philippe Emond <emondpph@gmail.com>
* License: https://github.com/quidphp/base/blob/master/LICENSE
*/
namespace Quid\Test\Base;
use Quid\Base;
// floating
// class for testing Quid\Base\Floating
class Floating extends Base\Test
{
// trigger
final public static function trigger(array $data):bool
{
// typecast
$a = '23.2';
$b = 'string';
Base\Floating::typecast($a,$b);
assert($a === 23.2);
assert($b === (float) 0);
// cast
assert(Base\Floating::cast('30MB') === null);
assert(Base\Floating::cast(true) === 1.0);
assert(Base\Floating::cast('1.5') === 1.5);
// is
assert(Base\Floating::is((float) 1));
assert(!Base\Floating::is(1));
assert(Base\Floating::is(log(0)));
// isEmpty
assert(!Base\Floating::isEmpty(1));
assert(Base\Floating::isEmpty((float) 0));
// isNotEmpty
assert(Base\Floating::isNotEmpty(1.2));
// isCast
assert(!Base\Floating::isCast(-1));
assert(Base\Floating::isCast(1.5));
assert(Base\Floating::isCast('1.5'));
assert(!Base\Floating::isCast('2'));
// isCastNotEmpty
assert(Base\Floating::isCastNotEmpty(1.5));
assert(!Base\Floating::isCastNotEmpty(0));
return true;
}
}
?>