mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-07-31 08:31:56 +00:00
add test
This commit is contained in:
@@ -1,23 +1,13 @@
|
||||
func toOpt(s: string) -> ?string:
|
||||
str: ?string
|
||||
str: *string
|
||||
str <<- s
|
||||
<- str
|
||||
|
||||
-- func accumRes() -> *string:
|
||||
-- res_accum: *string
|
||||
-- a <- toOpt("a")
|
||||
-- res_accum <<- a
|
||||
-- res_accum <- toOpt("b")
|
||||
-- res_accum <<- nil
|
||||
-- <- res_accum
|
||||
|
||||
func accumRes(a: string, b: string) -> []?string:
|
||||
func accumRes() -> *?string:
|
||||
res_accum: *?string
|
||||
str: ?string
|
||||
str <<- a
|
||||
str2: ?string
|
||||
str2 <<- b
|
||||
res_accum <<- str
|
||||
res_accum <<- str2
|
||||
-- todo: add when 277 fixed
|
||||
-- a <- toOpt("a")
|
||||
-- res_accum <<- a
|
||||
res_accum <- toOpt("b")
|
||||
res_accum <<- nil
|
||||
<- res_accum
|
||||
<- res_accum
|
||||
|
@@ -136,7 +136,8 @@ describe('Testing examples', () => {
|
||||
|
||||
it('streamCan.aqua', async () => {
|
||||
let streamCanResult = await streamCanCall();
|
||||
expect(streamCanResult).toBe([["a"], ["b"], []]);
|
||||
expect(streamCanResult).toBe([["b"], []]);
|
||||
// expect(streamCanResult).toBe([["a"], ["b"], []]);
|
||||
});
|
||||
|
||||
it('topology.aqua', async () => {
|
||||
|
@@ -142,9 +142,15 @@ export function returnNil(...args: any) {
|
||||
let script = `
|
||||
(xor
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(seq
|
||||
(seq
|
||||
(call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-)
|
||||
(call %init_peer_id% ("op" "identity") [$valueNil] valueNil-0)
|
||||
)
|
||||
(ap valueNil-0 $relayNil)
|
||||
)
|
||||
(xor
|
||||
(call %init_peer_id% ("callbackSrv" "response") [$valueNil])
|
||||
(call %init_peer_id% ("callbackSrv" "response") [$relayNil])
|
||||
(call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1])
|
||||
)
|
||||
)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import {accumRes} from "../compiled/examples/streamCan";
|
||||
|
||||
export async function streamCanCall() {
|
||||
return await accumRes("a", "b");
|
||||
return await accumRes();
|
||||
}
|
||||
|
Reference in New Issue
Block a user