Warning: session_start(): open(/var/lib/php/sessions/sess_ouu9aq2h3upe80iqlsilrevmim, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
scope test_PStack
please include function test_BStack.
/* Goal: Allow probabilistic branching deep within nested function calls
Like this, to return 4 different values:
S color = "black" with probability 0.75
or "white" with probability 0.25;
S shape = "circle" with probability 0.4
or "square" with probability 0.6;
return "A " + color + " " + shape;
*/
svoid test_PStack() {
test_PStack_oneBranch();
test_PStack_twoBranches();
test_PStack_undos();
test_PStack_oneBranch3Options();
test_PStack_twoBranches3Options();
test_PStack_noOptions();
}
svoid test_PStack_oneBranch() {
assertEqualsVerbose(
ll("Color is black", "Color is white"),
pstackComputeAll(new test_BStack_OneBranch));
}
svoid test_PStack_oneBranch3Options() {
assertEqualsVerbose(
ll("Color is black", "Color is white", "Color is gray"),
pstackComputeAll(new test_BStack_OneBranch3Options));
}
svoid test_PStack_twoBranches() {
assertEqualsVerbose(
ll("A black circle", "A black square",
"A white circle", "A white square"),
pstackComputeAll(new test_BStack_TwoBranches));
}
svoid test_PStack_twoBranches3Options() {
assertEqualsVerbose(
ll("A black circle", "A black square", "A black triangle",
"A white circle", "A white square", "A white triangle",
"A gray circle", "A gray square", "A gray triangle"),
pstackComputeAll(new test_BStack_TwoBranches3Options));
}
svoid test_PStack_noOptions() {
assertInnerExceptionOfTypeVerbose(PStack.NoOptionsException.class,
-> pstackComputeAll(new test_BStack_NoOptions));
}