fix replace with tabs and newlines

This commit is contained in:
wgroeneveld 2018-12-04 10:33:45 +01:00
parent 7c0eb5ca22
commit 0634cf0abc
2 changed files with 5 additions and 4 deletions

View File

@ -22,13 +22,14 @@ class TestRandomPermutations(OpbTestCase):
def test_random_range_between_three_and_zero(self):
# proc random_range(s0 is max, s2 is shifter, s3 is counter) {
# we need to initialize these registers as "parameters". "return value" is in sA (seed)
# the "random 8-bit" value will be shifted until it hits a max.
assert_that = self.load_file("randompermutations.psm4")\
.replace("call random", "load seed, AF")\
.replace("call random", "load seed, 1F")\
.setregs({"s0": 3})\
.testproc("random_range")\
.execute()
assert_that.reg("sA").contains(2)
assert_that.reg("sA").contains(3)
def test_output_configuration_correct_in_output_ports(self):
assert_that = self.load_psm4_assertion()

View File

@ -97,8 +97,8 @@ class OpbTestMockable():
for line in data:
found = False
for key, value in self.replacers.items():
if line.upper().replace(" ", "").startswith(key.upper().replace(" ", "")):
newdata.append(value)
if line.upper().replace(" ", "").replace("\t", "").startswith(key.upper().replace(" ", "")):
newdata.append(value + "\n")
found = True
if found is False:
newdata.append(line)