background image
<< System call / Power manager example | Replace The Untestable Part >>
<< System call / Power manager example | Replace The Untestable Part >>
Isolate The Untestable Part
First, Isolate The Untestable Part
sub should_i_sleep {
my($power_remaining) = @_;
snooze if $power_remaining < $Min_Power;
return 1;
}
sub snooze {
system("/sbin/snooze");
}
Test snooze() by hand once.
It's small, so you can get away with it