1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4int main ()
5{
6int t;
7char foo[3] = { 'b', 'c', 'd' };
8int bar[3] = {1, 2, 0};
9t = 1;
10
11/* These tests check expression evaluation rules, such as
12   ensuring that side-effect expression (++) get executed the
13   right number of times; that array lookup checks nest correctly. */
14foo[t++] = 'a';
15if (foo[0] != 'b' || foo[1] != 'a' || foo[2] != 'd' || t != 2) abort ();
16if (bar[0] != 1 || bar[1] != 2 || bar[2] != 0) abort();
17
18foo[bar[t--]] = 'e';
19if (foo[0] != 'e' || foo[1] != 'a' || foo[2] != 'd' || t != 1) abort ();
20if (bar[0] != 1 || bar[1] != 2 || bar[2] != 0) abort();
21
22foo[bar[++t]--] = 'g';
23if (foo[0] != 'g' || foo[1] != 'a' || foo[2] != 'd' || t != 2) abort ();
24if (bar[0] != 1 || bar[1] != 2 || bar[2] != -1) abort();
25
26return 0;
27}
28