Adam Lesinski | f90f2f8d | 2014-06-06 14:27:00 -0700 | [diff] [blame] | 1 | #ifndef __TEST_HELPERS_H |
| 2 | #define __TEST_HELPERS_H |
| 3 | |
| 4 | #include <ostream> |
| 5 | |
Adam Lesinski | 31245b4 | 2014-08-22 19:10:56 -0700 | [diff] [blame] | 6 | #include <androidfw/ResourceTypes.h> |
Adam Lesinski | f90f2f8d | 2014-06-06 14:27:00 -0700 | [diff] [blame] | 7 | #include <utils/String8.h> |
| 8 | #include <utils/String16.h> |
Adam Lesinski | 6029319 | 2014-10-21 18:36:42 -0700 | [diff] [blame] | 9 | #include <gtest/gtest.h> |
Adam Lesinski | f90f2f8d | 2014-06-06 14:27:00 -0700 | [diff] [blame] | 10 | |
| 11 | static inline ::std::ostream& operator<<(::std::ostream& out, const android::String8& str) { |
| 12 | return out << str.string(); |
| 13 | } |
| 14 | |
| 15 | static inline ::std::ostream& operator<<(::std::ostream& out, const android::String16& str) { |
| 16 | return out << android::String8(str).string(); |
| 17 | } |
| 18 | |
Adam Lesinski | 31245b4 | 2014-08-22 19:10:56 -0700 | [diff] [blame] | 19 | namespace android { |
| 20 | |
Adam Lesinski | 6029319 | 2014-10-21 18:36:42 -0700 | [diff] [blame] | 21 | enum { MAY_NOT_BE_BAG = false }; |
| 22 | |
Adam Lesinski | 31245b4 | 2014-08-22 19:10:56 -0700 | [diff] [blame] | 23 | static inline bool operator==(const android::ResTable_config& a, const android::ResTable_config& b) { |
| 24 | return memcmp(&a, &b, sizeof(a)) == 0; |
| 25 | } |
| 26 | |
| 27 | static inline ::std::ostream& operator<<(::std::ostream& out, const android::ResTable_config& c) { |
| 28 | return out << c.toString().string(); |
| 29 | } |
| 30 | |
Adam Lesinski | 6029319 | 2014-10-21 18:36:42 -0700 | [diff] [blame] | 31 | ::testing::AssertionResult IsStringEqual(const ResTable& table, uint32_t resourceId, const char* expectedStr); |
| 32 | |
Adam Lesinski | 31245b4 | 2014-08-22 19:10:56 -0700 | [diff] [blame] | 33 | } // namespace android |
| 34 | |
Adam Lesinski | f90f2f8d | 2014-06-06 14:27:00 -0700 | [diff] [blame] | 35 | #endif // __TEST_HELPERS_H |