Skip to content

Commit

Permalink
Extended test coverage for cbwr_get
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-zagornyi committed Aug 28, 2019
1 parent 139d9d2 commit ab7baf8
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions tests/test_mkl_service.py
Expand Up @@ -205,30 +205,33 @@ def test_cbwr(self):
'sse4_2',
'avx',
'avx2',
'avx2,strict',
'avx512_mic',
'avx512_mic,strict',
'avx512',
'avx512,strict',
'avx512_mic_e1',
'avx512_e1',
]
strict = [
'avx2,strict',
'avx512_mic,strict',
'avx512,strict',
'avx512_e1,strict',
]
for branch in branches:
yield self.check_cbwr, branch
yield self.check_cbwr, branch, 'branch'
for branch in branches + strict:
yield self.check_cbwr, branch, 'all'

def check_cbwr(self, branch):
def check_cbwr(self, branch, cnr_const):
status = mkl.cbwr_set(branch=branch)
if status == 'success':
expected_value = 'branch_off' if branch == 'off' else branch
actual_value = mkl.cbwr_get(cnr_const='all')
assert_equals(actual_value, expected_value, msg="Round-trip failure for CNR branch '{}'".format(branch))
actual_value = mkl.cbwr_get(cnr_const=cnr_const)
assert_equals(actual_value,
expected_value,
msg="Round-trip failure for CNR branch '{}', CNR const '{}'".format(branch, cnr_const))
elif status != 'err_unsupported_branch':
raise AssertionError(status)

def test_cbwr_get_all(self):
mkl.cbwr_get(cnr_const='all')

def test_cbwr_get_auto_branch(self):
mkl.cbwr_get_auto_branch()

Expand Down

0 comments on commit ab7baf8

Please sign in to comment.