aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-07-06 19:10:39 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-07-07 19:33:35 +0100
commit639ca3b1fa9c153a99f1d4e9bb488bd02d282e46 (patch)
treefd0d6f844c230bee836af99a4edf5bd9c801e4b5 /src
parentMerge pull request #4094 (diff)
downloadmonero-639ca3b1fa9c153a99f1d4e9bb488bd02d282e46.tar.xz
core_tests: add --filter to select which tests to run
Diffstat (limited to 'src')
-rw-r--r--src/common/util.cpp19
-rw-r--r--src/common/util.h2
2 files changed, 21 insertions, 0 deletions
diff --git a/src/common/util.cpp b/src/common/util.cpp
index 7d9d7b408..f644c573c 100644
--- a/src/common/util.cpp
+++ b/src/common/util.cpp
@@ -919,4 +919,23 @@ std::string get_nix_version_display_string()
return {};
}
}
+
+ std::string glob_to_regex(const std::string &val)
+ {
+ std::string newval;
+
+ bool escape = false;
+ for (char c: val)
+ {
+ if (c == '*')
+ newval += escape ? "*" : ".*";
+ else if (c == '?')
+ newval += escape ? "?" : ".";
+ else if (c == '\\')
+ newval += '\\', escape = !escape;
+ else
+ newval += c;
+ }
+ return newval;
+ }
}
diff --git a/src/common/util.h b/src/common/util.h
index a57a85fee..6ec901e7f 100644
--- a/src/common/util.h
+++ b/src/common/util.h
@@ -231,4 +231,6 @@ namespace tools
bool is_hdd(const char *path);
boost::optional<std::pair<uint32_t, uint32_t>> parse_subaddress_lookahead(const std::string& str);
+
+ std::string glob_to_regex(const std::string &val);
}