From: Florent Kermarrec Date: Wed, 17 Dec 2014 07:58:02 +0000 (+0100) Subject: improve check function X-Git-Tag: 24jan2021_ls180~2572^2~108 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=61bfbbff8a7e07ddfb1bb54e56a61a20de194c64;p=litex.git improve check function --- diff --git a/lib/sata/test/common.py b/lib/sata/test/common.py index 69d0211b..24389806 100644 --- a/lib/sata/test/common.py +++ b/lib/sata/test/common.py @@ -1,4 +1,4 @@ -import random +import random, copy from lib.sata.common import * @@ -8,10 +8,16 @@ def seed_to_data(seed, random=True): else: return seed -def check(ref, res): - if isinstance(ref, int): - return 0, 1, int(ref != res) +def check(p1, p2): + p1 = copy.deepcopy(p1) + p2 = copy.deepcopy(p2) + if isinstance(p1, int): + return 0, 1, int(p1 != p2) else: + if len(p1) >= len(p2): + ref, res = p1, p2 + else: + ref, res = p2, p1 shift = 0 while((ref[0] != res[0]) and (len(res)>1)): res.pop(0)