Implement human sort utility function
This commit implements the ability to sort lists of strings that might
include numbers into "human" ordered lists. As an example of a problem
this solves, imagine a system with 12 dimms, today std::sort would net
you:
Dimm1
Dimm11
Dimm12
Dimm2
Dimm3
.....
This method breaks apart that string and sorts them in a way humans
would expect.
This code is originally inspired by the algorithm defined here:
http://www.davekoelle.com/alphanum.html. The site does include c++ code
that is MIT licensed, but is significantly more complex than what is
present in this commit. This commit also takes advantages in the form
of std::string_view to deduplicate overloads, as well as other c++17
features.
Tested:
Unit tests pass
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: Iac54c2e0d9998d4d622d74049b1dd957e4b3ca75
diff --git a/meson.build b/meson.build
index bc492cd..8a9fcc2 100644
--- a/meson.build
+++ b/meson.build
@@ -356,6 +356,7 @@
srcfiles_unittest = [
'include/ut/dbus_utility_test.cpp',
'include/ut/http_utility_test.cpp',
+ 'include/ut/human_sort_test.cpp',
'redfish-core/ut/privileges_test.cpp',
'redfish-core/ut/lock_test.cpp',
'redfish-core/ut/configfile_test.cpp',