summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDavid Wagner <david.wagner@intel.com>2015-03-16 19:31:27 +0100
committerEric Laurent <elaurent@google.com>2015-04-24 13:39:11 -0700
commit0fe8b7d6edc1b27c71c8317d2b816534db7a8637 (patch)
tree7b153dfea81fe825e5f8ba7483f7e713b73cb27f /test
parent10668f43b3e5069a36f35c5bfd2de437c8fdb418 (diff)
downloadexternal_parameter-framework-0fe8b7d6edc1b27c71c8317d2b816534db7a8637.zip
external_parameter-framework-0fe8b7d6edc1b27c71c8317d2b816534db7a8637.tar.gz
external_parameter-framework-0fe8b7d6edc1b27c71c8317d2b816534db7a8637.tar.bz2
fixed-point-tests: remove some code duplication
Signed-off-by: David Wagner <david.wagner@intel.com>
Diffstat (limited to 'test')
-rwxr-xr-xtest/test-fixed-point-parameter/Main.py36
1 files changed, 13 insertions, 23 deletions
diff --git a/test/test-fixed-point-parameter/Main.py b/test/test-fixed-point-parameter/Main.py
index 318b2d1..6d7b292 100755
--- a/test/test-fixed-point-parameter/Main.py
+++ b/test/test-fixed-point-parameter/Main.py
@@ -94,6 +94,13 @@ class FixedPointTester():
Decimal(self._upperAllowedBound) + Decimal(littleValue)
]
+ self._chainingTests = [
+ ('Bound', self.checkBounds),
+ ('Sanity', self.checkSanity),
+ ('Consistency', self.checkConsistency),
+ ('Bijectivity', self.checkBijectivity)]
+
+
def run(self):
""" Runs the test suite for a given Qn.m number
"""
@@ -102,31 +109,14 @@ class FixedPointTester():
for value in self._shouldWork:
value = value.normalize()
-
print('Testing %s for %s' % (value, self._paramPath))
- value, success = self.checkBounds(value)
- if not success:
- runSuccess = False
- print('Bound ERROR for %s' % self._paramPath)
- continue
- value, success = self.checkSanity(value)
- if not success:
- runSuccess = False
- print('Sanity ERROR %s' % self._paramPath)
- continue
-
- value, success = self.checkConsistency(value)
- if not success:
- runSuccess = False
- print('Consistency ERROR %s' % self._paramPath)
- continue
-
- value, success = self.checkBijectivity(value)
- if not success:
- runSuccess = False
- print('Bijectivity ERROR %s' % self._paramPath)
- continue
+ for testName, testFunc in self._chainingTests:
+ value, success = testFunc(value)
+ if not success:
+ runSuccess = False
+ print("%s ERROR for %s" % (testName, self._paramPath))
+ break
for value in self._shouldBreak:
value = value.normalize()