pdftract/crates/pdftract-libpdftract/tests/test_hash.c
jedarden 0f0e40e717 test(pdftract-1eaxm): add thread sanitizer results and improve conformance tests
- Add thread sanitizer verification results to notes/pdftract-1eaxm.md
- Improve conformance.c to gracefully handle error JSON responses
- Update test_hash.c to test version and ABI version functions

These changes improve the test coverage and documentation for the
libpdftract C FFI implementation.

Related: pdftract-1eaxm
2026-05-23 10:33:51 -04:00

29 lines
724 B
C

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../include/pdftract.h"
int main() {
printf("Testing pdftract library...\n");
// Test version
const char *version = pdftract_version();
printf("Version: %s\n", version);
// Test ABI version
uint32_t abi = pdftract_abi_version();
printf("ABI Version: 0x%08x\n", abi);
// Test hash
char *result = pdftract_hash("valid-test.pdf");
if (result == NULL) {
const char *err = pdftract_last_error();
printf("Hash failed (NULL result). Last error: %s\n", err ? err : "none");
return 1;
}
printf("Hash result: %s\n", result);
pdftract_free(result);
return 0;
}