applypatch: Add testcases for applypatch executable.

Refactor applypatch/main.cpp into libapplypatch_modes so that we can add
testcases.

Some changes to applypatch/main.cpp:
 - Replace char** argv with const char**;
 - Use android::base::Split() to split ":";
 - Use android::base::ParseUInt().

Bug: 32383590
Test: Unit tests pass, install-recovery.sh works.

Change-Id: I44e7bfa5ab717d439ea1d0ee9ddb7b2c40bb95a4
diff --git a/tests/Android.mk b/tests/Android.mk
index 3d05386..461d6ef 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -43,7 +43,7 @@
 # Component tests
 include $(CLEAR_VARS)
 LOCAL_CLANG := true
-LOCAL_CFLAGS += -Wno-unused-parameter -Werror
+LOCAL_CFLAGS := -Werror
 LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
 LOCAL_MODULE := recovery_component_test
 LOCAL_C_INCLUDES := bootable/recovery
@@ -63,6 +63,7 @@
     libext2fs
 
 LOCAL_STATIC_LIBRARIES := \
+    libapplypatch_modes \
     libapplypatch \
     libedify \
     libotafault \