| 1 | #include "stub.h" |
| 2 | |
| 3 | int total = 0; |
| 4 | |
| 5 | int inc(int x) { |
| 6 | switch (x) { |
| 7 | case 0: total += 1 + 0; return 1; |
| 8 | case 1: total += 1 + 1; return 2; |
| 9 | case 2: total += 1 + 2; return 3; |
| 10 | case 3: total += 1 + 3; return 4; |
| 11 | case 4: total += 1 + 4; return 5; |
| 12 | case 5: total += 1 + 5; return 6; |
| 13 | default: return x + 1; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | int inc_dup(int x) { |
| 18 | switch (x) { |
| 19 | case 0: total += 2 + 0; return 1; |
| 20 | case 1: total += 2 + 1; return 2; |
| 21 | case 2: total += 2 + 2; return 3; |
| 22 | case 3: total += 2 + 3; return 4; |
| 23 | case 4: total += 2 + 4; return 5; |
| 24 | case 5: total += 2 + 5; return 6; |
| 25 | default: return x + 1; |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | int main() { |
| 30 | int c = 0; |
| 31 | for (int i = 0; i < 10000000; ++i) { |
| 32 | int a = rand() % 7; |
| 33 | int b = rand() % 7; |
| 34 | c += inc(x: a) - 2*inc_dup(x: b); |
| 35 | } |
| 36 | return c == 0; |
| 37 | } |
| 38 | |