-
-
Notifications
You must be signed in to change notification settings - Fork 647
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
include_directories(${PROJECT_SOURCE_DIR}/src) | ||
|
||
add_executable(test_parse_xeon_name test_parse_xeon_name.cpp ${PROJECT_SOURCE_DIR}/src/linux/parse_cpu_names.cpp) | ||
add_test(parse_xeon_name test_parse_xeon_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
|
||
const static std::string xeon_E5_2623_v3 = "Intel(R) Xeon(R) CPU E5-2623 v3 @ 3.00GHz"; | ||
const static std::string xeon_gold_6240 = "Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GHz"; | ||
const static std::string xeon_gold_6338N = "Intel(R) Xeon(R) Gold 6338N CPU @ 2.20GHz"; | ||
|
||
const static std::string core_i9_13900H = "13th Gen Intel(R) Core(TM) i9-13900H"; | ||
|
||
const static std::string pentium_III = "Intel(R) Pentium(R) III CPU family 1400MHz"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
// TODO: Use GTest or Catch or something | ||
#undef NDEBUG | ||
#include <cassert> | ||
#include <optional> | ||
#include <string> | ||
|
||
#include "cpu_names.hpp" | ||
#include "linux/parse_cpu_names.hpp" | ||
|
||
auto main() -> int { | ||
auto result = parse_xeon_name(xeon_E5_2623_v3); | ||
assert(result.value() == "E5-2623 v3"); | ||
|
||
result = parse_xeon_name(xeon_gold_6240); | ||
assert(result.value() == "Gold 6240"); | ||
|
||
result = parse_xeon_name(xeon_gold_6338N); | ||
assert(result.value() == "Gold 6338N"); | ||
|
||
result = parse_xeon_name(core_i9_13900H); | ||
assert(result == std::nullopt); | ||
|
||
result = parse_xeon_name(pentium_III); | ||
assert(result == std::nullopt); | ||
} |