mirror of
https://github.com/fluencelabs/aqua-playground
synced 2025-06-01 20:21:40 +00:00
update and unskip collection sugar tests
This commit is contained in:
parent
29696fe06e
commit
20bdf06e48
@ -15,7 +15,7 @@ func streamSugar(n: u32, m: u32) -> []u32, []u32:
|
|||||||
func optionSugar(numSome: ?u32, strSome: ?string, numNone: ?u32, strNone: ?string) -> []u32, []string, []string:
|
func optionSugar(numSome: ?u32, strSome: ?string, numNone: ?u32, strNone: ?string) -> []u32, []string, []string:
|
||||||
arr = ?[numNone!, numSome!]
|
arr = ?[numNone!, numSome!]
|
||||||
str: *string
|
str: *string
|
||||||
str2 = ?[strNone!, strNone!]
|
str2 = ?[strNone!, strNone!, strNone!, strNone!, strNone!]
|
||||||
for i <- ?[strSome!,strNone!, "random string"]:
|
for i <- ?[strSome!,strNone!, "random string"]:
|
||||||
str <<- i
|
str <<- i
|
||||||
|
|
||||||
|
@ -163,17 +163,20 @@ describe('Testing examples', () => {
|
|||||||
expect(streamCanResult).toEqual([["a"], ["b"], []]);
|
expect(streamCanResult).toEqual([["a"], ["b"], []]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('collectionSugar.aqua array', async () => {
|
it('collectionSugar array', async () => {
|
||||||
|
console.log("collectionSugar array")
|
||||||
let result = await arraySugarCall();
|
let result = await arraySugarCall();
|
||||||
expect(result).toEqual([[1,2,3], [4,5,6]]);
|
expect(result).toEqual([[1,2,3], [4,5,6]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('collectionSugar.aqua stream', async () => {
|
it('collectionSugar stream', async () => {
|
||||||
|
console.log("collectionSugar stream")
|
||||||
let result = await streamSugarCall();
|
let result = await streamSugarCall();
|
||||||
expect(result).toEqual([[1,2,3], [4,5,6]]);
|
expect(result).toEqual([[1,2,3], [4,5,6]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.skip('collectionSugar.aqua option', async () => {
|
it('collectionSugar option', async () => {
|
||||||
|
console.log("collectionSugar option")
|
||||||
let result = await optionSugarCall()
|
let result = await optionSugarCall()
|
||||||
expect(result).toEqual([[1], ["some"], []]);
|
expect(result).toEqual([[1], ["some"], []]);
|
||||||
});
|
});
|
||||||
|
@ -49,40 +49,37 @@ export function arraySugar(...args: any) {
|
|||||||
(seq
|
(seq
|
||||||
(seq
|
(seq
|
||||||
(seq
|
(seq
|
||||||
(seq
|
(new $array-sugar
|
||||||
(seq
|
(seq
|
||||||
(new $array-sugar
|
(seq
|
||||||
(seq
|
(seq
|
||||||
(seq
|
(ap 1 $array-sugar)
|
||||||
(seq
|
(ap 2 $array-sugar)
|
||||||
(ap 1 $array-sugar)
|
|
||||||
(ap 2 $array-sugar)
|
|
||||||
)
|
|
||||||
(ap n $array-sugar)
|
|
||||||
)
|
|
||||||
(call %init_peer_id% ("op" "identity") [$array-sugar] array-sugar-0)
|
|
||||||
)
|
)
|
||||||
|
(ap n $array-sugar)
|
||||||
)
|
)
|
||||||
(new $array-sugar-1
|
(call %init_peer_id% ("op" "identity") [$array-sugar] array-sugar-0)
|
||||||
(seq
|
)
|
||||||
(seq
|
)
|
||||||
(seq
|
(new $array-sugar-1
|
||||||
(ap 4 $array-sugar-1)
|
(seq
|
||||||
(ap 5 $array-sugar-1)
|
(seq
|
||||||
)
|
(seq
|
||||||
(ap m $array-sugar-1)
|
(ap 4 $array-sugar-1)
|
||||||
)
|
(ap 5 $array-sugar-1)
|
||||||
(call %init_peer_id% ("op" "identity") [$array-sugar-1] array-sugar-1-0)
|
)
|
||||||
)
|
(ap m $array-sugar-1)
|
||||||
)
|
)
|
||||||
)
|
(call %init_peer_id% ("op" "identity") [$array-sugar-1] array-sugar-1-0)
|
||||||
(fold array-sugar-1-0 i
|
|
||||||
(null)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(ap i $str)
|
|
||||||
)
|
)
|
||||||
(next i)
|
(fold array-sugar-1-0 i
|
||||||
|
(seq
|
||||||
|
(ap i $str)
|
||||||
|
(next i)
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
(call %init_peer_id% ("op" "identity") [$str] str-fix)
|
(call %init_peer_id% ("op" "identity") [$str] str-fix)
|
||||||
)
|
)
|
||||||
@ -177,26 +174,23 @@ export function streamSugar(...args: any) {
|
|||||||
(seq
|
(seq
|
||||||
(seq
|
(seq
|
||||||
(seq
|
(seq
|
||||||
(seq
|
(ap 1 $stream-sugar)
|
||||||
(seq
|
(ap 2 $stream-sugar)
|
||||||
(ap 1 $stream-sugar)
|
|
||||||
(ap 2 $stream-sugar)
|
|
||||||
)
|
|
||||||
(ap n $stream-sugar)
|
|
||||||
)
|
|
||||||
(ap 4 $stream-sugar-0)
|
|
||||||
)
|
)
|
||||||
(ap 5 $stream-sugar-0)
|
(ap n $stream-sugar)
|
||||||
)
|
)
|
||||||
(ap m $stream-sugar-0)
|
(ap 4 $stream-sugar-0)
|
||||||
)
|
|
||||||
(fold $stream-sugar-0 i
|
|
||||||
(null)
|
|
||||||
)
|
)
|
||||||
|
(ap 5 $stream-sugar-0)
|
||||||
|
)
|
||||||
|
(ap m $stream-sugar-0)
|
||||||
|
)
|
||||||
|
(fold $stream-sugar-0 i
|
||||||
|
(seq
|
||||||
|
(ap i $str)
|
||||||
|
(next i)
|
||||||
)
|
)
|
||||||
(ap i $str)
|
|
||||||
)
|
)
|
||||||
(next i)
|
|
||||||
)
|
)
|
||||||
(call %init_peer_id% ("op" "identity") [$stream-sugar] arr-fix)
|
(call %init_peer_id% ("op" "identity") [$stream-sugar] arr-fix)
|
||||||
)
|
)
|
||||||
@ -301,67 +295,82 @@ export function optionSugar(...args: any) {
|
|||||||
(seq
|
(seq
|
||||||
(seq
|
(seq
|
||||||
(seq
|
(seq
|
||||||
(seq
|
(new $option-sugar
|
||||||
(seq
|
(seq
|
||||||
(seq
|
(xor
|
||||||
(seq
|
(xor
|
||||||
(new $option-sugar
|
(ap numNone.$.[0]! $option-sugar)
|
||||||
(seq
|
(ap numSome.$.[0]! $option-sugar)
|
||||||
(xor
|
|
||||||
(ap numNone.$.[0]! $option-sugar)
|
|
||||||
(ap numSome.$.[0]! $option-sugar)
|
|
||||||
)
|
|
||||||
(call %init_peer_id% ("op" "identity") [$option-sugar] option-sugar-0)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(new $option-sugar-1
|
|
||||||
(seq
|
|
||||||
(xor
|
|
||||||
(ap strNone.$.[0]! $option-sugar-1)
|
|
||||||
(ap strNone.$.[0]! $option-sugar-1)
|
|
||||||
)
|
|
||||||
(call %init_peer_id% ("op" "identity") [$option-sugar-1] option-sugar-1-0)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
(new $option-sugar-2
|
|
||||||
(seq
|
|
||||||
(xor
|
|
||||||
(xor
|
|
||||||
(ap strSome.$.[0]! $option-sugar-2)
|
|
||||||
(ap strNone.$.[0]! $option-sugar-2)
|
|
||||||
)
|
|
||||||
(ap "random string" $option-sugar-2)
|
|
||||||
)
|
|
||||||
(call %init_peer_id% ("op" "identity") [$option-sugar-2] option-sugar-2-0)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
(fold option-sugar-2-0 i
|
|
||||||
(null)
|
(null)
|
||||||
)
|
)
|
||||||
|
(call %init_peer_id% ("op" "identity") [$option-sugar] option-sugar-0)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(new $option-sugar-1
|
||||||
|
(seq
|
||||||
|
(xor
|
||||||
|
(xor
|
||||||
|
(xor
|
||||||
|
(xor
|
||||||
|
(xor
|
||||||
|
(ap strNone.$.[0]! $option-sugar-1)
|
||||||
|
(ap strNone.$.[0]! $option-sugar-1)
|
||||||
|
)
|
||||||
|
(ap strNone.$.[0]! $option-sugar-1)
|
||||||
|
)
|
||||||
|
(ap strNone.$.[0]! $option-sugar-1)
|
||||||
|
)
|
||||||
|
(ap strNone.$.[0]! $option-sugar-1)
|
||||||
|
)
|
||||||
|
(null)
|
||||||
|
)
|
||||||
|
(call %init_peer_id% ("op" "identity") [$option-sugar-1] option-sugar-1-0)
|
||||||
)
|
)
|
||||||
(ap i $str)
|
|
||||||
)
|
)
|
||||||
(next i)
|
|
||||||
)
|
)
|
||||||
(new $option-sugar-3
|
(new $option-sugar-2
|
||||||
(seq
|
(seq
|
||||||
(xor
|
(xor
|
||||||
(ap strNone.$.[0]! $option-sugar-3)
|
(xor
|
||||||
(ap strNone.$.[0]! $option-sugar-3)
|
(xor
|
||||||
|
(ap strSome.$.[0]! $option-sugar-2)
|
||||||
|
(ap strNone.$.[0]! $option-sugar-2)
|
||||||
|
)
|
||||||
|
(ap "random string" $option-sugar-2)
|
||||||
|
)
|
||||||
|
(null)
|
||||||
)
|
)
|
||||||
(call %init_peer_id% ("op" "identity") [$option-sugar-3] option-sugar-3-0)
|
(call %init_peer_id% ("op" "identity") [$option-sugar-2] option-sugar-2-0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(fold option-sugar-3-0 i
|
(fold option-sugar-2-0 i
|
||||||
(null)
|
(seq
|
||||||
|
(ap i $str)
|
||||||
|
(next i)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
(new $option-sugar-3
|
||||||
|
(seq
|
||||||
|
(xor
|
||||||
|
(xor
|
||||||
|
(ap strNone.$.[0]! $option-sugar-3)
|
||||||
|
(ap strNone.$.[0]! $option-sugar-3)
|
||||||
|
)
|
||||||
|
(null)
|
||||||
|
)
|
||||||
|
(call %init_peer_id% ("op" "identity") [$option-sugar-3] option-sugar-3-0)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
(ap i $str)
|
|
||||||
)
|
)
|
||||||
(next i)
|
(fold option-sugar-3-0 i
|
||||||
|
(seq
|
||||||
|
(ap i $str)
|
||||||
|
(next i)
|
||||||
|
)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
(call %init_peer_id% ("op" "identity") [$str] str-fix)
|
(call %init_peer_id% ("op" "identity") [$str] str-fix)
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user