blob: 2be37a5020974bf3211ce036eb66063b3993a3a8 [file] [log] [blame]
Jagpal Singh Gill9695bd22025-10-01 14:38:17 -07001gtest_dep = dependency('gtest', main: true, disabler: true, required: false)
2gmock_dep = dependency('gmock', disabler: true, required: false)
3if not gtest_dep.found() or not gmock_dep.found()
4 gtest_proj = import('cmake').subproject('googletest', required: false)
5 if gtest_proj.found()
6 gtest_dep = declare_dependency(
7 dependencies: [
8 dependency('threads'),
9 gtest_proj.dependency('gtest'),
10 gtest_proj.dependency('gtest_main'),
11 ],
12 )
13 gmock_dep = gtest_proj.dependency('gmock')
14 else
15 assert(
16 not get_option('tests').enabled(),
17 'Googletest is required if tests are enabled',
18 )
19 endif
20endif
Jagpal Singh Gill0fffb592025-05-20 23:45:25 -070021
Jagpal Singh Gill9695bd22025-10-01 14:38:17 -070022test(
23 'test_modbus_commands',
24 executable(
25 'test_modbus_commands',
26 'test_modbus_commands.cpp',
27 dependencies: [gtest_dep, gmock_dep, default_deps, modbus_rtu_dep],
28 include_directories: ['.'],
29 ),
30)
Jagpal Singh Gilla32d2412025-10-01 14:55:05 -070031
32test(
33 'test_modbus',
34 executable(
35 'test_modbus',
36 'test_modbus.cpp',
37 'modbus_server_tester.cpp',
38 dependencies: [gtest_dep, gmock_dep, default_deps, modbus_rtu_dep],
39 include_directories: ['.'],
40 ),
41)
Jagpal Singh Gill7f9d41d2025-10-16 09:42:18 -070042
43test(
44 'test_port',
45 executable(
46 'test_port',
47 'test_port.cpp',
48 'modbus_server_tester.cpp',
49 dependencies: [gtest_dep, gmock_dep, default_deps, modbus_rtu_dep],
50 include_directories: ['.', common_include],
51 ),
52)