1.23
2.0
main
test-branch
| Line | |
|---|
| 1 | int n = 3;
|
|---|
| 2 | void foo(){
|
|---|
| 3 | int k = n;
|
|---|
| 4 | k = k + 1;
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | void main(){
|
|---|
| 8 | int i = 0;
|
|---|
| 9 | int x = 3;
|
|---|
| 10 |
|
|---|
| 11 | $atom{
|
|---|
| 12 |
|
|---|
| 13 | if(i < 0)
|
|---|
| 14 | i = 1;
|
|---|
| 15 | else
|
|---|
| 16 | i = 2;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | $assert i == 2;
|
|---|
| 20 |
|
|---|
| 21 | $atom
|
|---|
| 22 | if(i > 0)
|
|---|
| 23 | i = 1;
|
|---|
| 24 | else
|
|---|
| 25 | i = 2;
|
|---|
| 26 |
|
|---|
| 27 | $assert i == 1;
|
|---|
| 28 |
|
|---|
| 29 | $atom{
|
|---|
| 30 | i = 2;
|
|---|
| 31 | switch(i){
|
|---|
| 32 | case 1: i = 2;
|
|---|
| 33 | case 2: i = 3;break;
|
|---|
| 34 | default: i = 5;
|
|---|
| 35 | }
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | $assert i == 3;
|
|---|
| 39 |
|
|---|
| 40 | $atom{
|
|---|
| 41 | i = 0;
|
|---|
| 42 | for(int j = 0; j < 10; j++){
|
|---|
| 43 | i += j;
|
|---|
| 44 | }
|
|---|
| 45 | }
|
|---|
| 46 |
|
|---|
| 47 | $assert i == 45;
|
|---|
| 48 |
|
|---|
| 49 | $atom{
|
|---|
| 50 | for(int m = 0; m < 5; m++){
|
|---|
| 51 | $spawn foo();
|
|---|
| 52 | }
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | //nested atomic and non-pure-local atomic block
|
|---|
| 56 | $atom{
|
|---|
| 57 | n = 0;
|
|---|
| 58 | n += 1;
|
|---|
| 59 | $atom{
|
|---|
| 60 | i+=2;
|
|---|
| 61 | i += 3; }
|
|---|
| 62 | n += 9;
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | $assert n == 10;
|
|---|
| 66 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.