11// <copyright file="marker_test.cpp" company="Visualisierungsinstitut der Universität Stuttgart">
2- // Copyright © 2025 Visualisierungsinstitut der Universität Stuttgart.
2+ // Copyright © 2025 - 2026 Visualisierungsinstitut der Universität Stuttgart.
33// Licensed under the MIT licence. See LICENCE file for details.
44// </copyright>
55// <author>Christoph Müller</author>
@@ -47,6 +47,7 @@ TEST_CLASS(marker_test) {
4747 .exclude <usb_pd_configuration>();
4848
4949 auto sensors = sensor_array::for_matches (std::move (config), is_marker_sensor);
50+ Assert::AreEqual (std::size_t (1 ), sensors.markers (), L" # of markers" , LINE_INFO ());
5051
5152 std::vector<sensor_description> descs;
5253 descs.resize (sensors.descriptions (nullptr , 0 ));
@@ -64,6 +65,33 @@ TEST_CLASS(marker_test) {
6465 sensors.stop ();
6566 }
6667 }
68+
69+ TEST_METHOD (test_marker_name) {
70+ typedef detail::marker_sensor type;
71+
72+ sensor_array_configuration config;
73+ config.configure <marker_configuration>([](marker_configuration &c) { c += L" Erich" ; })
74+ .exclude <hmc8015_configuration>()
75+ .exclude <tinkerforge_configuration>()
76+ .exclude <usb_pd_configuration>();
77+
78+ auto sensors = sensor_array::for_matches (std::move (config), is_marker_sensor);
79+
80+ {
81+ std::vector<wchar_t > name (sensors.marker (static_cast <wchar_t *>(nullptr ), 0 , 0 ));
82+ Assert::AreEqual (std::size_t (6 ), sensors.marker (name.data (), name.size (), 0 ), L" Buffer length" , LINE_INFO ());
83+ Assert::AreEqual (L" Erich" , name.data (), L" Marker name" , LINE_INFO ());
84+ }
85+
86+ {
87+ std::vector<char > name (sensors.marker (static_cast <char *>(nullptr ), 0 , 0 ));
88+ Assert::AreEqual (std::size_t (6 ), sensors.marker (name.data (), name.size (), 0 ), L" Buffer length" , LINE_INFO ());
89+ Assert::AreEqual (" Erich" , name.data (), L" Marker name" , LINE_INFO ());
90+ }
91+
92+ Assert::AreEqual (std::size_t (0 ), sensors.marker (static_cast <wchar_t *>(nullptr ), 0 , 42 ), L" Inexistent marker" , LINE_INFO ());
93+ Assert::AreEqual (std::size_t (0 ), sensors.marker (static_cast <char *>(nullptr ), 0 , 42 ), L" Inexistent marker" , LINE_INFO ());
94+ }
6795};
6896
6997PWROWG_TEST_NAMESPACE_END
0 commit comments