#include <bncsutil/bncsutil.h>
#include <bncsutil/checkrevision.h>
#include <bncsutil/oldauth.h>
#include <cstdio>
#include <cstring>

int main()
{
    int n;
    char hash[20];
    int nonzero;

    /* extractMPQNumber: "IX86ver3.mpq" should return 3 */
    n = extractMPQNumber("IX86ver3.mpq");
    if (n != 3) {
        fprintf(stderr, "FAIL: extractMPQNumber returned %d, expected 3\n", n);
        return 1;
    }
    printf("PASS: extractMPQNumber(\"IX86ver3.mpq\") = %d\n", n);

    /* hashPassword: result must be 20 non-all-zero bytes */
    memset(hash, 0, sizeof(hash));
    hashPassword("hunter2", hash);
    nonzero = 0;
    for (int i = 0; i < 20; i++)
        if (hash[i]) { nonzero = 1; break; }
    if (!nonzero) {
        fprintf(stderr, "FAIL: hashPassword produced all-zero output\n");
        return 1;
    }
    printf("PASS: hashPassword produced non-zero hash\n");

    return 0;
}
