Files
jak-project/third-party/capstone/tests/integration/test_assert_macros.c
T
Tyler Wilding bfc4c18ada goalc: replicate tests for the majority of ARM64 non-simd cases (#4377)
- Adds `capstone` as a disassembling library that could eventually
replace Zydis (for now left that alone)
- Replicates all of the existing x86 tests to ARM64, fixed a bunch of
underlying issues along the way
- There are a very small handful of tests remaining that need to be
enabled / fixed
2026-08-16 15:34:37 -04:00

42 lines
990 B
C
Vendored
Generated

// SPDX-FileCopyrightText: 2025 Rot127 <unisono@quyllur.org>
// SPDX-License-Identifier: LGPL-3.0-only
// Has to be built as Release build or with CAPSTONE_ASSERTION_WARNINGS.
#include <capstone/platform.h>
#include <capstone/capstone.h>
// Test: https://github.com/capstone-engine/capstone/issues/2791
static bool test_cs_reg_null_case()
{
csh handle;
if (cs_open(CS_ARCH_AARCH64, (cs_mode)0, &handle) != CS_ERR_OK) {
printf("Open failed\n");
return false;
}
// Invalid register id 0 should return NULL.
if (cs_reg_name(handle, 0) != NULL) {
printf("NULL check failed\n");
return false;
}
cs_close(&handle);
return true;
}
static bool test_version_macros()
{
bool relations = CS_VERSION_ALPHA < CS_VERSION_BETA;
relations &= CS_VERSION_ALPHA9 < CS_VERSION_BETA;
relations &= CS_VERSION_BETA < CS_VERSION_STABLE;
return relations;
}
int main()
{
bool result = true;
result &= test_cs_reg_null_case();
result &= test_version_macros();
return result ? 0 : -1;
}