From 61bfbbff8a7e07ddfb1bb54e56a61a20de194c64 Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Wed, 17 Dec 2014 08:58:02 +0100 Subject: [PATCH] improve check function --- lib/sata/test/common.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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) -- 2.30.2