Fix DPT13.

This commit is contained in:
Laur Ivan 2022-03-13 01:57:51 +01:00
parent 4ba0246211
commit dcb3d2bea9
2 changed files with 27 additions and 1 deletions

25
.vscode/launch.json vendored Normal file
View File

@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha All",
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
"args": [
"-r",
"ts-node/register",
"--timeout",
"999999",
"--colors",
"${workspaceFolder}/tests/**/*.test.ts",
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"protocol": "inspector"
},
]
}

View File

@ -33,7 +33,8 @@ export class DPT13 implements DPT {
if (value === undefined || value === null || !Number.isFinite(value)) if (value === undefined || value === null || !Number.isFinite(value))
throw new InvalidValueError(`Value is not viable`) throw new InvalidValueError(`Value is not viable`)
if (Number.isInteger(value))
if (!Number.isInteger(value))
throw new InvalidValueError(`Value ${value} is not an integer`) throw new InvalidValueError(`Value ${value} is not an integer`)
if (value < this.range[0] || value > this.range[1]) if (value < this.range[0] || value > this.range[1])