Skip to content

Random failed while default constraint placed inside if-else block #31

@LeeKaiXuan

Description

@LeeKaiXuan

Description

When a default constraint is placed inside an if-else block, randomization fails.

Scenario Code

// Example showing default constraint inside if-else
component pss_top {
    action root_a {
        activity {
            do testTruePath;
            do testFalsePath;
        }
    }

    action testTruePath {
        rand int value;
        constraint {
            if (1) {
                default value == 1;
            } else {
                default value == 2;
            }
        }
        exec body ASM = """testTruePath: {{value}}""";
    }

    action testFalsePath {
        rand int value;
        constraint {
            if (0) {
                default value == 1;
            } else {
                default value == 2;
            }
        }
        exec body ASM = """testFalsePath: {{value}}""";
    }
}

Expected Output or Behaviour

testTruePath: 1
testFalsePath: 2

Error Message from PSSGen or JAVA (Optional)

PSSRandom.limitRetry(), Ln55: randomize fail

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions