]> FriiDump Source - friidump.git/blob - tests/test_redump_dat_verify.c
Harden GCC-4243N A102 HLDS E7 profile
[friidump.git] / tests / test_redump_dat_verify.c
1 #include "redump_dat.h"
2
3 #include <stdio.h>
4 #include <string.h>
5
6 int main(int argc, char **argv) {
7     redump_verify_result result;
8     int ok;
9
10     if (argc != 2) {
11         fprintf(stderr, "Usage: %s <Nintendo - GameCube.dat>\n",
12                 argc > 0 ? argv[0] : "test_redump_dat_verify");
13         return 64;
14     }
15
16     redump_verify_result_init(&result);
17     ok = redump_verify_dat_file(
18         argv[1],
19         UINT64_C(1459978240),
20         "01b52739",
21         "85a525df1481d0ad67d8761f832dca12",
22         "06eb6d15b4d7f90ec0fed9ce9a77db41358d74ed",
23         &result
24     );
25
26     printf("status=%s\n", redump_verify_status_string(result.status));
27     printf("entries_scanned=%lu\n", result.entries_scanned);
28     printf("exact_matches=%lu\n", result.exact_matches);
29     printf("game_name=%s\n", result.game_name);
30     printf("rom_name=%s\n", result.rom_name);
31
32     if (!ok || result.status != REDUMP_VERIFY_MATCH)
33         return 1;
34     if (result.exact_matches < 1)
35         return 2;
36     if (strcmp(result.expected_crc32, "01b52739") != 0)
37         return 3;
38     if (strcmp(result.expected_md5, "85a525df1481d0ad67d8761f832dca12") != 0)
39         return 4;
40     if (strcmp(result.expected_sha1,
41                "06eb6d15b4d7f90ec0fed9ce9a77db41358d74ed") != 0)
42         return 5;
43
44     return 0;
45 }