From ab9f9b0e09f1596e56ce921d86f23d45ac2adf7e Mon Sep 17 00:00:00 2001 From: DieMyst Date: Tue, 12 Jul 2022 11:30:03 +0300 Subject: [PATCH] fix test --- aqua/examples/collectionSugar.aqua | 11 ++--- src/compiled/examples/collectionSugar.ts | 58 ++++++++++++++++++------ src/examples/collectionSugarCall.ts | 3 +- 3 files changed, 52 insertions(+), 20 deletions(-) diff --git a/aqua/examples/collectionSugar.aqua b/aqua/examples/collectionSugar.aqua index 6e8d586..15b641d 100644 --- a/aqua/examples/collectionSugar.aqua +++ b/aqua/examples/collectionSugar.aqua @@ -45,13 +45,12 @@ service GetArr("getArr"): getArr: -> []string func getNeighbours() -> []string: - nodes <- Kademlia.neighborhood("123", nil, nil) + nodes <- GetArr.getArr() <- nodes func bugLNG59() -> string: - on HOST_PEER_ID: - nodes <- GetArr.getArr() - n = nodes[1] - on n: - res <- OpO.identity("some str") + nodes <- getNeighbours() + n = nodes[1] + on n via [HOST_PEER_ID]: + res <- OpO.identity("some str") <- res diff --git a/src/compiled/examples/collectionSugar.ts b/src/compiled/examples/collectionSugar.ts index 4a909c4..70d026b 100644 --- a/src/compiled/examples/collectionSugar.ts +++ b/src/compiled/examples/collectionSugar.ts @@ -581,7 +581,7 @@ export function getNeighbours(...args: any) { (seq (seq (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-) - (call %init_peer_id% ("kad" "neighborhood") ["123" [] []] nodes) + (call %init_peer_id% ("getArr" "getArr") [] nodes) ) (xor (call %init_peer_id% ("callbackSrv" "response") [nodes]) @@ -647,30 +647,62 @@ export function bugLNG59(...args: any) { (xor (seq (seq - (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-) - (xor + (seq (seq - (call -relay- ("getArr" "getArr") [] nodes) - (xor + (seq (seq - (call nodes.$.[1]! ("op" "identity") ["some str"] res) - (call -relay- ("op" "noop") []) + (call %init_peer_id% ("getDataSrv" "-relay-") [] -relay-) + (call %init_peer_id% ("getArr" "getArr") [] nodes) ) - (seq - (call -relay- ("op" "noop") []) - (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) + (new $array-inline + (seq + (ap -relay- $array-inline) + (call %init_peer_id% ("op" "identity") [$array-inline] array-inline-0) + ) ) ) + (call -relay- ("op" "noop") []) + ) + (fold array-inline-0 -via-peer- + (seq + (call -via-peer- ("op" "noop") []) + (next -via-peer-) + ) + ) + ) + (xor + (seq + (seq + (call nodes.$.[1]! ("op" "identity") ["some str"] res) + (fold array-inline-0 -via-peer- + (seq + (next -via-peer-) + (call -via-peer- ("op" "noop") []) + ) + ) + ) + (call -relay- ("op" "noop") []) + ) + (seq + (seq + (fold array-inline-0 -via-peer- + (seq + (call -via-peer- ("op" "noop") []) + (next -via-peer-) + ) + ) + (call -relay- ("op" "noop") []) + ) + (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 1]) ) - (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2]) ) ) (xor (call %init_peer_id% ("callbackSrv" "response") [res]) - (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3]) + (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 2]) ) ) - (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 4]) + (call %init_peer_id% ("errorHandlingSrv" "error") [%last_error% 3]) ) ` return callFunction( diff --git a/src/examples/collectionSugarCall.ts b/src/examples/collectionSugarCall.ts index 9d71a74..8b5a4d8 100644 --- a/src/examples/collectionSugarCall.ts +++ b/src/examples/collectionSugarCall.ts @@ -31,5 +31,6 @@ export async function bugLNG59Call(nodes: string[]): Promise { } }) - return bugLNG59() + const a = await bugLNG59() + return a } \ No newline at end of file