Skip to content

Commit

Permalink
WIP: test
Browse files Browse the repository at this point in the history
  • Loading branch information
ggreif committed Aug 12, 2024
1 parent 84e42e1 commit b3ea1c2
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/run-drun/ok/par.drun-run.ok
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ingress Completed: Reply: 0x4449444c016c01b3c4b1f204680100010a00000000000000000101
ingress Completed: Reply: 0x4449444c0000
48 changes: 48 additions & 0 deletions test/run-drun/par.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
actor {

func foo(next : () -> async ()) : async () {
await (with cycles = 3000) next()
};

func bar(next : () -> async ()) : async () = async {
await (with cycles = 4000) next()
};

public func oneshot() {
};

public func test(): async () {
let message = "Hi!";

func closA() : async Nat {
message.size()
};

func closB() : async Nat = async {
message.size()
};
/*
// this is ruled out
func closC() : async Nat =
if (1 == 2) async {
message.size()
} else async {
message.size() + 1
};
*/
assert 42 == 42;
assert 3 == (await (with cycles = 101) closA());
assert 3 == (await (with cycles = 102) closB());

await (with yeah = 8; timeout = 55; cycles = 1000)
foo(func() : async () = async { assert message == "Hi!" });
await (with cycles = 5000)
bar(func() : async () = async { assert message == "Hi!" });
};


public func test2() : async () {
await (with cycles = 1042) async { }

}
}

0 comments on commit b3ea1c2

Please sign in to comment.