Loading tools/zipalign/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ cc_test_host { "tests/src/*_test.cpp", ], static_libs: [ "libbase", "libzipalign", "libgmock", ], Loading tools/zipalign/tests/src/align_test.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -4,12 +4,21 @@ #include "ZipAlign.h" #include <stdio.h> #include <string> #include <android-base/file.h> using namespace android; static std::string GetTestPath(const std::string& filename) { static std::string test_data_dir = android::base::GetExecutableDirectory() + "/tests/data/"; return test_data_dir + filename; } TEST(Align, Unaligned) { const char* src = "tests/data/unaligned.zip"; const char* dst = "tests/data/unaligned_out.zip"; int result = process(src, dst, 4, true, false, 4096); const std::string src = GetTestPath("unaligned.zip"); const std::string dst = GetTestPath("unaligned_out.zip"); int result = process(src.c_str(), dst.c_str(), 4, true, false, 4096); ASSERT_EQ(0, result); } Loading
tools/zipalign/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,7 @@ cc_test_host { "tests/src/*_test.cpp", ], static_libs: [ "libbase", "libzipalign", "libgmock", ], Loading
tools/zipalign/tests/src/align_test.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -4,12 +4,21 @@ #include "ZipAlign.h" #include <stdio.h> #include <string> #include <android-base/file.h> using namespace android; static std::string GetTestPath(const std::string& filename) { static std::string test_data_dir = android::base::GetExecutableDirectory() + "/tests/data/"; return test_data_dir + filename; } TEST(Align, Unaligned) { const char* src = "tests/data/unaligned.zip"; const char* dst = "tests/data/unaligned_out.zip"; int result = process(src, dst, 4, true, false, 4096); const std::string src = GetTestPath("unaligned.zip"); const std::string dst = GetTestPath("unaligned_out.zip"); int result = process(src.c_str(), dst.c_str(), 4, true, false, 4096); ASSERT_EQ(0, result); }