From a601cda422f2903e33bac45609fbe8840c2b915b Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Mon, 3 Feb 2020 19:33:02 +0200 Subject: [PATCH] Update unit-tests. * Update unit-tests to match the values after disabling YUV table. --- scripts/unittest/script/02-rgb_to_grayscale.py | 2 +- scripts/unittest/script/10-find_circles.py | 2 +- scripts/unittest/script/11-find_lines.py | 12 ++++-------- scripts/unittest/script/13-find_rects.py | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/scripts/unittest/script/02-rgb_to_grayscale.py b/scripts/unittest/script/02-rgb_to_grayscale.py index ba858697e..c55a45a55 100644 --- a/scripts/unittest/script/02-rgb_to_grayscale.py +++ b/scripts/unittest/script/02-rgb_to_grayscale.py @@ -1,4 +1,4 @@ def unittest(data_path, temp_path): import image gs = image.rgb_to_grayscale((120, 200, 120)) - return (abs(167-gs) < 2) + return (gs == 166) diff --git a/scripts/unittest/script/10-find_circles.py b/scripts/unittest/script/10-find_circles.py index 41abdea96..77237ec30 100644 --- a/scripts/unittest/script/10-find_circles.py +++ b/scripts/unittest/script/10-find_circles.py @@ -2,4 +2,4 @@ def unittest(data_path, temp_path): import image img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True) circles = img.find_circles(threshold = 5000, x_margin = 30, y_margin = 30, r_margin = 30) - return len(circles) == 1 and circles[0][0:-1] == (118, 56, 22) + return len(circles) == 1 and circles[0][0:] == (118, 56, 22, 5858) diff --git a/scripts/unittest/script/11-find_lines.py b/scripts/unittest/script/11-find_lines.py index f0afb091f..fee626f81 100644 --- a/scripts/unittest/script/11-find_lines.py +++ b/scripts/unittest/script/11-find_lines.py @@ -3,11 +3,7 @@ def unittest(data_path, temp_path): img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True) lines = img.find_lines(threshold = 10000, theta_margin = 25, rho_margin = 25) return len(lines) == 4 and\ - lines[0][0:-3] == (22, 0, 22, 119, 119) and\ - lines[1][0:-3] == (0, 39, 159, 39, 159) and\ - lines[2][0:-3] == (57, 0, 57, 119, 119) and\ - lines[3][0:-3] == (0, 75, 159, 75, 159) and\ - lines[0][-2:] == (0, 22) and\ - lines[1][-2:] == (90, 39) and\ - lines[2][-2:] == (0, 57) and\ - lines[3][-2:] == (90, 75) + lines[0][0:] == (22, 0, 22, 119, 119, 17272, 0, 22) and\ + lines[1][0:] == (0, 39, 159, 39, 159, 17272, 90, 39) and\ + lines[2][0:] == (57, 0, 57, 119, 119, 17272, 0, 57) and\ + lines[3][0:] == (0, 75, 159, 75, 159, 21336, 90, 75) diff --git a/scripts/unittest/script/13-find_rects.py b/scripts/unittest/script/13-find_rects.py index 53368e132..eb0d4ed04 100644 --- a/scripts/unittest/script/13-find_rects.py +++ b/scripts/unittest/script/13-find_rects.py @@ -2,4 +2,4 @@ def unittest(data_path, temp_path): import image img = image.Image("unittest/data/shapes.ppm", copy_to_fb=True) rects = img.find_rects(threshold = 50000) - return len(rects) == 1 and rects[0][0:-1] == (23, 39, 35, 36) + return len(rects) == 1 and rects[0][0:] == (23, 39, 35, 36, 145992)