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>
This commit is contained in:
parent
3dc2605bda
commit
683c6da83f
1 changed files with 7 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue