2 * Copyright (C) 2009 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <androidfw/BackupHelpers.h>
22 using namespace android;
24 #if TEST_BACKUP_HELPERS
26 // ============================================================
27 // ============================================================
28 typedef int (*test_func)();
38 { "backup_helper_test_empty", backup_helper_test_empty, 0, false },
39 { "backup_helper_test_four", backup_helper_test_four, 0, false },
40 { "backup_helper_test_files", backup_helper_test_files, 0, false },
41 { "backup_helper_test_null_base", backup_helper_test_null_base, 0, false },
42 { "backup_helper_test_missing_file", backup_helper_test_missing_file, 0, false },
43 { "backup_helper_test_data_writer", backup_helper_test_data_writer, 0, false },
44 { "backup_helper_test_data_reader", backup_helper_test_data_reader, 0, false },
49 main(int argc, const char** argv)
62 for (int i=1; i<argc; i++) {
63 if (0 == strcmp(t->name, argv[i])) {
86 printf("===== Running %s (%d of %d) ==============================\n",
87 t->name, i, testCount);
90 t->result = t->func();
102 printf("=================================================================\n");
104 printf("All %d test(s) passed\n", testCount);
106 printf("Tests failed: (%d of %d)\n", failed, testCount);
110 if (t->result != 0) {
111 printf(" %s\n", t->name);
121 main(int argc, char** argv)
123 printf ("test_backup_helper built without the tests\n");