summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMattijs Korpershoek <mkorpershoek@baylibre.com>2023-04-05 10:14:31 +0200
committerKieran Bingham <kieran.bingham@ideasonboard.com>2023-04-20 10:54:12 +0100
commit683c6da83f078d09fc020d2b48a4abe471853b2b (patch)
treeece8c930921a87c2e9ffa012bba47c953d2cf14a /test
parent3dc2605bda52b627f6e009ef4a3c8360d00e358a (diff)
test: controls: control_info_map: Test default constructor
ControlInfoMap can be default-constructed. In that case, some of its members (like idmap_) can be a nullptr, and ControlInfoMap.find() will segfault. Add a test with a default constructed ControlInfoMap to cover this. Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'test')
-rw-r--r--test/controls/control_info_map.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/controls/control_info_map.cpp b/test/controls/control_info_map.cpp
index db95945a..29b33515 100644
--- a/test/controls/control_info_map.cpp
+++ b/test/controls/control_info_map.cpp
@@ -75,6 +75,13 @@ protected:
return TestFail;
}
+ /* Test looking up a control on a default-constructed infoMap */
+ const ControlInfoMap emptyInfoMap;
+ if (emptyInfoMap.find(12345) != emptyInfoMap.end()) {
+ cerr << "find() on empty ControlInfoMap failed" << endl;
+ return TestFail;
+ }
+
return TestPass;
}
};