Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
tools.skpbench._hardware.Expectation Class Reference

Public Member Functions

def __init__ (self, value_type, min_value=None, max_value=None, exact_value=None, name=None, sleeptime=60)
 
def check (self, stringvalue)
 

Static Public Member Functions

def check_all (expectations, stringvalues)
 

Public Attributes

 value_type
 
 min_value
 
 max_value
 
 exact_value
 
 name
 
 sleeptime
 

Detailed Description

Simple helper for checking the readings on hardware gauges.

Definition at line 59 of file _hardware.py.

Constructor & Destructor Documentation

◆ __init__()

def tools.skpbench._hardware.Expectation.__init__ (   self,
  value_type,
  min_value = None,
  max_value = None,
  exact_value = None,
  name = None,
  sleeptime = 60 
)

Definition at line 61 of file _hardware.py.

62 exact_value=None, name=None, sleeptime=60):
63 self.value_type = value_type
64 self.min_value = min_value
65 self.max_value = max_value
66 self.exact_value = exact_value
67 self.name = name
68 self.sleeptime = sleeptime
69

Member Function Documentation

◆ check()

def tools.skpbench._hardware.Expectation.check (   self,
  stringvalue 
)

Definition at line 70 of file _hardware.py.

70 def check(self, stringvalue):
71 typedvalue = self.value_type(stringvalue)
72 if self.min_value is not None and typedvalue < self.min_value:
73 raise HardwareException("%s is too low (%s, min=%s)" %
74 (self.name, stringvalue, str(self.min_value)),
75 sleeptime=self.sleeptime)
76 if self.max_value is not None and typedvalue > self.max_value:
77 raise HardwareException("%s is too high (%s, max=%s)" %
78 (self.name, stringvalue, str(self.max_value)),
79 sleeptime=self.sleeptime)
80 if self.exact_value is not None and typedvalue != self.exact_value:
81 raise HardwareException("unexpected %s (%s, expected=%s)" %
82 (self.name, stringvalue, str(self.exact_value)),
83 sleeptime=self.sleeptime)
84
#define check(reporter, ref, unref, make, kill)
Definition: RefCntTest.cpp:85

◆ check_all()

def tools.skpbench._hardware.Expectation.check_all (   expectations,
  stringvalues 
)
static

Definition at line 86 of file _hardware.py.

86 def check_all(expectations, stringvalues):
87 if len(stringvalues) != len(expectations):
88 raise Exception("unexpected reading from hardware gauges "
89 "(expected %i values):\n%s" %
90 (len(expectations), '\n'.join(stringvalues)))
91
92 for value, expected in zip(stringvalues, expectations):
93 expected.check(value)
Definition: zip.py:1
static SkString join(const CommandLineFlags::StringArray &)
Definition: skpbench.cpp:741

Member Data Documentation

◆ exact_value

tools.skpbench._hardware.Expectation.exact_value

Definition at line 66 of file _hardware.py.

◆ max_value

tools.skpbench._hardware.Expectation.max_value

Definition at line 65 of file _hardware.py.

◆ min_value

tools.skpbench._hardware.Expectation.min_value

Definition at line 64 of file _hardware.py.

◆ name

tools.skpbench._hardware.Expectation.name

Definition at line 67 of file _hardware.py.

◆ sleeptime

tools.skpbench._hardware.Expectation.sleeptime

Definition at line 68 of file _hardware.py.

◆ value_type

tools.skpbench._hardware.Expectation.value_type

Definition at line 63 of file _hardware.py.


The documentation for this class was generated from the following file: