diff options
author | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2012-11-25 02:59:25 +0200 |
---|---|---|
committer | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2012-11-25 12:47:38 +0200 |
commit | c73d74a2717ea79240bba22e68de2019e1321977 (patch) | |
tree | 2bb5e6c10973a38350f02357d25e59dbe2a9f213 | |
parent | 48f2dd816c4493d774ab0987877d067e65e3df12 (diff) |
test: Get rid of the obsolete 'prng_rand_N' and 'prng_rand_u32'prng
They are the same as 'prng_rand_n' and 'prng_rand'
-rw-r--r-- | test/affine-test.c | 12 | ||||
-rw-r--r-- | test/combiner-test.c | 2 | ||||
-rw-r--r-- | test/composite-traps-test.c | 2 | ||||
-rw-r--r-- | test/glyph-test.c | 8 | ||||
-rw-r--r-- | test/region-contains-test.c | 16 | ||||
-rw-r--r-- | test/scaling-helpers-test.c | 8 | ||||
-rw-r--r-- | test/scaling-test.c | 16 | ||||
-rw-r--r-- | test/stress-test.c | 22 | ||||
-rw-r--r-- | test/utils.c | 2 | ||||
-rw-r--r-- | test/utils.h | 12 |
10 files changed, 44 insertions, 56 deletions
diff --git a/test/affine-test.c b/test/affine-test.c index fc2e05b..f60ec14 100644 --- a/test/affine-test.c +++ b/test/affine-test.c @@ -99,18 +99,18 @@ test_composite (int testnum, if (prng_rand_n (3) > 0) { - scale_x = -65536 * 3 + prng_rand_N (65536 * 6); + scale_x = -65536 * 3 + prng_rand_n (65536 * 6); if (prng_rand_n (2)) - scale_y = -65536 * 3 + prng_rand_N (65536 * 6); + scale_y = -65536 * 3 + prng_rand_n (65536 * 6); else scale_y = scale_x; pixman_transform_init_scale (&transform, scale_x, scale_y); } if (prng_rand_n (3) > 0) { - translate_x = -65536 * 3 + prng_rand_N (6 * 65536); + translate_x = -65536 * 3 + prng_rand_n (6 * 65536); if (prng_rand_n (2)) - translate_y = -65536 * 3 + prng_rand_N (6 * 65536); + translate_y = -65536 * 3 + prng_rand_n (6 * 65536); else translate_y = translate_x; pixman_transform_translate (&transform, NULL, translate_x, translate_y); @@ -142,8 +142,8 @@ test_composite (int testnum, break; default: /* arbitrary rotation */ - c = prng_rand_N (2 * 65536) - 65536; - s = prng_rand_N (2 * 65536) - 65536; + c = prng_rand_n (2 * 65536) - 65536; + s = prng_rand_n (2 * 65536) - 65536; break; } pixman_transform_rotate (&transform, NULL, c, s); diff --git a/test/combiner-test.c b/test/combiner-test.c index 7d6feda..01f63a5 100644 --- a/test/combiner-test.c +++ b/test/combiner-test.c @@ -67,7 +67,7 @@ static const pixman_op_t op_list[] = static float rand_float (void) { - uint32_t u = prng_rand_u32(); + uint32_t u = prng_rand(); return *(float *)&u; } diff --git a/test/composite-traps-test.c b/test/composite-traps-test.c index 5a4a921..2983eae 100644 --- a/test/composite-traps-test.c +++ b/test/composite-traps-test.c @@ -37,7 +37,7 @@ destroy_bits (pixman_image_t *image, void *data) static pixman_fixed_t random_fixed (int n) { - return prng_rand_N (n << 16); + return prng_rand_n (n << 16); } /* diff --git a/test/glyph-test.c b/test/glyph-test.c index 7edb3be..1811add 100644 --- a/test/glyph-test.c +++ b/test/glyph-test.c @@ -126,10 +126,10 @@ create_image (int max_size, const pixman_format_code_t *formats, uint32_t flags) { pixman_color_t color; - color.alpha = prng_rand_u32(); - color.red = prng_rand_u32(); - color.green = prng_rand_u32(); - color.blue = prng_rand_u32(); + color.alpha = prng_rand(); + color.red = prng_rand(); + color.green = prng_rand(); + color.blue = prng_rand(); return pixman_image_create_solid_fill (&color); } diff --git a/test/region-contains-test.c b/test/region-contains-test.c index c757347..096e651 100644 --- a/test/region-contains-test.c +++ b/test/region-contains-test.c @@ -15,10 +15,10 @@ make_random_region (pixman_region32_t *region) int32_t x, y; uint32_t w, h; - x = (int32_t)prng_rand_u32() >> 2; - y = (int32_t)prng_rand_u32() >> 2; - w = prng_rand_u32() >> 2; - h = prng_rand_u32() >> 2; + x = (int32_t)prng_rand() >> 2; + y = (int32_t)prng_rand() >> 2; + w = prng_rand() >> 2; + h = prng_rand() >> 2; pixman_region32_union_rect (region, region, x, y, w, h); } @@ -65,9 +65,9 @@ random_coord (pixman_region32_t *region, pixman_bool_t x) switch (prng_rand_n (5)) { case 0: - return begin - prng_rand_u32(); + return begin - prng_rand(); case 1: - return end + prng_rand_u32 (); + return end + prng_rand (); case 2: return end; case 3: @@ -116,9 +116,9 @@ test_region_contains_rectangle (int i, int verbose) make_random_region (®ion); box.x1 = random_coord (®ion, TRUE); - box.x2 = box.x1 + prng_rand_u32 (); + box.x2 = box.x1 + prng_rand (); box.y1 = random_coord (®ion, FALSE); - box.y2 = box.y1 + prng_rand_u32 (); + box.y2 = box.y1 + prng_rand (); if (verbose) { diff --git a/test/scaling-helpers-test.c b/test/scaling-helpers-test.c index 2685ae1..cd5ace0 100644 --- a/test/scaling-helpers-test.c +++ b/test/scaling-helpers-test.c @@ -57,10 +57,10 @@ main (void) { int32_t left_pad1, left_tz1, width1, right_tz1, right_pad1; int32_t left_pad2, left_tz2, width2, right_tz2, right_pad2; - pixman_fixed_t vx = prng_rand_N(10000 << 16) - (3000 << 16); - int32_t width = prng_rand_N(10000); - int32_t source_image_width = prng_rand_N(10000) + 1; - pixman_fixed_t unit_x = prng_rand_N(10 << 16) + 1; + pixman_fixed_t vx = prng_rand_n(10000 << 16) - (3000 << 16); + int32_t width = prng_rand_n(10000); + int32_t source_image_width = prng_rand_n(10000) + 1; + pixman_fixed_t unit_x = prng_rand_n(10 << 16) + 1; width1 = width2 = width; bilinear_pad_repeat_get_scanline_bounds_ref (source_image_width, diff --git a/test/scaling-test.c b/test/scaling-test.c index 44f851c..64c12dd 100644 --- a/test/scaling-test.c +++ b/test/scaling-test.c @@ -161,10 +161,10 @@ test_composite (int testnum, if (prng_rand_n (4) > 0) { - scale_x = -32768 * 3 + prng_rand_N (65536 * 5); - scale_y = -32768 * 3 + prng_rand_N (65536 * 5); - translate_x = prng_rand_N (65536); - translate_y = prng_rand_N (65536); + scale_x = -32768 * 3 + prng_rand_n (65536 * 5); + scale_y = -32768 * 3 + prng_rand_n (65536 * 5); + translate_x = prng_rand_n (65536); + translate_y = prng_rand_n (65536); pixman_transform_init_scale (&transform, scale_x, scale_y); pixman_transform_translate (&transform, NULL, translate_x, translate_y); pixman_image_set_transform (src_img, &transform); @@ -172,10 +172,10 @@ test_composite (int testnum, if (prng_rand_n (2) > 0) { - mask_scale_x = -32768 * 3 + prng_rand_N (65536 * 5); - mask_scale_y = -32768 * 3 + prng_rand_N (65536 * 5); - mask_translate_x = prng_rand_N (65536); - mask_translate_y = prng_rand_N (65536); + mask_scale_x = -32768 * 3 + prng_rand_n (65536 * 5); + mask_scale_y = -32768 * 3 + prng_rand_n (65536 * 5); + mask_translate_x = prng_rand_n (65536); + mask_translate_y = prng_rand_n (65536); pixman_transform_init_scale (&transform, mask_scale_x, mask_scale_y); pixman_transform_translate (&transform, NULL, mask_translate_x, mask_translate_y); pixman_image_set_transform (mask_img, &transform); diff --git a/test/stress-test.c b/test/stress-test.c index 8b99904..ee55c21 100644 --- a/test/stress-test.c +++ b/test/stress-test.c @@ -96,7 +96,7 @@ get_size (void) return 65536; case 7: - return prng_rand_N (64000) + 63000; + return prng_rand_n (64000) + 63000; } } @@ -164,7 +164,7 @@ real_writer (void *src, uint32_t value, int size) static uint32_t fake_reader (const void *src, int size) { - uint32_t r = prng_rand_u32 (); + uint32_t r = prng_rand (); assert (size == 1 || size == 2 || size == 4); @@ -184,7 +184,7 @@ log_rand (void) mask = (1 << prng_rand_n (10)) - 1; - return (prng_rand_u32 () & mask) - (mask >> 1); + return (prng_rand () & mask) - (mask >> 1); } static int32_t @@ -334,7 +334,7 @@ create_random_bits_image (void) int i; for (i = 0; i < width * height; ++i) - coefficients[i + 2] = prng_rand_u32(); + coefficients[i + 2] = prng_rand(); coefficients[0] = width << 16; coefficients[1] = height << 16; @@ -508,22 +508,22 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map) { case 0: /* rotation */ - c = prng_rand_N (2 * 65536) - 65536; - s = prng_rand_N (2 * 65536) - 65536; + c = prng_rand_n (2 * 65536) - 65536; + s = prng_rand_n (2 * 65536) - 65536; pixman_transform_rotate (&xform, NULL, c, s); break; case 1: /* translation */ - tx = prng_rand_u32(); - ty = prng_rand_u32(); + tx = prng_rand(); + ty = prng_rand(); pixman_transform_translate (&xform, NULL, tx, ty); break; case 2: /* scale */ - sx = prng_rand_u32(); - sy = prng_rand_u32(); + sx = prng_rand(); + sy = prng_rand(); pixman_transform_scale (&xform, NULL, sx, sy); break; @@ -533,7 +533,7 @@ set_general_properties (pixman_image_t *image, pixman_bool_t allow_alpha_map) /* random */ for (i = 0; i < 3; ++i) for (j = 0; j < 3; ++j) - xform.matrix[i][j] = prng_rand_u32(); + xform.matrix[i][j] = prng_rand(); break; } else if (prng_rand_n (16) == 0) diff --git a/test/utils.c b/test/utils.c index dd0e556..66c8dcb 100644 --- a/test/utils.c +++ b/test/utils.c @@ -682,7 +682,7 @@ get_random_seed (void) t.d = gettime(); prng_srand (t.u32); - return prng_rand_u32 (); + return prng_rand (); } #ifdef HAVE_SIGACTION diff --git a/test/utils.h b/test/utils.h index f054887..78cf0d1 100644 --- a/test/utils.h +++ b/test/utils.h @@ -46,18 +46,6 @@ prng_rand_n (int max) return prng_rand () % max; } -static inline uint32_t -prng_rand_N (int max) -{ - return prng_rand () % max; -} - -static inline uint32_t -prng_rand_u32 (void) -{ - return prng_rand (); -} - static inline void prng_randmemset (void *buffer, size_t size, prng_randmemset_flags_t flags) { |