diverse änderungen
This commit is contained in:
1 parent
0e7b53e558
commit
54d5e58798
60 files changed
+1637
-122
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
// @ts-ignore Direkte Ausführung mit Node Type-Stripping.
|
||||
import { compareIoAddresses } from './ioAddressSort.ts';
|
||||
|
||||
test('sorts numerically by EA type, address byte and bit', () => {
|
||||
const rows = [
|
||||
{ adrType: 'AnalogOutput', adrByte: 0 },
|
||||
{ adrType: 'DigitalInput', adrByte: 10, adrBit: 0 },
|
||||
{ adrType: 'DigitalInput', adrByte: 2, adrBit: 7 },
|
||||
{ adrType: 'AnalogInput', adrByte: 20 },
|
||||
{ adrType: 'DigitalOutput', adrByte: 0, adrBit: 0 },
|
||||
{ adrType: 'DigitalInput', adrByte: 2, adrBit: 0 },
|
||||
{ adrType: 'AnalogInput', adrByte: 4 },
|
||||
];
|
||||
assert.deepEqual(rows.sort(compareIoAddresses).map(row => [row.adrType, row.adrByte, row.adrBit]), [
|
||||
['DigitalInput', 2, 0], ['DigitalInput', 2, 7], ['DigitalInput', 10, 0],
|
||||
['DigitalOutput', 0, 0], ['AnalogInput', 4, undefined], ['AnalogInput', 20, undefined], ['AnalogOutput', 0, undefined],
|
||||
]);
|
||||
});
|
||||
Reference in new issue
Block a user