neg += 1
else:
pos += 1
- self.test.p (str(pos) +' out of '+ str (pos+neg) + ' conditions fulfilled')
return fulfilled
def run_blocking (self, timeout, pos_cont, neg_cont):
execs = 0;
pos += 1
print (str(pos) +' out of '+ str (pos+neg) + ' conditions fulfilled')
return self.fulfilled
+ def reset (self):
+ self.fulfilled = False
+ for c in self.conditions:
+ c.fulfilled = False
class Condition:
def __init__(self):
self.result = -1;
def check(self):
if (self.fulfilled == False):
- self.result = self.peer.get_statistics_value (self.subsystem, self.name);
+ self.result = self.peer.get_statistics_value (self.subsystem, self.name)
if (str(self.result) == str(self.value)):
self.fulfilled = True
return True
else:
fail = ""
op = " == "
- if ((self.fulfilled == False) and (failed_only == True)):
+ if (((self.fulfilled == False) and (failed_only == True)) or (failed_only == False)):
print self.peer.id[:4] + " " +self.peer.cfg + " " + str(self.type) + ' condition in subsystem "' + self.subsystem.ljust(12) +'" : "' + self.name.ljust(30) +'" : (expected/real value) ' + str(self.value) + op + res + fail
- elif (failed_only == False):
- print self.peer.id[:4] + " " +self.peer.cfg + " " + str(self.type) + ' condition in subsystem "' + self.subsystem.ljust(12) +'" : "' + self.name.ljust(30) +'" : (expected/real value) ' + str(self.value) + op + res + fail
return self.fulfilled
# Specify two statistic values and check if they are equal
else:
fail = ""
op = " == "
- if ((self.fulfilled == False) and (failed_only == True)):
- print self.peer.id[:4] + " " + self.subsystem.ljust(12) + " " + self.result +" " + self.peer2.id[:4] + " " + self.subsystem2.ljust(12) + " " + self.result2
- #print self.peer.id[:4] + " " + str(self.type) + ' condition in subsystem "' + self.subsystem.ljust(12) +'" : "' + self.name.ljust(30) +'" : (expected/real value) ' + str(self.value) + op + res + fail
- elif (failed_only == False):
- print self.peer.id[:4] + " " + self.subsystem.ljust(12) + " " + self.result +" " + self.peer2.id[:4] + " " + self.subsystem2.ljust(12) + " " + self.result2
+ if (((self.fulfilled == False) and (failed_only == True)) or (failed_only == False)):
+ print self.peer.id[:4] + ' "' + self.subsystem.ljust(12) + '" "' + self.name.ljust(30) + '" == ' + str(self.result) +" " + self.peer2.id[:4] + ' "' + self.subsystem2.ljust(12) + '" '+ self.name2.ljust(30) + '" ' + str(self.result2)
return self.fulfilled
class Test: