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:
arr = ?[numNone!, numSome!]
str: *string
str2 = ?[strNone!, strNone!]
str2 = ?[strNone!, strNone!, strNone!, strNone!, strNone!]
for i <- ?[strSome!,strNone!, "random string"]:
str <<- i

View File

@ -163,17 +163,20 @@ describe('Testing examples', () => {
expect(streamCanResult).toEqual([["a"], ["b"], []]);
});
it.skip('collectionSugar.aqua array', async () => {
it('collectionSugar array', async () => {
console.log("collectionSugar array")
let result = await arraySugarCall();
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();
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()
expect(result).toEqual([[1], ["some"], []]);
});

View File

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