mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-17 10:35:10 +00:00
Remove REQUIRE from cpu Test
cpu_barval now has the same behavior as cpu_percentage when trying to get info from a non-existent cpu.
This commit is contained in:
parent
08847314bd
commit
0ad2119bb4
@ -375,6 +375,10 @@ uint8_t cpu_percentage(struct text_object *obj) {
|
||||
}
|
||||
|
||||
double cpu_barval(struct text_object *obj) {
|
||||
if (static_cast<unsigned int>(obj->data.i) > info.cpu_count) {
|
||||
NORM_ERR("obj->data.i %i info.cpu_count %i", obj->data.i, info.cpu_count);
|
||||
CRIT_ERR(nullptr, nullptr, "attempting to use more CPUs than you have!");
|
||||
}
|
||||
if (info.cpu_usage != nullptr) { return info.cpu_usage[obj->data.i]; }
|
||||
return 0.;
|
||||
}
|
||||
|
@ -160,11 +160,10 @@ TEST_CASE("cpu_percentage and cpu_barval return correct values") {
|
||||
info.cpu_usage[0] = 0.253;
|
||||
info.cpu_usage[1] = 0.507;
|
||||
|
||||
REQUIRE(cpu_barval(&obj2) == 0);
|
||||
|
||||
// This does not exist in Catch2, but would be nice to have since that's
|
||||
// what happens in this case.
|
||||
// REQUIRE_EXIT(cpu_percentage(&obj2));
|
||||
// REQUIRE_EXIT(cpu_barval(&obj2));
|
||||
|
||||
delete[] info.cpu_usage;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user