~ubuntu-branches/ubuntu/vivid/emscripten/vivid-proposed

« back to all changes in this revision

Viewing changes to tests/core/test_corruption_3.in

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2014-01-19 14:12:40 UTC
  • mfrom: (4.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140119141240-nfiw0p8033oitpfz
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 <stdlib.h>
 
2
#include <stdio.h>
 
3
#include <assert.h>
 
4
 
 
5
void bye() { printf("all ok\n"); }
 
6
 
 
7
int main(int argc, char **argv) {
 
8
  atexit(bye);
 
9
 
 
10
  char *buffer = (char *)malloc(100);
 
11
  for (int i = 0; i < 100; i++) buffer[i] = (i * i) % 256;
 
12
  buffer = (char *)realloc(buffer, argc + 50);
 
13
  for (int i = 0; i < argc + 50; i++) {
 
14
    // printf("%d : %d : %d : %d\n", i, (int)(buffer + i), buffer[i],
 
15
    // (char)((i*i)%256));
 
16
    assert(buffer[i] == (char)((i * i) % 256));
 
17
  }
 
18
  return 1;
 
19
}