aboutsummaryrefslogtreecommitdiff
path: root/tests/runner.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2013-02-02 10:35:29 -0800
committerAlon Zakai <alonzakai@gmail.com>2013-02-02 10:35:29 -0800
commit8717929f2dbc79023544b6580813e805a1ccaafd (patch)
tree3c5ae9c3a4463b2b15adf86092fc9ceefe9a11bc /tests/runner.py
parent5df5e8b68f9340c86391fd89861cd6000e91af9c (diff)
fix memcpy
Diffstat (limited to 'tests/runner.py')
-rwxr-xr-xtests/runner.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 4c8b6379..ffac5045 100755
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -4108,6 +4108,31 @@ The current type of b is: 9
self.do_run(src, '6c9cdfe937383b79e52ca7a2cce83a21d9f5422c',
output_nicerizer = check)
+ def test_memcpy2(self):
+ src = r'''
+ #include <stdio.h>
+ #include <string.h>
+ #include <assert.h>
+ int main() {
+ char buffer[256];
+ for (int i = 0; i < 10; i++) {
+ for (int j = 0; j < 10; j++) {
+ for (int k = 0; k < 35; k++) {
+ for (int t = 0; t < 256; t++) buffer[t] = t;
+ char *dest = buffer + i + 128;
+ char *src = buffer+j;
+ //printf("%d, %d, %d\n", i, j, k);
+ assert(memcpy(dest, src, k) == dest);
+ assert(memcmp(dest, src, k) == 0);
+ }
+ }
+ }
+ printf("ok.\n");
+ return 1;
+ }
+ '''
+ self.do_run(src, 'ok.');
+
def test_memmove(self):
src = '''
#include <stdio.h>