1 /* Test and measure memcpy functions.
2 Copyright (C) 1999-2023 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 /* test-memcpy-support.h contains all test functions. */
20 #include "test-memcpy-support.h"
23 do_random_large_tests (void)
25 size_t i
, align1
, align2
, size
;
26 for (i
= 0; i
< 32; ++i
)
30 size
= (random () % 0x1000000) + 0x200000;
31 do_test1 (align1
, align2
, size
);
34 for (i
= 0; i
< 128; ++i
)
38 size
= (random () % 32768) + 4096;
39 do_test1 (align1
, align2
, size
);
51 FOR_EACH_IMPL (impl
, 0)
52 printf ("\t%s", impl
->name
);
55 do_test (0, 0, getpagesize () - 1);
57 for (i
= 0x200000; i
<= 0x2000000; i
+= i
)
59 for (j
= 64; j
<= 1024; j
<<= 1)
62 do_test1 (4095, j
, i
);
63 do_test1 (4096 - j
, 0, i
);
65 do_test1 (0, j
- 1, i
);
66 do_test1 (4095, j
- 1, i
);
67 do_test1 (4096 - j
- 1, 0, i
);
69 do_test1 (0, j
+ 1, i
);
70 do_test1 (4095, j
+ 1, i
);
71 do_test1 (4096 - j
, 1, i
);
73 do_test1 (0, j
, i
+ 1);
74 do_test1 (4095, j
, i
+ 1);
75 do_test1 (4096 - j
, 0, i
+ 1);
77 do_test1 (0, j
- 1, i
+ 1);
78 do_test1 (4095, j
- 1, i
+ 1);
79 do_test1 (4096 - j
- 1, 0, i
+ 1);
81 do_test1 (0, j
+ 1, i
+ 1);
82 do_test1 (4095, j
+ 1, i
+ 1);
83 do_test1 (4096 - j
, 1, i
+ 1);
85 do_test1 (0, j
, i
- 1);
86 do_test1 (4095, j
, i
- 1);
87 do_test1 (4096 - j
, 0, i
- 1);
89 do_test1 (0, j
- 1, i
- 1);
90 do_test1 (4095, j
- 1, i
- 1);
91 do_test1 (4096 - j
- 1, 0, i
- 1);
93 do_test1 (0, j
+ 1, i
- 1);
94 do_test1 (4095, j
+ 1, i
- 1);
95 do_test1 (4096 - j
, 1, i
- 1);
99 do_random_large_tests ();
103 #include <support/test-driver.c>