summaryrefslogtreecommitdiff
path: root/bsdiff_unittest.cc
AgeCommit message (Collapse)Author
2018-02-12Allow to set the minimum required match length.Alex Deymo
The minimum required match length plays an important role in the current algorithm. This algorithm requires that the current match has at least 8 mismatches over a region where we find a new match, therefore imposing a minimum match length of at least 8 bytes. This patch allows to increase this minium value to avoid using small matches that only match a very small region. A larger value can improve the patch size, depending on the data, but a too large value will cause the algorithm to miss matches that were otherwise benefical. Bug: 73107113 Test: Added unittests. Ran it with different minlen values. Change-Id: Iac594fc1cd7ecd5cfdc676bdb6ebe7c626de6dcd
2017-09-28Add unittest for the PatchWriter.Alex Deymo
Split the unittest logic between bsdiff() function and the PatchWriter. This patch now tests individually the PatchWriter logic that writes to disk and the bsdiff() logic to create patches in the same very simple cases. We also update the Android.bp file to only pass -DBSDIFF_TARGET_UNITTEST when building for the target. Bug: 34220646 Test: ran unittests. Change-Id: I9350157ee4a0b5a617f44bb187bd7652f6d6f017
2017-09-25Fix minor linter issues around includes and using.Alex Deymo
We also remove the "using std::string" clause from the files that were using it to simplify the integration with google's string type. Bug: None Test: Build and ran unittest. Change-Id: I752040494f6a6bb8447d8ff6d7cc2cf2784085d6
2017-09-25Add the "bsdiff/" prefix to all include paths.Alex Deymo
This prevents accidentally including a header file from another project that happens to have the same name. Test: `make checkbuild`; emerge-${BOARD} bsdiff Bug: None Change-Id: I8af132ed388738c30a8e3d7434de70b1e9d2f924
2017-05-03Update Makefile to build shared libraries.Alex Deymo
The Makefile didn't build libbspatch and libbsdiff. This patch includes those libraries in the Makefile and moves the header files exposed by those to an include/bsdiff subdirectory following the Android convention so calling program can include "bsdiff/bspatch.h" avoiding any collision with other libraries. The Android.mk is updated to export the new include path while keeping the old style until calling programs are updated. The new Makefile allows Chromium OS to build the new libraries. Bug: None Test: FEATURES=test emerge-link bsdiff; sudo emerge bsdiff Test: mmma external/bsdiff Change-Id: I2ea9251eb224e9418fe236e4c4c9c5621853f590
2015-10-23Build unittests on Android.Alex Deymo
The unitests were compiled in the Makefile but not on Android. This patch builds the unittests for the host on Android. Bug: 24478450 Test: mmma external/bsdiff && out/host/linux-x86/bin/bsdiff_unittest Change-Id: Ib9f70e57273e585f31b46068d29b277aaae611eb
2015-10-13Convert C sources to C++.Alex Deymo
To help refactoring the FILE* access behind an interface and better integrate with unittest code, this patch moves the C sources to C++. Minor changes to make this conform to C++ were included. Bug: 24478450 Test: `make all test && ./unittests`; mm Change-Id: I27d7fb0660efc18ea0cb84ff544c9dd9c4803050
2015-09-23Add gtest unittest framework.Alex Deymo
bsdiff and bspatch are in C and had no unittest. This patch keeps those programs as C code, but adds the C++ gtest unittest framework to allow testing them. Two simple unittests added to validate that the unittests work. BUG=None TEST=make test; ./unittests Change-Id: I8bca6b0c6bc5d5880464183d50a602c9886d20d0