summaryrefslogtreecommitdiff
path: root/src/base/match.cc
diff options
context:
space:
mode:
authorBobby R. Bruce <bbruce@ucdavis.edu>2019-11-01 12:44:08 -0700
committerBobby R. Bruce <bbruce@ucdavis.edu>2019-11-07 18:34:01 +0000
commit434047e2c3200b6b249c206fb2a4a306225b473e (patch)
treefe6915415462000ddf3c93f2cd767a4308aba7ba /src/base/match.cc
parentf41045ef75a391286c32069c8474fb2a0cc66f72 (diff)
downloadgem5-434047e2c3200b6b249c206fb2a4a306225b473e.tar.xz
tests,base: Added GTests for base/match.cc
In order to aid testing the method "match.getExpressions()" has been added. Change-Id: I11acf9bed286ee2809dfa3d05ef573dea85eb786 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/22503 Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com> Tested-by: kokoro <noreply+kokoro@google.com>
Diffstat (limited to 'src/base/match.cc')
-rw-r--r--src/base/match.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/base/match.cc b/src/base/match.cc
index 03f425f2e..7c2c0cf58 100644
--- a/src/base/match.cc
+++ b/src/base/match.cc
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2019 The Regents of the University of California
* Copyright (c) 2004-2005 The Regents of The University of Michigan
* All rights reserved.
*
@@ -26,6 +27,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Authors: Nathan Binkert
+ Bobby R. Bruce
*/
#include "base/match.hh"
@@ -103,3 +105,16 @@ ObjectMatch::domatch(const string &name) const
return false;
}
+std::vector<std::vector<std::string> >
+ObjectMatch::getExpressions()
+{
+ std::vector<std::vector<std::string> > to_return;
+ for (const std::vector<std::string> expression : tokens) {
+ std::vector<std::string> to_add;
+ to_add.insert(to_add.end(), expression.begin(), expression.end());
+ to_return.push_back(to_add);
+ }
+
+ return to_return;
+}
+