~ubuntu-branches/ubuntu/trusty/emscripten/trusty-proposed

« back to all changes in this revision

Viewing changes to tests/core/test_memmove2.in

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2014-01-19 14:12:40 UTC
  • mfrom: (1.2.4)
  • Revision ID: package-import@ubuntu.com-20140119141240-jg1l42cc158j59tn
Tags: 1.9.0~20140119~7dc8c2f-1
* New snapshot release (Closes: #733714)
* Provide sources for javascript and flash. Done in orig-tar.sh
  Available in third_party/websockify/include/web-socket-js/src/
  (Closes: #735903)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <string.h>
 
3
#include <assert.h>
 
4
int main() {
 
5
  int sum = 0;
 
6
  char buffer[256];
 
7
  for (int i = 0; i < 10; i++) {
 
8
    for (int j = 0; j < 10; j++) {
 
9
      for (int k = 0; k < 35; k++) {
 
10
        for (int t = 0; t < 256; t++) buffer[t] = t;
 
11
        char *dest = buffer + i;
 
12
        char *src = buffer + j;
 
13
        if (dest == src) continue;
 
14
        // printf("%d, %d, %d\n", i, j, k);
 
15
        assert(memmove(dest, src, k) == dest);
 
16
        for (int t = 0; t < 256; t++) sum += buffer[t];
 
17
      }
 
18
    }
 
19
  }
 
20
  printf("final: %d.\n", sum);
 
21
  return 1;
 
22
}