aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2016-01-14 18:38:20 +0000
committerJavi Merino <javi.merino@arm.com>2016-01-14 18:41:38 +0000
commitb0718adc6d4b365527cb835a2200f5a4515fe941 (patch)
tree1d00700999f8e4bc427357cdf8d6c9becab90bf7
parenta5c1fb04cfdfc963ce6c26e2102d3e4793481d24 (diff)
downloadbart-b0718adc6d4b365527cb835a2200f5a4515fe941.tar.gz
tests: add a basic assertStatement() check
-rw-r--r--tests/test_common_utils.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_common_utils.py b/tests/test_common_utils.py
index 56398be..9226ec3 100644
--- a/tests/test_common_utils.py
+++ b/tests/test_common_utils.py
@@ -14,8 +14,10 @@
#
from bart.common import Utils
+from bart.common.Analyzer import Analyzer
import unittest
import pandas as pd
+import trappy
class TestCommonUtils(unittest.TestCase):
@@ -96,3 +98,18 @@ class TestCommonUtils(unittest.TestCase):
method="rect",
step="pre"),
0)
+
+
+class TestAnalyzer(unittest.TestCase):
+
+ def test_assert_statement_bool(self):
+ """Check that asssertStatement() works with a simple boolean case"""
+
+ rolls_dfr = pd.DataFrame({"results": [1, 3, 2, 6, 2, 4]})
+ trace = trappy.BareTrace()
+ trace.add_parsed_event("dice_rolls", rolls_dfr)
+ config = {"MAX_DICE_NUMBER": 6}
+
+ t = Analyzer(trace, config)
+ statement = "numpy.max(dice_rolls:results) <= MAX_DICE_NUMBER"
+ self.assertTrue(t.assertStatement(statement, select=0))