7 #ifndef MEDIA_FILE_FILE_TEST_UTIL_H_
8 #define MEDIA_FILE_FILE_TEST_UTIL_H_
10 #include <gmock/gmock.h>
11 #include <gtest/gtest.h>
15 #include "packager/media/file/file.h"
20 #define ASSERT_FILE_EQ(file_name, array) \
22 std::string temp_data; \
23 ASSERT_TRUE(media::File::ReadFileToString((file_name), &temp_data)); \
24 const char* array_ptr = reinterpret_cast<const char*>(array); \
25 ASSERT_EQ(std::string(array_ptr, arraysize(array)), temp_data); \
28 #define ASSERT_FILE_STREQ(file_name, str) \
30 std::string temp_data; \
31 ASSERT_TRUE(media::File::ReadFileToString((file_name), &temp_data)); \
32 ASSERT_EQ(str, temp_data); \
35 #define ASSERT_FILE_ENDS_WITH(file_name, array) \
37 std::string temp_data; \
38 ASSERT_TRUE(media::File::ReadFileToString((file_name), &temp_data)); \
39 EXPECT_THAT(temp_data, \
40 ::testing::EndsWith(std::string( \
41 reinterpret_cast<const char*>(array), sizeof(array)))); \
47 #endif // MEDIA_FILE_FILE_TEST_UTIL_H_