Skip to content

Commit

Permalink
Fixing the missing ToDict function in PEvent (#652)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankushdesai committed Sep 13, 2023
1 parent bf2394f commit 1e99f40
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
7 changes: 6 additions & 1 deletion Src/PRuntimes/PCSharpRuntime/PEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public virtual IPrtValue Clone()

public object ToDict()
{
throw new NotImplementedException();
return this.GetType().Name;
}

public override bool Equals(object obj)
Expand All @@ -41,6 +41,11 @@ public override int GetHashCode()
{
return GetType().FullName.GetHashCode();
}

public override string ToString()
{
return GetType().Name;
}
}

public class PHalt : PEvent
Expand Down
7 changes: 5 additions & 2 deletions Tst/RegressionTests/Feature3Exprs/Correct/events1/events1.p
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
event eAllocateRequest;
event eAllocateRequest: event;

machine Main {
start state Init {
Expand All @@ -8,8 +8,11 @@ machine Main {
var myevent: event;
myevent = eAllocateRequest;
myevents += (eAllocateRequest);
send this, eAllocateRequest, eAllocateRequest;
print(format("myevents: {0}", myevents));
assert (myevent in myevents && eAllocateRequest == myevent);
assert ((myevent in myevents) && eAllocateRequest == myevent);
}
ignore eAllocateRequest;
}

}

0 comments on commit 1e99f40

Please sign in to comment.