1
0
mirror of https://github.com/google/cpu_features.git synced 2025-07-02 13:43: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

@ -24,6 +24,18 @@ namespace cpu_features {
namespace {
TEST(CpuinfoMipsTest, MipsFeaturesEnum) {
const char *last_name = GetMipsFeaturesEnumName(MIPS_LAST_);
EXPECT_STREQ(last_name, "unknown_feature");
for (int i = static_cast<int>(MIPS_MSA); i != static_cast<int>(MIPS_LAST_); ++i) {
const auto feature = static_cast<MipsFeaturesEnum>(i);
const char *name = GetMipsFeaturesEnumName(feature);
ASSERT_FALSE(name == nullptr);
EXPECT_STRNE(name, "");
EXPECT_STRNE(name, last_name);
}
}
TEST(CpuinfoMipsTest, FromHardwareCapBoth) {
ResetHwcaps();
SetHardwareCapabilities(MIPS_HWCAP_MSA | MIPS_HWCAP_R6, 0);