From a88cad0485f1c73d63ba0a1bcfccc8a68bd300c6 Mon Sep 17 00:00:00 2001 From: Etienne Pierre-Doray Date: Wed, 25 Jul 2018 20:16:02 +0000 Subject: [Zucchini] Create elf types and utils. Creates types and utility class to manipulate ELF header format and relocation references. BufferView: :modify() was also added. Change-Id: Iacec212a2fb2f8a6c85d551eed4b8e0a84926d89 Reviewed-on: https://chromium-review.googlesource.com/1136846 Commit-Queue: Etienne Pierre-Doray Reviewed-by: Greg Thompson Reviewed-by: Samuel Huang Cr-Commit-Position: refs/heads/master@{#578034} NOKEYCHECK=True GitOrigin-RevId: 320f7d9d2cff9702e632af296867bf6ce7b14f8b --- test_utils.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test_utils.h') diff --git a/test_utils.h b/test_utils.h index 7ed735d..e922343 100644 --- a/test_utils.h +++ b/test_utils.h @@ -15,6 +15,21 @@ namespace zucchini { // Parses space-separated list of byte hex values into list. std::vector ParseHexString(const std::string& hex_string); +// Returns a vector that's the contatenation of two vectors of the same type. +// Elements are copied by value. +template +std::vector Cat(const std::vector& a, const std::vector& b) { + std::vector ret(a); + ret.insert(ret.end(), b.begin(), b.end()); + return ret; +} + +// Returns a subvector of a vector. Elements are copied by value. +template +std::vector Sub(const std::vector& a, size_t lo, size_t hi) { + return std::vector(a.begin() + lo, a.begin() + hi); +} + } // namespace zucchini #endif // COMPONENTS_ZUCCHINI_TEST_UTILS_H_ -- cgit v1.2.3