Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
fd679552
Commit
fd679552
authored
Sep 04, 2018
by
Pavel Vainerman
Committed by
Pavel Vainerman
Nov 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(CI): minor fixes in tests (for tests in docker)
parent
620bdbe5
Pipeline
#3761
passed with stage
in 8 minutes 22 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
70 additions
and
72 deletions
+70
-72
.gitlab-ci.yml
.gitlab-ci.yml
+0
-2
run_test_mbtcpmaster.sh
extensions/ModbusMaster/tests/run_test_mbtcpmaster.sh
+1
-1
run_test_mbtcpmultimaster.sh
extensions/ModbusMaster/tests/run_test_mbtcpmultimaster.sh
+1
-1
test_mbtcpmaster.cc
extensions/ModbusMaster/tests/test_mbtcpmaster.cc
+64
-64
test_delaytimer.cc
tests/test_delaytimer.cc
+2
-2
test_passivetimer.cc
tests/test_passivetimer.cc
+2
-2
No files found.
.gitlab-ci.yml
View file @
fd679552
...
@@ -9,8 +9,6 @@ build and test:
...
@@ -9,8 +9,6 @@ build and test:
stage
:
build
stage
:
build
script
:
script
:
-
daas rpmbuild sisyphus --use-ccache --ccache ${CI_PROJECT_DIR}/ccache uniset-check.sh
-
daas rpmbuild sisyphus --use-ccache --ccache ${CI_PROJECT_DIR}/ccache uniset-check.sh
-
git clean -dxf
-
daas rpmbuild --use-ccache --ccache ${CI_PROJECT_DIR}/ccache p8 uniset-check.sh
after_script
:
after_script
:
-
mkdir -p ${CI_PROJECT_DIR}/${ARTIFACTS_PATH}
-
mkdir -p ${CI_PROJECT_DIR}/${ARTIFACTS_PATH}
-
cp -ar ${CI_PROJECT_DIR}/testsuite ${CI_PROJECT_DIR}/${ARTIFACTS_PATH}/
-
cp -ar ${CI_PROJECT_DIR}/testsuite ${CI_PROJECT_DIR}/${ARTIFACTS_PATH}/
...
...
extensions/ModbusMaster/tests/run_test_mbtcpmaster.sh
View file @
fd679552
...
@@ -15,7 +15,7 @@ cd -
...
@@ -15,7 +15,7 @@ cd -
--mbtcp-filter-value
1
\
--mbtcp-filter-value
1
\
--mbtcp-gateway-iaddr
localhost
\
--mbtcp-gateway-iaddr
localhost
\
--mbtcp-gateway-port
20048
\
--mbtcp-gateway-port
20048
\
--mbtcp-polltime
50
--mbtcp-recv-timeout
5
00
--mbtcp-polltime
50
--mbtcp-recv-timeout
2
00
#--mbtcp-log-add-levels any
#--mbtcp-log-add-levels any
#--mbtcp-default-mbinit-ok 1
#--mbtcp-default-mbinit-ok 1
#--dlog-add-levels any
#--dlog-add-levels any
...
...
extensions/ModbusMaster/tests/run_test_mbtcpmultimaster.sh
View file @
fd679552
...
@@ -13,7 +13,7 @@ cd -
...
@@ -13,7 +13,7 @@ cd -
--smemory-id
SharedMemory
\
--smemory-id
SharedMemory
\
--mbtcp-filter-field
mb
\
--mbtcp-filter-field
mb
\
--mbtcp-filter-value
1
\
--mbtcp-filter-value
1
\
--mbtcp-polltime
50
--mbtcp-recv-timeout
500
--mbtcp-checktime
1000
--mbtcp-timeout
3000
--mbtcp-ignore-timeout
30
00
--dlog-add-levels
warn,crit
--mbtcp-polltime
50
--mbtcp-recv-timeout
500
--mbtcp-checktime
500
--mbtcp-timeout
2500
--mbtcp-ignore-timeout
25
00
--dlog-add-levels
warn,crit
# --dlog-add-levels any
# --dlog-add-levels any
#--mbtcp-force-out 1
#--mbtcp-force-out 1
#--dlog-add-levels any
#--dlog-add-levels any
extensions/ModbusMaster/tests/test_mbtcpmaster.cc
View file @
fd679552
...
@@ -174,13 +174,13 @@ TEST_CASE("MBTCPMaster: 0x01 (read coil status)", "[modbus][0x01][mbmaster][mbtc
...
@@ -174,13 +174,13 @@ TEST_CASE("MBTCPMaster: 0x01 (read coil status)", "[modbus][0x01][mbmaster][mbtc
CHECK
(
ui
->
isExist
(
mbID
)
);
CHECK
(
ui
->
isExist
(
mbID
)
);
mbs
->
setReply
(
65535
);
mbs
->
setReply
(
65535
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1000
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1000
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1001
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1001
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1002
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1002
)
==
1
);
mbs
->
setReply
(
0
);
mbs
->
setReply
(
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1000
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1000
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1001
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1001
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1002
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1002
)
==
0
);
...
@@ -192,13 +192,13 @@ TEST_CASE("MBTCPMaster: 0x02 (read input status)", "[modbus][0x02][mbmaster][mbt
...
@@ -192,13 +192,13 @@ TEST_CASE("MBTCPMaster: 0x02 (read input status)", "[modbus][0x02][mbmaster][mbt
CHECK
(
ui
->
isExist
(
mbID
)
);
CHECK
(
ui
->
isExist
(
mbID
)
);
mbs
->
setReply
(
65535
);
mbs
->
setReply
(
65535
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1040
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1040
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1041
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1041
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1042
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1042
)
==
1
);
mbs
->
setReply
(
0
);
mbs
->
setReply
(
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1040
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1040
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1041
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1041
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1042
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1042
)
==
0
);
...
@@ -210,25 +210,25 @@ TEST_CASE("MBTCPMaster: 0x03 (read register outputs or memories or read word out
...
@@ -210,25 +210,25 @@ TEST_CASE("MBTCPMaster: 0x03 (read register outputs or memories or read word out
CHECK
(
ui
->
isExist
(
mbID
)
);
CHECK
(
ui
->
isExist
(
mbID
)
);
mbs
->
setReply
(
10
);
mbs
->
setReply
(
10
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1004
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1004
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1005
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1005
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1006
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1006
)
==
10
);
mbs
->
setReply
(
-
10
);
mbs
->
setReply
(
-
10
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1004
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1004
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1005
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1005
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1006
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1006
)
==
-
10
);
mbs
->
setReply
(
1
);
mbs
->
setReply
(
1
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1004
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1004
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1005
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1005
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1006
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1006
)
==
1
);
mbs
->
setReply
(
65535
);
mbs
->
setReply
(
65535
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
-
1
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
-
1
);
REQUIRE
(
ui
->
getValue
(
1004
)
==
-
1
);
REQUIRE
(
ui
->
getValue
(
1004
)
==
-
1
);
REQUIRE
(
ui
->
getValue
(
1005
)
==
-
1
);
REQUIRE
(
ui
->
getValue
(
1005
)
==
-
1
);
...
@@ -236,7 +236,7 @@ TEST_CASE("MBTCPMaster: 0x03 (read register outputs or memories or read word out
...
@@ -236,7 +236,7 @@ TEST_CASE("MBTCPMaster: 0x03 (read register outputs or memories or read word out
REQUIRE
(
ui
->
getValue
(
1007
)
==
65535
);
// unsigned
REQUIRE
(
ui
->
getValue
(
1007
)
==
65535
);
// unsigned
mbs
->
setReply
(
std
::
numeric_limits
<
uint16_t
>::
max
()
);
mbs
->
setReply
(
std
::
numeric_limits
<
uint16_t
>::
max
()
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
(
uint16_t
)
ui
->
getValue
(
1009
)
==
std
::
numeric_limits
<
uint16_t
>::
max
()
);
// U2
REQUIRE
(
(
uint16_t
)
ui
->
getValue
(
1009
)
==
std
::
numeric_limits
<
uint16_t
>::
max
()
);
// U2
mbs
->
setReply
(
std
::
numeric_limits
<
int16_t
>::
max
()
);
mbs
->
setReply
(
std
::
numeric_limits
<
int16_t
>::
max
()
);
...
@@ -244,7 +244,7 @@ TEST_CASE("MBTCPMaster: 0x03 (read register outputs or memories or read word out
...
@@ -244,7 +244,7 @@ TEST_CASE("MBTCPMaster: 0x03 (read register outputs or memories or read word out
REQUIRE
(
(
int16_t
)
ui
->
getValue
(
1008
)
==
std
::
numeric_limits
<
int16_t
>::
max
()
);
// I2
REQUIRE
(
(
int16_t
)
ui
->
getValue
(
1008
)
==
std
::
numeric_limits
<
int16_t
>::
max
()
);
// I2
mbs
->
setReply
(
0xff
);
mbs
->
setReply
(
0xff
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1008
)
==
0x00ff00ff
);
// I2
REQUIRE
(
ui
->
getValue
(
1008
)
==
0x00ff00ff
);
// I2
REQUIRE
(
ui
->
getValue
(
1009
)
==
0x00ff00ff
);
// U2
REQUIRE
(
ui
->
getValue
(
1009
)
==
0x00ff00ff
);
// U2
...
@@ -259,25 +259,25 @@ TEST_CASE("MBTCPMaster: 0x04 (read input registers or memories or read word outp
...
@@ -259,25 +259,25 @@ TEST_CASE("MBTCPMaster: 0x04 (read input registers or memories or read word outp
CHECK
(
ui
->
isExist
(
mbID
)
);
CHECK
(
ui
->
isExist
(
mbID
)
);
mbs
->
setReply
(
10
);
mbs
->
setReply
(
10
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1010
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1010
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1011
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1011
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1012
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1012
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1013
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1013
)
==
10
);
mbs
->
setReply
(
-
10
);
mbs
->
setReply
(
-
10
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1010
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1010
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1011
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1011
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1012
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1012
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1013
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1013
)
==
-
10
);
mbs
->
setReply
(
0
);
mbs
->
setReply
(
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1010
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1010
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1011
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1011
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1012
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1012
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1013
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1013
)
==
0
);
mbs
->
setReply
(
65535
);
mbs
->
setReply
(
65535
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1010
)
==
-
1
);
REQUIRE
(
ui
->
getValue
(
1010
)
==
-
1
);
REQUIRE
(
ui
->
getValue
(
1011
)
==
-
1
);
REQUIRE
(
ui
->
getValue
(
1011
)
==
-
1
);
REQUIRE
(
ui
->
getValue
(
1012
)
==
-
1
);
REQUIRE
(
ui
->
getValue
(
1012
)
==
-
1
);
...
@@ -285,15 +285,15 @@ TEST_CASE("MBTCPMaster: 0x04 (read input registers or memories or read word outp
...
@@ -285,15 +285,15 @@ TEST_CASE("MBTCPMaster: 0x04 (read input registers or memories or read word outp
REQUIRE
(
ui
->
getValue
(
1014
)
==
65535
);
// unsigned
REQUIRE
(
ui
->
getValue
(
1014
)
==
65535
);
// unsigned
mbs
->
setReply
(
std
::
numeric_limits
<
uint16_t
>::
max
()
);
mbs
->
setReply
(
std
::
numeric_limits
<
uint16_t
>::
max
()
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
(
uint16_t
)
ui
->
getValue
(
1009
)
==
std
::
numeric_limits
<
uint16_t
>::
max
()
);
// U2
REQUIRE
(
(
uint16_t
)
ui
->
getValue
(
1009
)
==
std
::
numeric_limits
<
uint16_t
>::
max
()
);
// U2
mbs
->
setReply
(
std
::
numeric_limits
<
int16_t
>::
max
()
);
mbs
->
setReply
(
std
::
numeric_limits
<
int16_t
>::
max
()
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
(
int16_t
)
ui
->
getValue
(
1008
)
==
std
::
numeric_limits
<
int16_t
>::
max
()
);
// I2
REQUIRE
(
(
int16_t
)
ui
->
getValue
(
1008
)
==
std
::
numeric_limits
<
int16_t
>::
max
()
);
// I2
mbs
->
setReply
(
0xff
);
mbs
->
setReply
(
0xff
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1015
)
==
0x00ff00ff
);
// I2
REQUIRE
(
ui
->
getValue
(
1015
)
==
0x00ff00ff
);
// I2
REQUIRE
(
ui
->
getValue
(
1016
)
==
0x00ff00ff
);
// U2
REQUIRE
(
ui
->
getValue
(
1016
)
==
0x00ff00ff
);
// U2
...
@@ -309,17 +309,17 @@ TEST_CASE("MBTCPMaster: 0x05 (forces a single coil to either ON or OFF)", "[modb
...
@@ -309,17 +309,17 @@ TEST_CASE("MBTCPMaster: 0x05 (forces a single coil to either ON or OFF)", "[modb
CHECK
(
ui
->
isExist
(
mbID
)
);
CHECK
(
ui
->
isExist
(
mbID
)
);
ui
->
setValue
(
1017
,
0
);
ui
->
setValue
(
1017
,
0
);
REQUIRE
(
ui
->
getValue
(
1017
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1017
)
==
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
CHECK_FALSE
(
mbs
->
getForceSingleCoilCmd
()
);
CHECK_FALSE
(
mbs
->
getForceSingleCoilCmd
()
);
ui
->
setValue
(
1017
,
1
);
ui
->
setValue
(
1017
,
1
);
REQUIRE
(
ui
->
getValue
(
1017
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1017
)
==
1
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
CHECK
(
mbs
->
getForceSingleCoilCmd
()
);
CHECK
(
mbs
->
getForceSingleCoilCmd
()
);
ui
->
setValue
(
1017
,
0
);
ui
->
setValue
(
1017
,
0
);
REQUIRE
(
ui
->
getValue
(
1017
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1017
)
==
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
CHECK_FALSE
(
mbs
->
getForceSingleCoilCmd
()
);
CHECK_FALSE
(
mbs
->
getForceSingleCoilCmd
()
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -330,22 +330,22 @@ TEST_CASE("MBTCPMaster: 0x06 (write register outputs or memories)", "[modbus][0x
...
@@ -330,22 +330,22 @@ TEST_CASE("MBTCPMaster: 0x06 (write register outputs or memories)", "[modbus][0x
CHECK
(
ui
->
isExist
(
mbID
)
);
CHECK
(
ui
->
isExist
(
mbID
)
);
ui
->
setValue
(
1018
,
0
);
ui
->
setValue
(
1018
,
0
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
0
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
0
);
ui
->
setValue
(
1018
,
100
);
ui
->
setValue
(
1018
,
100
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
100
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
100
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
100
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
100
);
ui
->
setValue
(
1018
,
-
100
);
ui
->
setValue
(
1018
,
-
100
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
-
100
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
-
100
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
-
100
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
-
100
);
ui
->
setValue
(
1018
,
0
);
ui
->
setValue
(
1018
,
0
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
0
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
0
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -361,7 +361,7 @@ TEST_CASE("MBTCPMaster: 0x0F (force multiple coils)", "[modbus][0x0F][mbmaster][
...
@@ -361,7 +361,7 @@ TEST_CASE("MBTCPMaster: 0x0F (force multiple coils)", "[modbus][0x0F][mbmaster][
REQUIRE
(
ui
->
getValue
(
1024
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1024
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1025
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1025
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1026
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1026
)
==
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
ModbusRTU
::
ForceCoilsMessage
q
=
mbs
->
getLastForceCoilsQ
();
ModbusRTU
::
ForceCoilsMessage
q
=
mbs
->
getLastForceCoilsQ
();
REQUIRE
(
q
.
start
==
38
);
REQUIRE
(
q
.
start
==
38
);
...
@@ -372,7 +372,7 @@ TEST_CASE("MBTCPMaster: 0x0F (force multiple coils)", "[modbus][0x0F][mbmaster][
...
@@ -372,7 +372,7 @@ TEST_CASE("MBTCPMaster: 0x0F (force multiple coils)", "[modbus][0x0F][mbmaster][
{
{
ui
->
setValue
(
1025
,
1
);
ui
->
setValue
(
1025
,
1
);
REQUIRE
(
ui
->
getValue
(
1025
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1025
)
==
1
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
ModbusRTU
::
ForceCoilsMessage
q
=
mbs
->
getLastForceCoilsQ
();
ModbusRTU
::
ForceCoilsMessage
q
=
mbs
->
getLastForceCoilsQ
();
REQUIRE
(
q
.
start
==
38
);
REQUIRE
(
q
.
start
==
38
);
...
@@ -383,7 +383,7 @@ TEST_CASE("MBTCPMaster: 0x0F (force multiple coils)", "[modbus][0x0F][mbmaster][
...
@@ -383,7 +383,7 @@ TEST_CASE("MBTCPMaster: 0x0F (force multiple coils)", "[modbus][0x0F][mbmaster][
{
{
ui
->
setValue
(
1024
,
1
);
ui
->
setValue
(
1024
,
1
);
REQUIRE
(
ui
->
getValue
(
1024
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1024
)
==
1
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
ModbusRTU
::
ForceCoilsMessage
q
=
mbs
->
getLastForceCoilsQ
();
ModbusRTU
::
ForceCoilsMessage
q
=
mbs
->
getLastForceCoilsQ
();
REQUIRE
(
q
.
start
==
38
);
REQUIRE
(
q
.
start
==
38
);
...
@@ -398,7 +398,7 @@ TEST_CASE("MBTCPMaster: 0x0F (force multiple coils)", "[modbus][0x0F][mbmaster][
...
@@ -398,7 +398,7 @@ TEST_CASE("MBTCPMaster: 0x0F (force multiple coils)", "[modbus][0x0F][mbmaster][
REQUIRE
(
ui
->
getValue
(
1024
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1024
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1025
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1025
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1026
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1026
)
==
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
ModbusRTU
::
ForceCoilsMessage
q
=
mbs
->
getLastForceCoilsQ
();
ModbusRTU
::
ForceCoilsMessage
q
=
mbs
->
getLastForceCoilsQ
();
REQUIRE
(
q
.
start
==
38
);
REQUIRE
(
q
.
start
==
38
);
...
@@ -420,7 +420,7 @@ TEST_CASE("MBTCPMaster: 0x10 (write register outputs or memories)", "[modbus][0x
...
@@ -420,7 +420,7 @@ TEST_CASE("MBTCPMaster: 0x10 (write register outputs or memories)", "[modbus][0x
REQUIRE
(
ui
->
getValue
(
1020
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1020
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1021
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1021
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1022
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1022
)
==
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
ModbusRTU
::
WriteOutputMessage
q
=
mbs
->
getLastWriteOutput
();
ModbusRTU
::
WriteOutputMessage
q
=
mbs
->
getLastWriteOutput
();
REQUIRE
(
q
.
addr
==
slaveADDR
);
REQUIRE
(
q
.
addr
==
slaveADDR
);
...
@@ -440,7 +440,7 @@ TEST_CASE("MBTCPMaster: 0x10 (write register outputs or memories)", "[modbus][0x
...
@@ -440,7 +440,7 @@ TEST_CASE("MBTCPMaster: 0x10 (write register outputs or memories)", "[modbus][0x
REQUIRE
(
ui
->
getValue
(
1020
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1020
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1021
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1021
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1022
)
==
65535
);
REQUIRE
(
ui
->
getValue
(
1022
)
==
65535
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
ModbusRTU
::
WriteOutputMessage
q
=
mbs
->
getLastWriteOutput
();
ModbusRTU
::
WriteOutputMessage
q
=
mbs
->
getLastWriteOutput
();
REQUIRE
(
q
.
addr
==
slaveADDR
);
REQUIRE
(
q
.
addr
==
slaveADDR
);
...
@@ -458,7 +458,7 @@ TEST_CASE("MBTCPMaster: 0x10 (write register outputs or memories)", "[modbus][0x
...
@@ -458,7 +458,7 @@ TEST_CASE("MBTCPMaster: 0x10 (write register outputs or memories)", "[modbus][0x
REQUIRE
(
ui
->
getValue
(
1019
)
==
-
100
);
REQUIRE
(
ui
->
getValue
(
1019
)
==
-
100
);
REQUIRE
(
ui
->
getValue
(
1021
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1021
)
==
-
10
);
REQUIRE
(
ui
->
getValue
(
1022
)
==
-
32767
);
REQUIRE
(
ui
->
getValue
(
1022
)
==
-
32767
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
ModbusRTU
::
WriteOutputMessage
q
=
mbs
->
getLastWriteOutput
();
ModbusRTU
::
WriteOutputMessage
q
=
mbs
->
getLastWriteOutput
();
REQUIRE
(
q
.
addr
==
slaveADDR
);
REQUIRE
(
q
.
addr
==
slaveADDR
);
...
@@ -473,7 +473,7 @@ TEST_CASE("MBTCPMaster: 0x10 (write register outputs or memories)", "[modbus][0x
...
@@ -473,7 +473,7 @@ TEST_CASE("MBTCPMaster: 0x10 (write register outputs or memories)", "[modbus][0x
{
{
ui
->
setValue
(
1023
,
std
::
numeric_limits
<
uint32_t
>::
max
());
ui
->
setValue
(
1023
,
std
::
numeric_limits
<
uint32_t
>::
max
());
REQUIRE
(
(
uint32_t
)
ui
->
getValue
(
1023
)
==
std
::
numeric_limits
<
uint32_t
>::
max
()
);
REQUIRE
(
(
uint32_t
)
ui
->
getValue
(
1023
)
==
std
::
numeric_limits
<
uint32_t
>::
max
()
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
ModbusRTU
::
WriteOutputMessage
q
=
mbs
->
getLastWriteOutput
();
ModbusRTU
::
WriteOutputMessage
q
=
mbs
->
getLastWriteOutput
();
REQUIRE
(
q
.
addr
==
slaveADDR
);
REQUIRE
(
q
.
addr
==
slaveADDR
);
...
@@ -493,14 +493,14 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
...
@@ -493,14 +493,14 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
SECTION
(
"read"
)
SECTION
(
"read"
)
{
{
mbs
->
setReply
(
10
);
mbs
->
setReply
(
10
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
10
);
}
}
SECTION
(
"write"
)
SECTION
(
"write"
)
{
{
ui
->
setValue
(
1018
,
10
);
ui
->
setValue
(
1018
,
10
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
10
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
10
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
10
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
10
);
}
}
}
}
...
@@ -514,10 +514,10 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
...
@@ -514,10 +514,10 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
SECTION
(
"read"
)
SECTION
(
"read"
)
{
{
mbs
->
setReply
(
150
);
mbs
->
setReply
(
150
);
msleep
(
2
*
polltime
+
2
00
);
msleep
(
2
*
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
!=
150
);
REQUIRE
(
ui
->
getValue
(
1003
)
!=
150
);
mbs
->
setReply
(
-
10
);
mbs
->
setReply
(
-
10
);
msleep
(
2
*
polltime
+
2
00
);
msleep
(
2
*
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
!=
-
10
);
REQUIRE
(
ui
->
getValue
(
1003
)
!=
-
10
);
REQUIRE
(
ui
->
getValue
(
1003
)
!=
150
);
REQUIRE
(
ui
->
getValue
(
1003
)
!=
150
);
}
}
...
@@ -525,11 +525,11 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
...
@@ -525,11 +525,11 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
{
{
ui
->
setValue
(
1018
,
150
);
ui
->
setValue
(
1018
,
150
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
150
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
150
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
150
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
150
);
ui
->
setValue
(
1018
,
155
);
ui
->
setValue
(
1018
,
155
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
155
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
155
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
155
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
155
);
}
}
}
}
...
@@ -543,21 +543,21 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
...
@@ -543,21 +543,21 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
SECTION
(
"read"
)
SECTION
(
"read"
)
{
{
mbs
->
setReply
(
150
);
mbs
->
setReply
(
150
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
150
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
150
);
mbs
->
setReply
(
-
100
);
mbs
->
setReply
(
-
100
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
-
100
);
REQUIRE
(
ui
->
getValue
(
1003
)
==
-
100
);
}
}
SECTION
(
"write"
)
SECTION
(
"write"
)
{
{
ui
->
setValue
(
1018
,
50
);
ui
->
setValue
(
1018
,
50
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
50
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
50
);
msleep
(
2
*
polltime
+
2
00
);
msleep
(
2
*
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
!=
50
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
!=
50
);
ui
->
setValue
(
1018
,
55
);
ui
->
setValue
(
1018
,
55
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
55
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
55
);
msleep
(
2
*
polltime
+
2
00
);
msleep
(
2
*
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
!=
55
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
!=
55
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
!=
50
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
!=
50
);
}
}
...
@@ -572,7 +572,7 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
...
@@ -572,7 +572,7 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
SECTION
(
"read"
)
SECTION
(
"read"
)
{
{
mbs
->
setReply
(
50
);
mbs
->
setReply
(
50
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
!=
50
);
REQUIRE
(
ui
->
getValue
(
1003
)
!=
50
);
}
}
SECTION
(
"write"
)
SECTION
(
"write"
)
...
@@ -580,11 +580,11 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
...
@@ -580,11 +580,11 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
// а write работает в этом режиме.. (а чем отличается от writeOnly?)
// а write работает в этом режиме.. (а чем отличается от writeOnly?)
ui
->
setValue
(
1018
,
60
);
ui
->
setValue
(
1018
,
60
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
60
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
60
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
60
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
60
);
ui
->
setValue
(
1018
,
65
);
ui
->
setValue
(
1018
,
65
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
65
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
65
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
65
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
==
65
);
}
}
}
}
...
@@ -598,14 +598,14 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
...
@@ -598,14 +598,14 @@ TEST_CASE("MBTCPMaster: exchangeMode", "[modbus][exchangemode][mbmaster][mbtcpma
SECTION
(
"read"
)
SECTION
(
"read"
)
{
{
mbs
->
setReply
(
70
);
mbs
->
setReply
(
70
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1003
)
!=
70
);
REQUIRE
(
ui
->
getValue
(
1003
)
!=
70
);
}
}
SECTION
(
"write"
)
SECTION
(
"write"
)
{
{
ui
->
setValue
(
1018
,
70
);
ui
->
setValue
(
1018
,
70
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
70
);
REQUIRE
(
ui
->
getValue
(
1018
)
==
70
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
!=
70
);
REQUIRE
(
mbs
->
getLastWriteOutputSingleRegister
()
!=
70
);
}
}
...
@@ -686,27 +686,27 @@ TEST_CASE("MBTCPMaster: safe mode", "[modbus][safemode][mbmaster][mbtcpmaster]")
...
@@ -686,27 +686,27 @@ TEST_CASE("MBTCPMaster: safe mode", "[modbus][safemode][mbmaster][mbtcpmaster]")
ui
->
setValue
(
1050
,
0
);
// отключаем safeMode
ui
->
setValue
(
1050
,
0
);
// отключаем safeMode
mbs
->
setReply
(
53
);
mbs
->
setReply
(
53
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1051
)
==
53
);
REQUIRE
(
ui
->
getValue
(
1051
)
==
53
);
REQUIRE
(
ui
->
getValue
(
1052
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1052
)
==
1
);
mbs
->
setReply
(
0
);
mbs
->
setReply
(
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1051
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1051
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1052
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1052
)
==
0
);
ui
->
setValue
(
1050
,
42
);
// включаем safeMode
ui
->
setValue
(
1050
,
42
);
// включаем safeMode
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1051
)
==
42
);
REQUIRE
(
ui
->
getValue
(
1051
)
==
42
);
REQUIRE
(
ui
->
getValue
(
1052
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1052
)
==
1
);
mbs
->
setReply
(
53
);
mbs
->
setReply
(
53
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1051
)
==
42
);
REQUIRE
(
ui
->
getValue
(
1051
)
==
42
);
REQUIRE
(
ui
->
getValue
(
1052
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1052
)
==
1
);
ui
->
setValue
(
1050
,
0
);
// отключаем safeMode
ui
->
setValue
(
1050
,
0
);
// отключаем safeMode
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1051
)
==
53
);
REQUIRE
(
ui
->
getValue
(
1051
)
==
53
);
REQUIRE
(
ui
->
getValue
(
1052
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1052
)
==
1
);
}
}
...
@@ -716,12 +716,12 @@ TEST_CASE("MBTCPMaster: safe mode (resetIfNotRespond)", "[modbus][safemode][mbma
...
@@ -716,12 +716,12 @@ TEST_CASE("MBTCPMaster: safe mode (resetIfNotRespond)", "[modbus][safemode][mbma
InitTest
();
InitTest
();
mbs
->
setReply
(
53
);
mbs
->
setReply
(
53
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1053
)
==
53
);
REQUIRE
(
ui
->
getValue
(
1053
)
==
53
);
REQUIRE
(
ui
->
getValue
(
1054
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1054
)
==
1
);
mbs
->
setReply
(
0
);
mbs
->
setReply
(
0
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1053
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1053
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1054
)
==
0
);
REQUIRE
(
ui
->
getValue
(
1054
)
==
0
);
...
@@ -731,7 +731,7 @@ TEST_CASE("MBTCPMaster: safe mode (resetIfNotRespond)", "[modbus][safemode][mbma
...
@@ -731,7 +731,7 @@ TEST_CASE("MBTCPMaster: safe mode (resetIfNotRespond)", "[modbus][safemode][mbma
REQUIRE
(
ui
->
getValue
(
1054
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1054
)
==
1
);
mbs
->
setReply
(
53
);
mbs
->
setReply
(
53
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1053
)
==
42
);
REQUIRE
(
ui
->
getValue
(
1053
)
==
42
);
REQUIRE
(
ui
->
getValue
(
1054
)
==
1
);
REQUIRE
(
ui
->
getValue
(
1054
)
==
1
);
...
@@ -746,11 +746,11 @@ TEST_CASE("MBTCPMaster: udefined value", "[modbus][undefined][mbmaster][mbtcpmas
...
@@ -746,11 +746,11 @@ TEST_CASE("MBTCPMaster: udefined value", "[modbus][undefined][mbmaster][mbtcpmas
InitTest
();
InitTest
();
mbs
->
setReply
(
120
);
mbs
->
setReply
(
120
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1070
)
==
120
);
REQUIRE
(
ui
->
getValue
(
1070
)
==
120
);
mbs
->
setReply
(
10
);
mbs
->
setReply
(
10
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
try
try
{
{
...
@@ -762,7 +762,7 @@ TEST_CASE("MBTCPMaster: udefined value", "[modbus][undefined][mbmaster][mbtcpmas
...
@@ -762,7 +762,7 @@ TEST_CASE("MBTCPMaster: udefined value", "[modbus][undefined][mbmaster][mbtcpmas
}
}
mbs
->
setReply
(
120
);
mbs
->
setReply
(
120
);
msleep
(
polltime
+
2
00
);
msleep
(
polltime
+
3
00
);
REQUIRE
(
ui
->
getValue
(
1070
)
==
120
);
REQUIRE
(
ui
->
getValue
(
1070
)
==
120
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
@@ -788,7 +788,7 @@ TEST_CASE("MBTCPMaster: 0x10 (F2)", "[modbus][0x10][F2][mbmaster][mbtcpmaster]")
...
@@ -788,7 +788,7 @@ TEST_CASE("MBTCPMaster: 0x10 (F2)", "[modbus][0x10][F2][mbmaster][mbtcpmaster]")
ui->setValue(1027, 112);
ui->setValue(1027, 112);
REQUIRE( ui->getValue(1027) == 112 );
REQUIRE( ui->getValue(1027) == 112 );
msleep(polltime +
2
00);
msleep(polltime +
3
00);
ModbusRTU::WriteOutputMessage q = mbs->getLastWriteOutput();
ModbusRTU::WriteOutputMessage q = mbs->getLastWriteOutput();
REQUIRE( q.addr == slaveADDR );
REQUIRE( q.addr == slaveADDR );
REQUIRE( q.start == 41 );
REQUIRE( q.start == 41 );
...
@@ -807,7 +807,7 @@ TEST_CASE("MBTCPMaster: 0x10 (F4)", "[modbus][0x10][F4][mbmaster][mbtcpmaster]")
...
@@ -807,7 +807,7 @@ TEST_CASE("MBTCPMaster: 0x10 (F4)", "[modbus][0x10][F4][mbmaster][mbtcpmaster]")
ui->setValue(1028, v);
ui->setValue(1028, v);
REQUIRE( ui->getValue(1028) == v );
REQUIRE( ui->getValue(1028) == v );
msleep(polltime +
2
00);
msleep(polltime +
3
00);
ModbusRTU::WriteOutputMessage q = mbs->getLastWriteOutput();
ModbusRTU::WriteOutputMessage q = mbs->getLastWriteOutput();
REQUIRE( q.addr == slaveADDR );
REQUIRE( q.addr == slaveADDR );
REQUIRE( q.start == 45 );
REQUIRE( q.start == 45 );
...
@@ -827,7 +827,7 @@ TEST_CASE("MBTCPMaster: FasAO -> FasAI", "[modbus][float]")
...
@@ -827,7 +827,7 @@ TEST_CASE("MBTCPMaster: FasAO -> FasAI", "[modbus][float]")
ui->setValue(1027, 116);
ui->setValue(1027, 116);
REQUIRE( ui->getValue(1027) == 116 );
REQUIRE( ui->getValue(1027) == 116 );
msleep(polltime +
2
00);
msleep(polltime +
3
00);
ModbusRTU::WriteOutputMessage q = mbs->getLastWriteOutput();
ModbusRTU::WriteOutputMessage q = mbs->getLastWriteOutput();
REQUIRE( q.addr == slaveADDR );
REQUIRE( q.addr == slaveADDR );
REQUIRE( q.start == 41 );
REQUIRE( q.start == 41 );
...
@@ -851,15 +851,15 @@ TEST_CASE("MBTCPMaster: F2 to DI", "[modbus][ftodi]")
...
@@ -851,15 +851,15 @@ TEST_CASE("MBTCPMaster: F2 to DI", "[modbus][ftodi]")
CHECK( ui->isExist(mbID) );
CHECK( ui->isExist(mbID) );
mbs->setReply(10);
mbs->setReply(10);
msleep(polltime +
2
00);
msleep(polltime +
3
00);
REQUIRE( ui->getValue(1028) == 1 );
REQUIRE( ui->getValue(1028) == 1 );
mbs->setReply(0);
mbs->setReply(0);
msleep(polltime +
2
00);
msleep(polltime +
3
00);
REQUIRE( ui->getValue(1028) == 0 );
REQUIRE( ui->getValue(1028) == 0 );
mbs->setReply(10);
mbs->setReply(10);
msleep(polltime +
2
00);
msleep(polltime +
3
00);
REQUIRE( ui->getValue(1028) == 1 );
REQUIRE( ui->getValue(1028) == 1 );
}
}
#endif
#endif
...
...
tests/test_delaytimer.cc
View file @
fd679552
...
@@ -183,9 +183,9 @@ TEST_CASE("[DelayTimer]: zero time", "[DelayTimer]" )
...
@@ -183,9 +183,9 @@ TEST_CASE("[DelayTimer]: zero time", "[DelayTimer]" )
msleep
(
40
);
msleep
(
40
);
CHECK_FALSE
(
dt
.
check
(
false
)
);
CHECK_FALSE
(
dt
.
check
(
false
)
);
CHECK_FALSE
(
dt
.
check
(
true
)
);
CHECK_FALSE
(
dt
.
check
(
true
)
);
msleep
(
8
0
);
msleep
(
7
0
);
CHECK_FALSE
(
dt
.
check
(
true
)
);
CHECK_FALSE
(
dt
.
check
(
true
)
);
msleep
(
4
0
);
msleep
(
5
0
);
CHECK
(
dt
.
check
(
true
)
);
CHECK
(
dt
.
check
(
true
)
);
}
}
...
...
tests/test_passivetimer.cc
View file @
fd679552
...
@@ -91,10 +91,10 @@ TEST_CASE("PassiveTimer: 1 msec", "[PassiveTimer][msec]" )
...
@@ -91,10 +91,10 @@ TEST_CASE("PassiveTimer: 1 msec", "[PassiveTimer][msec]" )
msleep
(
1
);
msleep
(
1
);
CHECK
(
pt
.
checkTime
()
);
CHECK
(
pt
.
checkTime
()
);
pt
.
setTiming
(
2
);
pt
.
setTiming
(
3
);
msleep
(
1
);
msleep
(
1
);
CHECK_FALSE
(
pt
.
checkTime
()
);
CHECK_FALSE
(
pt
.
checkTime
()
);
msleep
(
1
);
msleep
(
2
);
CHECK
(
pt
.
checkTime
()
);
CHECK
(
pt
.
checkTime
()
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment