mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
bug - XDSL adslAtucCurrOutputPwr exception (Cisco CSCvj53634) (#15614)
* Cisco CSCvj53634 tests change RRD minimas to accept negative dbm output power unnecessary tests * unsignedAsSigned function * use new function Number::unsignedAsSigned * negative power for Vdsl as well * style * style * Add types * simplify and exception if over max value * Add tests * Style fixes * Tell phpstan to shut up --------- Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -126,4 +126,21 @@ class FunctionsTest extends TestCase
|
||||
$this->assertSame(1, Number::cast(1.0));
|
||||
$this->assertSame(2, Number::cast('2.000'));
|
||||
}
|
||||
|
||||
public function testNumberAsUnsigned()
|
||||
{
|
||||
$this->assertSame(42, Number::unsignedAsSigned('42')); /** @phpstan-ignore-line */
|
||||
$this->assertSame(2147483647, Number::unsignedAsSigned(2147483647));
|
||||
$this->assertSame(-2147483648, Number::unsignedAsSigned(2147483648));
|
||||
$this->assertSame(-2147483647, Number::unsignedAsSigned(2147483649));
|
||||
$this->assertSame(-1, Number::unsignedAsSigned(4294967295));
|
||||
}
|
||||
|
||||
public function testNumberAsUnsignedValueExceedsMaxUnsignedValue()
|
||||
{
|
||||
$this->expectException(\InvalidArgumentException::class);
|
||||
|
||||
// Exceeds the maximum representable value for a 32-bit unsigned integer
|
||||
Number::unsignedAsSigned(4294967296, 32);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user