1
0
mirror of https://github.com/google/cpu_features.git synced 2025-07-02 21:53:18 +02:00

test enum macro consistency (#257)

This commit is contained in:
Andrei Kurushin
2022-07-28 13:34:42 +03:00
committed by GitHub
parent 601471d527
commit d3c5e369db
5 changed files with 72 additions and 0 deletions

View File

@ -23,6 +23,18 @@ namespace {
void DisableHardwareCapabilities() { SetHardwareCapabilities(0, 0); }
TEST(CpuinfoAarch64Test, Aarch64FeaturesEnum) {
const char *last_name = GetAarch64FeaturesEnumName(AARCH64_LAST_);
EXPECT_STREQ(last_name, "unknown_feature");
for (int i = static_cast<int>(AARCH64_FP); i != static_cast<int>(AARCH64_LAST_); ++i) {
const auto feature = static_cast<Aarch64FeaturesEnum>(i);
const char *name = GetAarch64FeaturesEnumName(feature);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
TEST(CpuinfoAarch64Test, FromHardwareCap) {
ResetHwcaps();
SetHardwareCapabilities(AARCH64_HWCAP_FP | AARCH64_HWCAP_AES, 0);