From: Luke Kenneth Casson Leighton Date: Fri, 9 Sep 2022 18:26:54 +0000 (+0100) Subject: add subtests X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4049d0522670fee00df04152cdd27e4f26fe4fb3;p=openpower-isa.git add subtests --- diff --git a/src/openpower/sv/trans/test_pysvp64dis.py b/src/openpower/sv/trans/test_pysvp64dis.py index 61f83366..2566d944 100644 --- a/src/openpower/sv/trans/test_pysvp64dis.py +++ b/src/openpower/sv/trans/test_pysvp64dis.py @@ -20,11 +20,13 @@ class SVSTATETestCase(unittest.TestCase): #print ("insn", insn) insns = list(insns) print ("insns", insns) - for i, line in enumerate(dump(insns, verbose=False, short=True)): - print("instruction", repr(line), repr(expected[i])) - self.assertEqual(expected[i], line, - "instruction %i do not match " - "'%s' expected '%s'" % (i, line, expected[i])) + for i, line in enumerate(dump(insns, verbosity=Verbosity.SHORT)): + name = expected[i].split(" ")[0] + with self.subTest(name): + print("instruction", repr(line), repr(expected[i])) + self.assertEqual(expected[i], line, + "instruction does not match " + "'%s' expected '%s'" % (line, expected[i])) def test_1_svshape2(self): expected = [ @@ -41,10 +43,12 @@ class SVSTATETestCase(unittest.TestCase): insns = list(insns) print ("insns", insns) for i, line in enumerate(dump(insns, verbosity=Verbosity.SHORT)): - print("instruction", repr(line), repr(expected[i])) - self.assertEqual(expected[i], line, - "instruction %i do not match " - "'%s' expected '%s'" % (i, line, expected[i])) + name = expected[i].split(" ")[0] + with self.subTest(name): + print("instruction", repr(line), repr(expected[i])) + self.assertEqual(expected[i], line, + "instruction does not match " + "'%s' expected '%s'" % (line, expected[i])) if __name__ == "__main__": unittest.main()