History

[UT] Test generic downsampling routines with a wider variety of width ratios

Get coverage of all code paths for routines that branch to different paths for different scaling ratios.

Sindre Aamås committed 10 years ago

Commit 4fec6d51 parent e4902151 file · +17 −15Browse files

Showing the changes to test/processing/ProcessUT_DownSample.cpp (1 of 1 file). Show all

Unified · Split

test/processing/ProcessUT_DownSample.cpp+17−15
@@ -296,21 +296,23 @@ TEST (DownSampleTest, func) { \ · 295 unmodified lines
296296 int src_stride_a; \
297297 int src_width_a; \
298298 int src_height_a; \
299− dst_stride_c = dst_stride_a = 320; \
300− src_stride_c = src_stride_a = 320; \
301− src_width_c = src_width_a = 320; \
302− src_height_c = src_height_a = 180; \
303− dst_width_c = dst_width_a = 300; \
304− dst_height_c = dst_height_a = 160; \
305− for (int j = 0; j < 70000; j++) { \
306− dst_c[j] = dst_a[j] = rand() % 256; \
307− src_c[j] = src_a[j] = rand() % 256; \
308− } \
309− ref (dst_c, dst_stride_c, dst_width_c, dst_height_c, src_c, src_stride_c, src_width_c, src_height_c); \
310− func (dst_a, dst_stride_a, dst_width_a, dst_height_a, src_a, src_stride_a, src_width_a, src_height_a); \
311− for (int j = 0; j < dst_height_c; j++) { \
312− for (int m = 0; m < dst_width_c ; m++) { \
313− ASSERT_EQ (dst_c[m + j * dst_stride_c], dst_a[m + j * dst_stride_a]); \
299+ for (int i = 0; i < 5; i++) { \
300+ dst_stride_c = dst_stride_a = 320; \
301+ src_stride_c = src_stride_a = 320; \
302+ src_width_c = src_width_a = 320; \
303+ src_height_c = src_height_a = 180; \
304+ dst_width_c = dst_width_a = (src_width_c >> (i + 1)) + rand() % (src_width_c >> (i + 1)); \
305+ dst_height_c = dst_height_a = 160; \
306+ for (int j = 0; j < 70000; j++) { \
307+ dst_c[j] = dst_a[j] = rand() % 256; \
308+ src_c[j] = src_a[j] = rand() % 256; \
309+ } \
310+ ref (dst_c, dst_stride_c, dst_width_c, dst_height_c, src_c, src_stride_c, src_width_c, src_height_c); \
311+ func (dst_a, dst_stride_a, dst_width_a, dst_height_a, src_a, src_stride_a, src_width_a, src_height_a); \
312+ for (int j = 0; j < dst_height_c; j++) { \
313+ for (int m = 0; m < dst_width_c ; m++) { \
314+ ASSERT_EQ (dst_c[m + j * dst_stride_c], dst_a[m + j * dst_stride_a]); \
315+ } \
314316 } \
315317 } \
316318 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t