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

@ -22,6 +22,18 @@
namespace cpu_features {
namespace {
TEST(CpustringsPPCTest, PPCFeaturesEnum) {
const char *last_name = GetPPCFeaturesEnumName(PPC_LAST_);
EXPECT_STREQ(last_name, "unknown_feature");
for (int i = static_cast<int>(PPC_32); i != static_cast<int>(PPC_LAST_); ++i) {
const auto feature = static_cast<PPCFeaturesEnum>(i);
const char *name = GetPPCFeaturesEnumName(feature);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
TEST(CpustringsPPCTest, FromHardwareCap) {
ResetHwcaps();
SetHardwareCapabilities(PPC_FEATURE_HAS_FPU | PPC_FEATURE_HAS_VSX,