summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@theqtcompany.com>2015-11-10 10:14:01 +0100
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2015-11-11 05:46:58 +0000
commitd4227f56e45a47165e9d6be3767fbbe672e71eb0 (patch)
treea62b265970456b1a853c9b1ea9cc29118e0be517 /tests
parent25a44edb74cfb80c273a5fa6d4b2e6dcbe028ce9 (diff)
Fix CRC checks in RTU slave and master
The previous check always succeeded as the crc check function result was not negated. In addition, the crc must be run over the entire ADU without the trailing 2 byte CRC. checkCRC() was renamed to improve readability of code and to avoid accidental inversion of CRC logic. Change-Id: Id9cb1a008152d60f49a3514c90f10f981613945a Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com> Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qmodbusdevice/tst_qmodbusdevice.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/auto/qmodbusdevice/tst_qmodbusdevice.cpp b/tests/auto/qmodbusdevice/tst_qmodbusdevice.cpp
index 04cc64b..c2cc2f0 100644
--- a/tests/auto/qmodbusdevice/tst_qmodbusdevice.cpp
+++ b/tests/auto/qmodbusdevice/tst_qmodbusdevice.cpp
@@ -238,7 +238,7 @@ void tst_QModbusDevice::testChecksumCRC()
QFETCH(quint16, crc);
QCOMPARE(device->d_func()->calculateCRC(pdu.constData(), pdu.size()), crc);
- QCOMPARE(device->d_func()->checkCRC(pdu.constData(), pdu.size(), crc), true);
+ QCOMPARE(device->d_func()->matchingCRC(pdu.constData(), pdu.size(), crc), true);
}
QTEST_MAIN(tst_QModbusDevice)