1
0
mirror of https://github.com/google/cpu_features.git synced 2025-07-03 06:03:17 +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

@ -21,6 +21,18 @@
namespace cpu_features {
namespace {
TEST(CpuinfoArmTest, ArmFeaturesEnum) {
const char *last_name = GetArmFeaturesEnumName(ARM_LAST_);
EXPECT_STREQ(last_name, "unknown_feature");
for (int i = static_cast<int>(ARM_SWP); i != static_cast<int>(ARM_LAST_); ++i) {
const auto feature = static_cast<ArmFeaturesEnum>(i);
const char *name = GetArmFeaturesEnumName(feature);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
TEST(CpuinfoArmTest, FromHardwareCap) {
ResetHwcaps();
SetHardwareCapabilities(ARM_HWCAP_NEON, ARM_HWCAP2_AES | ARM_HWCAP2_CRC32);