update and unskip collection sugar tests

This commit is contained in:
DieMyst 2022-03-03 15:48:19 +03:00
parent 29696fe06e
commit 20bdf06e48
3 changed files with 103 additions and 91 deletions

View File

@ -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

View File

@ -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"], []]);
}); });

View File

@ -46,8 +46,6 @@ export function arraySugar(...args: any) {
(call %init_peer_id% ("getDataSrv" "m") [] m) (call %init_peer_id% ("getDataSrv" "m") [] m)
) )
(new $str (new $str
(seq
(seq
(seq (seq
(seq (seq
(seq (seq
@ -77,13 +75,12 @@ export function arraySugar(...args: any) {
) )
) )
(fold array-sugar-1-0 i (fold array-sugar-1-0 i
(null) (seq
)
)
(ap i $str) (ap i $str)
)
(next i) (next i)
) )
)
)
(call %init_peer_id% ("op" "identity") [$str] str-fix) (call %init_peer_id% ("op" "identity") [$str] str-fix)
) )
) )
@ -174,8 +171,6 @@ export function streamSugar(...args: any) {
(seq (seq
(seq (seq
(seq (seq
(seq
(seq
(seq (seq
(seq (seq
(seq (seq
@ -191,13 +186,12 @@ export function streamSugar(...args: any) {
(ap m $stream-sugar-0) (ap m $stream-sugar-0)
) )
(fold $stream-sugar-0 i (fold $stream-sugar-0 i
(null) (seq
)
)
(ap i $str) (ap i $str)
)
(next i) (next i)
) )
)
)
(call %init_peer_id% ("op" "identity") [$stream-sugar] arr-fix) (call %init_peer_id% ("op" "identity") [$stream-sugar] arr-fix)
) )
) )
@ -296,10 +290,6 @@ export function optionSugar(...args: any) {
) )
(new $str (new $str
(seq (seq
(seq
(seq
(seq
(seq
(seq (seq
(seq (seq
(seq (seq
@ -307,25 +297,41 @@ export function optionSugar(...args: any) {
(seq (seq
(new $option-sugar (new $option-sugar
(seq (seq
(xor
(xor (xor
(ap numNone.$.[0]! $option-sugar) (ap numNone.$.[0]! $option-sugar)
(ap numSome.$.[0]! $option-sugar) (ap numSome.$.[0]! $option-sugar)
) )
(null)
)
(call %init_peer_id% ("op" "identity") [$option-sugar] option-sugar-0) (call %init_peer_id% ("op" "identity") [$option-sugar] option-sugar-0)
) )
) )
(new $option-sugar-1 (new $option-sugar-1
(seq (seq
(xor
(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)
)
(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) (call %init_peer_id% ("op" "identity") [$option-sugar-1] option-sugar-1-0)
) )
) )
) )
(new $option-sugar-2 (new $option-sugar-2
(seq (seq
(xor
(xor (xor
(xor (xor
(ap strSome.$.[0]! $option-sugar-2) (ap strSome.$.[0]! $option-sugar-2)
@ -333,36 +339,39 @@ export function optionSugar(...args: any) {
) )
(ap "random string" $option-sugar-2) (ap "random string" $option-sugar-2)
) )
(null)
)
(call %init_peer_id% ("op" "identity") [$option-sugar-2] option-sugar-2-0) (call %init_peer_id% ("op" "identity") [$option-sugar-2] option-sugar-2-0)
) )
) )
) )
(fold option-sugar-2-0 i (fold option-sugar-2-0 i
(null) (seq
)
)
(ap i $str) (ap i $str)
)
(next i) (next i)
) )
)
)
(new $option-sugar-3 (new $option-sugar-3
(seq (seq
(xor
(xor (xor
(ap strNone.$.[0]! $option-sugar-3) (ap strNone.$.[0]! $option-sugar-3)
(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) (call %init_peer_id% ("op" "identity") [$option-sugar-3] option-sugar-3-0)
) )
) )
) )
(fold option-sugar-3-0 i (fold option-sugar-3-0 i
(null) (seq
)
)
(ap i $str) (ap i $str)
)
(next i) (next i)
) )
)
)
(call %init_peer_id% ("op" "identity") [$str] str-fix) (call %init_peer_id% ("op" "identity") [$str] str-fix)
) )
) )