Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /tests/new-tests/phases.diderot
ViewVC logotype

View of /tests/new-tests/phases.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4739 - (download) (annotate)
Wed Oct 12 18:45:02 2016 UTC (2 years, 9 months ago) by jhr
File size: 888 byte(s)
  add test to expose differences in possible phase semantics
#version 2

// A test to illustrate the difference in smantics between a state transitions
// happening
//
//  1) after global updates, or
//  2) between strand updates and global updates
//
// in the case 1, we should get the following output
//
//	0: 0 stable, 10 active
//	1: 0 stable, 10 active
//	2: 4 stable, 3 active
//
// while for case 2, we should get
//
//	0: 0 stable, 10 active
//	1: 4 stable, 3 active
//	2: 7 stable, 0 active

int step = 0;

strand S (int i)
{
    output int id = i;

    update {
	if (step == 0) {
	    if (id % 3 == 0) {
		die;
	    }
	    else if (id % 3 == 1) {
		stabilize;
	    }
	}
	else {
	    stabilize;
	}
    }
}

start {
    print (step, ": ", numStable(), " stable, ", numActive(), " active\n");
}

update {
    step += 1;
    print (step, ": ", numStable(), " stable, ", numActive(), " active\n");
}

create_collection { S(i) | i in 1..10 }


root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0