From 3974ce7c4f0623cef3fcf0abf95d8be6a54d3b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Sun, 7 Mar 2021 17:47:08 +0100 Subject: auto indent the tests --- progs/tests/auto/add.sy | 2 +- progs/tests/auto/advanced_break.sy | 32 ++++++++++++------------ progs/tests/auto/advanced_continue.sy | 32 ++++++++++++------------ progs/tests/auto/assignment.sy | 10 ++++---- progs/tests/auto/blob_complex.sy | 26 +++++++++---------- progs/tests/auto/blob_infer.sy | 6 ++--- progs/tests/auto/blob_simple.sy | 10 ++++---- progs/tests/auto/calls_inside_calls.sy | 18 ++++++------- progs/tests/auto/cluster.sy | 22 ++++++++-------- progs/tests/auto/compare_constants_equality.sy | 6 ++--- progs/tests/auto/compare_constants_unequality.sy | 6 ++--- progs/tests/auto/compare_variable.sy | 14 +++++------ progs/tests/auto/conflict_markers.sy | 4 +-- progs/tests/auto/constant_function.sy | 2 +- progs/tests/auto/constants_in_inner_functions.sy | 26 +++++++++---------- progs/tests/auto/div.sy | 6 ++--- progs/tests/auto/else_.sy | 16 ++++++------ progs/tests/auto/else_if.sy | 20 +++++++-------- progs/tests/auto/expressions.sy | 6 ++--- progs/tests/auto/field.sy | 2 +- progs/tests/auto/field_assign.sy | 6 ++--- progs/tests/auto/field_get.sy | 10 ++++---- progs/tests/auto/in_rhs.sy | 2 +- progs/tests/auto/instantiate.sy | 6 ++--- progs/tests/auto/invalid_assign.sy | 6 ++--- progs/tests/auto/more_types.sy | 4 +-- progs/tests/auto/mul.sy | 2 +- progs/tests/auto/multiple_fields.sy | 18 ++++++------- progs/tests/auto/multiple_returns.sy | 20 +++++++-------- progs/tests/auto/negation.sy | 10 ++++---- progs/tests/auto/not.sy | 4 +-- progs/tests/auto/one_arg.sy | 4 +-- progs/tests/auto/param_1.sy | 4 +-- progs/tests/auto/param_2.sy | 10 ++++---- progs/tests/auto/param_and_return.sy | 10 ++++---- progs/tests/auto/parenthesis.sy | 2 +- progs/tests/auto/passing_functions.sy | 14 +++++------ progs/tests/auto/passing_functions_mixed.sy | 14 +++++------ progs/tests/auto/precedence.sy | 12 ++++----- progs/tests/auto/return_1.sy | 8 +++--- progs/tests/auto/returning_closures.sy | 30 +++++++++++----------- progs/tests/auto/simple.sy | 12 ++++----- progs/tests/auto/simple_add.sy | 10 ++++---- progs/tests/auto/simple_break.sy | 14 +++++------ progs/tests/auto/simple_continue.sy | 14 +++++------ progs/tests/auto/simple_sub.sy | 10 ++++---- progs/tests/auto/simplest.sy | 4 +-- progs/tests/auto/single_variable.sy | 4 +-- progs/tests/auto/stack_ordering.sy | 8 +++--- progs/tests/auto/strange.sy | 18 ++++++------- progs/tests/auto/sub.sy | 2 +- progs/tests/auto/terms_and_factors.sy | 4 +-- progs/tests/auto/three_arg.sy | 4 +-- progs/tests/auto/two_arg.sy | 4 +-- progs/tests/auto/two_variables.sy | 8 +++--- progs/tests/auto/types.sy | 4 +-- progs/tests/auto/uncallable_type.sy | 9 +++---- progs/tests/auto/wrong_params.sy | 4 +-- progs/tests/auto/wrong_ret.sy | 4 +-- 59 files changed, 299 insertions(+), 300 deletions(-) diff --git a/progs/tests/auto/add.sy b/progs/tests/auto/add.sy index 4e8e643..3fadd86 100644 --- a/progs/tests/auto/add.sy +++ b/progs/tests/auto/add.sy @@ -1,3 +1,3 @@ start :: fn { -(1, 2, 3, 4) + (4, 3, 2, 1) <=> (5, 5, 5, 5) + (1, 2, 3, 4) + (4, 3, 2, 1) <=> (5, 5, 5, 5) } diff --git a/progs/tests/auto/advanced_break.sy b/progs/tests/auto/advanced_break.sy index 1cfcece..591dffd 100644 --- a/progs/tests/auto/advanced_break.sy +++ b/progs/tests/auto/advanced_break.sy @@ -1,22 +1,22 @@ start :: fn { -a := 0 -for i := 0, i < 10, i += 1 { - q := 0 - qq := 0 - qqq := 0 - qqqq := 0 + a := 0 + for i := 0, i < 10, i += 1 { + q := 0 + qq := 0 + qqq := 0 + qqqq := 0 - a = a + 1 - if i == 2 { - break - } + a = a + 1 + if i == 2 { + break + } - q - qq - qqq - qqqq -} -a <=> 3 + q + qq + qqq + qqqq + } + a <=> 3 } diff --git a/progs/tests/auto/advanced_continue.sy b/progs/tests/auto/advanced_continue.sy index 70a8671..1a3bb00 100644 --- a/progs/tests/auto/advanced_continue.sy +++ b/progs/tests/auto/advanced_continue.sy @@ -1,22 +1,22 @@ start :: fn { -a := 0 -for i := 0, i < 4, i += 1 { - q := 0 - qq := 0 - qqq := 0 - qqqq := 0 + a := 0 + for i := 0, i < 4, i += 1 { + q := 0 + qq := 0 + qqq := 0 + qqqq := 0 - if i == 2 { - continue - } - a = a + 1 + if i == 2 { + continue + } + a = a + 1 - q - qq - qqq - qqqq -} -a <=> 3 + q + qq + qqq + qqqq + } + a <=> 3 } diff --git a/progs/tests/auto/assignment.sy b/progs/tests/auto/assignment.sy index 51cbecc..5ab9f6b 100644 --- a/progs/tests/auto/assignment.sy +++ b/progs/tests/auto/assignment.sy @@ -1,7 +1,7 @@ start :: fn { -a := 1 - b := 2 - a = b - a <=> 2 - b <=> 2 + a := 1 + b := 2 + a = b + a <=> 2 + b <=> 2 } diff --git a/progs/tests/auto/blob_complex.sy b/progs/tests/auto/blob_complex.sy index d40082f..b139a3a 100644 --- a/progs/tests/auto/blob_complex.sy +++ b/progs/tests/auto/blob_complex.sy @@ -1,19 +1,19 @@ start :: fn { -a := A() -b := B() -c := C() -b2 := B() + a := A() + b := B() + c := C() + b2 := B() -a -b -c -b2 + a + b + c + b2 -blob A { - c: C -} -blob C { } -blob B { } + blob A { + c: C + } + blob C { } + blob B { } } diff --git a/progs/tests/auto/blob_infer.sy b/progs/tests/auto/blob_infer.sy index cee18bf..0a1ce1b 100644 --- a/progs/tests/auto/blob_infer.sy +++ b/progs/tests/auto/blob_infer.sy @@ -1,8 +1,8 @@ start :: fn { -blob A { } + blob A { } -a : A = A() -a + a : A = A() + a } diff --git a/progs/tests/auto/blob_simple.sy b/progs/tests/auto/blob_simple.sy index f05ec07..ea832cd 100644 --- a/progs/tests/auto/blob_simple.sy +++ b/progs/tests/auto/blob_simple.sy @@ -1,10 +1,10 @@ start :: fn { -a := A() -a + a := A() + a -blob A { - a: int -} + blob A { + a: int + } } diff --git a/progs/tests/auto/calls_inside_calls.sy b/progs/tests/auto/calls_inside_calls.sy index 578f418..5f6716b 100644 --- a/progs/tests/auto/calls_inside_calls.sy +++ b/progs/tests/auto/calls_inside_calls.sy @@ -1,11 +1,11 @@ start :: fn { -one := fn -> int { - ret 1 - } - add := fn a: int, b: int -> int { - ret a + b - } - add(one(), one()) <=> 2 - add(add(one(), one()), one()) <=> 3 - add(one(), add(one(), one())) <=> 3 + one := fn -> int { + ret 1 + } + add := fn a: int, b: int -> int { + ret a + b + } + add(one(), one()) <=> 2 + add(add(one(), one()), one()) <=> 3 + add(one(), add(one(), one())) <=> 3 } diff --git a/progs/tests/auto/cluster.sy b/progs/tests/auto/cluster.sy index 8f279e7..dc8ec72 100644 --- a/progs/tests/auto/cluster.sy +++ b/progs/tests/auto/cluster.sy @@ -1,14 +1,14 @@ start :: fn { -blob A { a: int } -a := A() -a.a = 0 -a.a += 1 -a.a <=> 1 -a.a *= 2 -a.a <=> 2 -a.a /= 2 -a.a <=> 1 -a.a -= 1 -a.a <=> 0 + blob A { a: int } + a := A() + a.a = 0 + a.a += 1 + a.a <=> 1 + a.a *= 2 + a.a <=> 2 + a.a /= 2 + a.a <=> 1 + a.a -= 1 + a.a <=> 0 } diff --git a/progs/tests/auto/compare_constants_equality.sy b/progs/tests/auto/compare_constants_equality.sy index c8c399b..e8f64ed 100644 --- a/progs/tests/auto/compare_constants_equality.sy +++ b/progs/tests/auto/compare_constants_equality.sy @@ -1,5 +1,5 @@ start :: fn { -if 1 == 2 { - - } + if 1 == 2 { + + } } diff --git a/progs/tests/auto/compare_constants_unequality.sy b/progs/tests/auto/compare_constants_unequality.sy index 8c115b4..21094da 100644 --- a/progs/tests/auto/compare_constants_unequality.sy +++ b/progs/tests/auto/compare_constants_unequality.sy @@ -1,5 +1,5 @@ start :: fn { -if 1 != 1 { - - } + if 1 != 1 { + + } } diff --git a/progs/tests/auto/compare_variable.sy b/progs/tests/auto/compare_variable.sy index 25d21f4..80fb4a4 100644 --- a/progs/tests/auto/compare_variable.sy +++ b/progs/tests/auto/compare_variable.sy @@ -1,9 +1,9 @@ start :: fn { -a := 1 - if a == 0 { - - } - if a != 1 { - - } + a := 1 + if a == 0 { + + } + if a != 1 { + + } } diff --git a/progs/tests/auto/conflict_markers.sy b/progs/tests/auto/conflict_markers.sy index 167a751..0760582 100644 --- a/progs/tests/auto/conflict_markers.sy +++ b/progs/tests/auto/conflict_markers.sy @@ -1,9 +1,9 @@ start :: fn { <<<<<<< HEAD -print extern_test(4.0) + print extern_test(4.0) ======= -print extern_test(5.0) + print extern_test(5.0) >>>>>>> 2 } diff --git a/progs/tests/auto/constant_function.sy b/progs/tests/auto/constant_function.sy index 2ec4019..22ddfe2 100644 --- a/progs/tests/auto/constant_function.sy +++ b/progs/tests/auto/constant_function.sy @@ -1,4 +1,4 @@ a :: fn {} start :: fn { - a() + a() } diff --git a/progs/tests/auto/constants_in_inner_functions.sy b/progs/tests/auto/constants_in_inner_functions.sy index 3371393..99704e7 100644 --- a/progs/tests/auto/constants_in_inner_functions.sy +++ b/progs/tests/auto/constants_in_inner_functions.sy @@ -1,20 +1,20 @@ start :: fn { -q : int = 0 + q : int = 0 -f :: fn -> fn -> { - g :: fn { - q += 1 + f :: fn -> fn -> { + g :: fn { + q += 1 + } + ret g } - ret g -} -g := f() -g() -q <=> 1 -g() -q <=> 2 -g() -q <=> 3 + g := f() + g() + q <=> 1 + g() + q <=> 2 + g() + q <=> 3 } diff --git a/progs/tests/auto/div.sy b/progs/tests/auto/div.sy index 3073270..df3e7bb 100644 --- a/progs/tests/auto/div.sy +++ b/progs/tests/auto/div.sy @@ -1,5 +1,5 @@ start :: fn { -a := 2 -a /= 2 -a <=> 1 + a := 2 + a /= 2 + a <=> 1 } diff --git a/progs/tests/auto/else_.sy b/progs/tests/auto/else_.sy index 896aeb4..0f1d624 100644 --- a/progs/tests/auto/else_.sy +++ b/progs/tests/auto/else_.sy @@ -1,10 +1,10 @@ start :: fn { -a := 1 - res := 0 - if a == 0 { - - } else { - res = 1 - } - res <=> 1 + a := 1 + res := 0 + if a == 0 { + + } else { + res = 1 + } + res <=> 1 } diff --git a/progs/tests/auto/else_if.sy b/progs/tests/auto/else_if.sy index 18b64f6..f31453e 100644 --- a/progs/tests/auto/else_if.sy +++ b/progs/tests/auto/else_if.sy @@ -1,12 +1,12 @@ start :: fn { -a := 1 - res := 0 - if a == 0 { - - } else if a == 1 { - res = 1 - } else { - - } - res <=> 1 + a := 1 + res := 0 + if a == 0 { + + } else if a == 1 { + res = 1 + } else { + + } + res <=> 1 } diff --git a/progs/tests/auto/expressions.sy b/progs/tests/auto/expressions.sy index 0f6d6fc..99569e4 100644 --- a/progs/tests/auto/expressions.sy +++ b/progs/tests/auto/expressions.sy @@ -1,6 +1,6 @@ start :: fn { -1 + 1 // blargh - 2 // blargh - // HARGH + 1 + 1 // blargh + 2 // blargh + // HARGH } diff --git a/progs/tests/auto/field.sy b/progs/tests/auto/field.sy index c985297..b11e51e 100644 --- a/progs/tests/auto/field.sy +++ b/progs/tests/auto/field.sy @@ -1,3 +1,3 @@ start :: fn { -blob A { a: int } + blob A { a: int } } diff --git a/progs/tests/auto/field_assign.sy b/progs/tests/auto/field_assign.sy index 93837ea..4fb6dd4 100644 --- a/progs/tests/auto/field_assign.sy +++ b/progs/tests/auto/field_assign.sy @@ -1,5 +1,5 @@ start :: fn { -blob A { a: int } - a := A() - a.a = 2 + blob A { a: int } + a := A() + a.a = 2 } diff --git a/progs/tests/auto/field_get.sy b/progs/tests/auto/field_get.sy index 0905f6f..49bb0f2 100644 --- a/progs/tests/auto/field_get.sy +++ b/progs/tests/auto/field_get.sy @@ -1,7 +1,7 @@ start :: fn { -blob A { a: int } - a := A() - a.a = 2 - a.a <=> 2 - 2 <=> a.a + blob A { a: int } + a := A() + a.a = 2 + a.a <=> 2 + 2 <=> a.a } diff --git a/progs/tests/auto/in_rhs.sy b/progs/tests/auto/in_rhs.sy index 60e4873..28ed276 100644 --- a/progs/tests/auto/in_rhs.sy +++ b/progs/tests/auto/in_rhs.sy @@ -1,3 +1,3 @@ start :: fn { -5 <=> 1 * 2 + 3 + 5 <=> 1 * 2 + 3 } diff --git a/progs/tests/auto/instantiate.sy b/progs/tests/auto/instantiate.sy index 7d32bf9..bb2f09c 100644 --- a/progs/tests/auto/instantiate.sy +++ b/progs/tests/auto/instantiate.sy @@ -1,5 +1,5 @@ start :: fn { -blob A {} - a := A() - a + blob A {} + a := A() + a } diff --git a/progs/tests/auto/invalid_assign.sy b/progs/tests/auto/invalid_assign.sy index a8b18f0..8ee47ab 100644 --- a/progs/tests/auto/invalid_assign.sy +++ b/progs/tests/auto/invalid_assign.sy @@ -1,7 +1,7 @@ start :: fn { -a := 1 -a = 0.1 -a + a := 1 + a = 0.1 + a } // errors: [ErrorKind::TypeMismatch(Type::Int, Type::Float)] diff --git a/progs/tests/auto/more_types.sy b/progs/tests/auto/more_types.sy index 18d825e..c85403a 100644 --- a/progs/tests/auto/more_types.sy +++ b/progs/tests/auto/more_types.sy @@ -1,4 +1,4 @@ start :: fn { -a: (str, bool, int) = ("abc", true, 1) -a + a: (str, bool, int) = ("abc", true, 1) + a } diff --git a/progs/tests/auto/mul.sy b/progs/tests/auto/mul.sy index 78cc14e..4b33314 100644 --- a/progs/tests/auto/mul.sy +++ b/progs/tests/auto/mul.sy @@ -1,3 +1,3 @@ start :: fn { -(0, 1, 2) * (2, 3, 4) <=> (0, 3, 8) + (0, 1, 2) * (2, 3, 4) <=> (0, 3, 8) } diff --git a/progs/tests/auto/multiple_fields.sy b/progs/tests/auto/multiple_fields.sy index 2a4b3c0..ce4c61f 100644 --- a/progs/tests/auto/multiple_fields.sy +++ b/progs/tests/auto/multiple_fields.sy @@ -1,11 +1,11 @@ start :: fn { -blob A { - a: int - b: int - } - a := A() - a.a = 2 - a.b = 3 - a.a + a.b <=> 5 - 5 <=> a.a + a.b + blob A { + a: int + b: int + } + a := A() + a.a = 2 + a.b = 3 + a.a + a.b <=> 5 + 5 <=> a.a + a.b } diff --git a/progs/tests/auto/multiple_returns.sy b/progs/tests/auto/multiple_returns.sy index 8abc000..6cb5e1a 100644 --- a/progs/tests/auto/multiple_returns.sy +++ b/progs/tests/auto/multiple_returns.sy @@ -1,12 +1,12 @@ start :: fn { -f := fn a: int -> int { - if a == 1 { - ret 2 - } else { - ret 3 - } - } - f(0) <=> 3 - f(1) <=> 2 - f(2) <=> 3 + f := fn a: int -> int { + if a == 1 { + ret 2 + } else { + ret 3 + } + } + f(0) <=> 3 + f(1) <=> 2 + f(2) <=> 3 } diff --git a/progs/tests/auto/negation.sy b/progs/tests/auto/negation.sy index 41388d8..0c702aa 100644 --- a/progs/tests/auto/negation.sy +++ b/progs/tests/auto/negation.sy @@ -1,7 +1,7 @@ start :: fn { --1 <=> 0 - 1 - -1 + 2 <=> 1 - -(1 + 2) <=> -3 - 1 + -1 <=> 0 - 2 * -1 <=> -2 + -1 <=> 0 - 1 + -1 + 2 <=> 1 + -(1 + 2) <=> -3 + 1 + -1 <=> 0 + 2 * -1 <=> -2 } diff --git a/progs/tests/auto/not.sy b/progs/tests/auto/not.sy index 712690a..02dd81d 100644 --- a/progs/tests/auto/not.sy +++ b/progs/tests/auto/not.sy @@ -1,5 +1,5 @@ start :: fn { -f := fn {} - f! + f := fn {} + f! } diff --git a/progs/tests/auto/one_arg.sy b/progs/tests/auto/one_arg.sy index 9523a67..e7dee83 100644 --- a/progs/tests/auto/one_arg.sy +++ b/progs/tests/auto/one_arg.sy @@ -1,5 +1,5 @@ start :: fn { -f := fn a:int { a <=> 1 } - f! 1 + f := fn a:int { a <=> 1 } + f! 1 } diff --git a/progs/tests/auto/param_1.sy b/progs/tests/auto/param_1.sy index 1781eaf..c96089e 100644 --- a/progs/tests/auto/param_1.sy +++ b/progs/tests/auto/param_1.sy @@ -1,4 +1,4 @@ start :: fn { -f := fn a: int {} - f(1) + f := fn a: int {} + f(1) } diff --git a/progs/tests/auto/param_2.sy b/progs/tests/auto/param_2.sy index ac5fdfd..1915c42 100644 --- a/progs/tests/auto/param_2.sy +++ b/progs/tests/auto/param_2.sy @@ -1,7 +1,7 @@ start :: fn { -add := fn a: int, b: int -> int { - ret a + b - } - add(1, 1) <=> 2 - add(10, 20) <=> 30 + add := fn a: int, b: int -> int { + ret a + b + } + add(1, 1) <=> 2 + add(10, 20) <=> 30 } diff --git a/progs/tests/auto/param_and_return.sy b/progs/tests/auto/param_and_return.sy index 7e39775..2752fcc 100644 --- a/progs/tests/auto/param_and_return.sy +++ b/progs/tests/auto/param_and_return.sy @@ -1,7 +1,7 @@ start :: fn { -f := fn a: int -> int { - ret a * 2 - } - f(1) <=> 2 - f(5) <=> 10 + f := fn a: int -> int { + ret a * 2 + } + f(1) <=> 2 + f(5) <=> 10 } diff --git a/progs/tests/auto/parenthesis.sy b/progs/tests/auto/parenthesis.sy index b456769..dd6fe8a 100644 --- a/progs/tests/auto/parenthesis.sy +++ b/progs/tests/auto/parenthesis.sy @@ -1,3 +1,3 @@ start :: fn { -(1 + 2) * 3 <=> 9 + (1 + 2) * 3 <=> 9 } diff --git a/progs/tests/auto/passing_functions.sy b/progs/tests/auto/passing_functions.sy index d1ff70e..e09a125 100644 --- a/progs/tests/auto/passing_functions.sy +++ b/progs/tests/auto/passing_functions.sy @@ -1,9 +1,9 @@ start :: fn { -g := fn -> int { - ret 1 - } - f := fn inner: fn -> int -> int { - ret inner() - } - f(g) <=> 1 + g := fn -> int { + ret 1 + } + f := fn inner: fn -> int -> int { + ret inner() + } + f(g) <=> 1 } diff --git a/progs/tests/auto/passing_functions_mixed.sy b/progs/tests/auto/passing_functions_mixed.sy index 292e7ce..b08128e 100644 --- a/progs/tests/auto/passing_functions_mixed.sy +++ b/progs/tests/auto/passing_functions_mixed.sy @@ -1,9 +1,9 @@ start :: fn { -g := fn a: int -> int { - ret a * 2 - } - f := fn inner: fn int -> int, a: int -> int { - ret inner(a) - } - f(g, 2) <=> 4 + g := fn a: int -> int { + ret a * 2 + } + f := fn inner: fn int -> int, a: int -> int { + ret inner(a) + } + f(g, 2) <=> 4 } diff --git a/progs/tests/auto/precedence.sy b/progs/tests/auto/precedence.sy index 0aee658..ae08e05 100644 --- a/progs/tests/auto/precedence.sy +++ b/progs/tests/auto/precedence.sy @@ -1,8 +1,8 @@ start :: fn { -f := fn a: int, b: int -> int { - ret a + b - } - 1 + f(2, 3) <=> 6 - 2 * f(2, 3) <=> 10 - f(2, 3) - (2 + 3) <=> 0 + f := fn a: int, b: int -> int { + ret a + b + } + 1 + f(2, 3) <=> 6 + 2 * f(2, 3) <=> 10 + f(2, 3) - (2 + 3) <=> 0 } diff --git a/progs/tests/auto/return_1.sy b/progs/tests/auto/return_1.sy index 993f9fd..533208f 100644 --- a/progs/tests/auto/return_1.sy +++ b/progs/tests/auto/return_1.sy @@ -1,6 +1,6 @@ start :: fn { -f := fn -> int { - ret 1 - } - f() <=> 1 + f := fn -> int { + ret 1 + } + f() <=> 1 } diff --git a/progs/tests/auto/returning_closures.sy b/progs/tests/auto/returning_closures.sy index 1c4c091..4d69d5a 100644 --- a/progs/tests/auto/returning_closures.sy +++ b/progs/tests/auto/returning_closures.sy @@ -1,24 +1,24 @@ start :: fn { -f : fn -> fn -> int = fn -> fn -> int { - x : int = 0 - f := fn -> int { - x = x + 1 - ret x + f : fn -> fn -> int = fn -> fn -> int { + x : int = 0 + f := fn -> int { + x = x + 1 + ret x + } + f() <=> 1 + ret f } - f() <=> 1 - ret f -} -a := f() -b := f() + a := f() + b := f() -a() <=> 2 -a() <=> 3 + a() <=> 2 + a() <=> 3 -b() <=> 2 -b() <=> 3 + b() <=> 2 + b() <=> 3 -a() <=> 4 + a() <=> 4 } diff --git a/progs/tests/auto/simple.sy b/progs/tests/auto/simple.sy index 436dcae..99bf586 100644 --- a/progs/tests/auto/simple.sy +++ b/progs/tests/auto/simple.sy @@ -1,10 +1,10 @@ start :: fn { -a :: 1 -a <=> 1 -b := 2 -{ + a :: 1 a <=> 1 - b <=> 2 -} + b := 2 + { + a <=> 1 + b <=> 2 + } } diff --git a/progs/tests/auto/simple_add.sy b/progs/tests/auto/simple_add.sy index f1952d3..7be4012 100644 --- a/progs/tests/auto/simple_add.sy +++ b/progs/tests/auto/simple_add.sy @@ -1,9 +1,9 @@ start :: fn { -a := 0 -b := 99999 -a += 1 -a <=> 1 -b <=> 99999 + a := 0 + b := 99999 + a += 1 + a <=> 1 + b <=> 99999 } diff --git a/progs/tests/auto/simple_break.sy b/progs/tests/auto/simple_break.sy index 11c06ad..6f2e5b6 100644 --- a/progs/tests/auto/simple_break.sy +++ b/progs/tests/auto/simple_break.sy @@ -1,12 +1,12 @@ start :: fn { -a := 0 -for i := 0, i < 10, i += 1 { - a = a + 1 - if i == 2 { - break + a := 0 + for i := 0, i < 10, i += 1 { + a = a + 1 + if i == 2 { + break + } } -} -a <=> 3 + a <=> 3 } diff --git a/progs/tests/auto/simple_continue.sy b/progs/tests/auto/simple_continue.sy index ac2bf81..3e26e6c 100644 --- a/progs/tests/auto/simple_continue.sy +++ b/progs/tests/auto/simple_continue.sy @@ -1,12 +1,12 @@ start :: fn { -a := 0 -for i := 0, i < 4, i += 1 { - if i == 2 { - continue + a := 0 + for i := 0, i < 4, i += 1 { + if i == 2 { + continue + } + a = a + 1 } - a = a + 1 -} -a <=> 3 + a <=> 3 } diff --git a/progs/tests/auto/simple_sub.sy b/progs/tests/auto/simple_sub.sy index 5dad340..c220b8f 100644 --- a/progs/tests/auto/simple_sub.sy +++ b/progs/tests/auto/simple_sub.sy @@ -1,9 +1,9 @@ start :: fn { -a := 0 -b := 99999 -a -= 1 -a <=> -1 -b <=> 99999 + a := 0 + b := 99999 + a -= 1 + a <=> -1 + b <=> 99999 } diff --git a/progs/tests/auto/simplest.sy b/progs/tests/auto/simplest.sy index 5669dc0..14a6534 100644 --- a/progs/tests/auto/simplest.sy +++ b/progs/tests/auto/simplest.sy @@ -1,4 +1,4 @@ start :: fn { -f := fn {} - f() + f := fn {} + f() } diff --git a/progs/tests/auto/single_variable.sy b/progs/tests/auto/single_variable.sy index 00217d2..ce4c2ad 100644 --- a/progs/tests/auto/single_variable.sy +++ b/progs/tests/auto/single_variable.sy @@ -1,4 +1,4 @@ start :: fn { -a := 1 - a <=> 1 + a := 1 + a <=> 1 } diff --git a/progs/tests/auto/stack_ordering.sy b/progs/tests/auto/stack_ordering.sy index 85a36bd..f13e5cf 100644 --- a/progs/tests/auto/stack_ordering.sy +++ b/progs/tests/auto/stack_ordering.sy @@ -1,6 +1,6 @@ start :: fn { -a := 1 - b := 2 - b <=> 2 - a <=> 1 + a := 1 + b := 2 + b <=> 2 + a <=> 1 } diff --git a/progs/tests/auto/strange.sy b/progs/tests/auto/strange.sy index c495041..b6aad0f 100644 --- a/progs/tests/auto/strange.sy +++ b/progs/tests/auto/strange.sy @@ -1,15 +1,15 @@ start :: fn { -a := 0 -{ - b := 99999 + a := 0 { - a := 99999 - a + b := 99999 + { + a := 99999 + a + } + b + a -= 1 } - b - a -= 1 -} -a <=> -1 + a <=> -1 } diff --git a/progs/tests/auto/sub.sy b/progs/tests/auto/sub.sy index 755ae67..e5d60f2 100644 --- a/progs/tests/auto/sub.sy +++ b/progs/tests/auto/sub.sy @@ -1,3 +1,3 @@ start :: fn { -(1, -2, 3, -4) - (4, 3, -2, -1) <=> (-3, 1, 1, -5) + (1, -2, 3, -4) - (4, 3, -2, -1) <=> (-3, 1, 1, -5) } diff --git a/progs/tests/auto/terms_and_factors.sy b/progs/tests/auto/terms_and_factors.sy index 1fef724..42a48e2 100644 --- a/progs/tests/auto/terms_and_factors.sy +++ b/progs/tests/auto/terms_and_factors.sy @@ -1,4 +1,4 @@ start :: fn { -1 + 1 * 2 <=> 3 - 1 * 2 + 3 <=> 5 + 1 + 1 * 2 <=> 3 + 1 * 2 + 3 <=> 5 } diff --git a/progs/tests/auto/three_arg.sy b/progs/tests/auto/three_arg.sy index d948fa0..56eb634 100644 --- a/progs/tests/auto/three_arg.sy +++ b/progs/tests/auto/three_arg.sy @@ -1,5 +1,5 @@ start :: fn { -f := fn a:int, b:int, c:int { c <=> 13 } - f! 1, 1 + 2, 1 + 4 * 3 + f := fn a:int, b:int, c:int { c <=> 13 } + f! 1, 1 + 2, 1 + 4 * 3 } diff --git a/progs/tests/auto/two_arg.sy b/progs/tests/auto/two_arg.sy index 60645b5..09ea1f7 100644 --- a/progs/tests/auto/two_arg.sy +++ b/progs/tests/auto/two_arg.sy @@ -1,5 +1,5 @@ start :: fn { -f := fn a:int, b:int { b <=> 3 } - f! 1, 1 + 2 + f := fn a:int, b:int { b <=> 3 } + f! 1, 1 + 2 } diff --git a/progs/tests/auto/two_variables.sy b/progs/tests/auto/two_variables.sy index 9ae183f..93329e3 100644 --- a/progs/tests/auto/two_variables.sy +++ b/progs/tests/auto/two_variables.sy @@ -1,6 +1,6 @@ start :: fn { -a := 1 - b := 2 - a <=> 1 - b <=> 2 + a := 1 + b := 2 + a <=> 1 + b <=> 2 } diff --git a/progs/tests/auto/types.sy b/progs/tests/auto/types.sy index c045b34..bdcdfa4 100644 --- a/progs/tests/auto/types.sy +++ b/progs/tests/auto/types.sy @@ -1,4 +1,4 @@ start :: fn { -a: (int, float, int) = (1, 1., 1) -a + a: (int, float, int) = (1, 1., 1) + a } diff --git a/progs/tests/auto/uncallable_type.sy b/progs/tests/auto/uncallable_type.sy index 06ff71a..dbe6e81 100644 --- a/progs/tests/auto/uncallable_type.sy +++ b/progs/tests/auto/uncallable_type.sy @@ -1,9 +1,8 @@ start :: fn { - - f := fn i: int { - i() - } - f + f := fn i: int { + i() + } + f } // errors: [ErrorKind::InvalidProgram] diff --git a/progs/tests/auto/wrong_params.sy b/progs/tests/auto/wrong_params.sy index 6b56e90..e49e89b 100644 --- a/progs/tests/auto/wrong_params.sy +++ b/progs/tests/auto/wrong_params.sy @@ -1,7 +1,7 @@ start :: fn { - f : fn -> int = fn a: int -> int {} -f + f : fn -> int = fn a: int -> int {} + f } // errors: [ErrorKind::TypeMismatch(_, _), ErrorKind::TypeMismatch(Type::Void, Type::Int)] diff --git a/progs/tests/auto/wrong_ret.sy b/progs/tests/auto/wrong_ret.sy index 81f2517..6c4a9a5 100644 --- a/progs/tests/auto/wrong_ret.sy +++ b/progs/tests/auto/wrong_ret.sy @@ -1,7 +1,7 @@ start :: fn { - f : fn -> int = fn {} -f + f : fn -> int = fn {} + f } // errors: [ErrorKind::TypeMismatch(_, _)] -- cgit v1.2.1 From 50d6472d56091d0fece3fb87837a3931215603e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Sun, 7 Mar 2021 17:47:31 +0100 Subject: move the tests --- progs/tests/add.sy | 3 +++ progs/tests/advanced_break.sy | 22 ++++++++++++++++++++++ progs/tests/advanced_continue.sy | 22 ++++++++++++++++++++++ progs/tests/assignment.sy | 7 +++++++ progs/tests/auto/add.sy | 3 --- progs/tests/auto/advanced_break.sy | 22 ---------------------- progs/tests/auto/advanced_continue.sy | 22 ---------------------- progs/tests/auto/assignment.sy | 7 ------- progs/tests/auto/blob_complex.sy | 19 ------------------- progs/tests/auto/blob_infer.sy | 8 -------- progs/tests/auto/blob_simple.sy | 10 ---------- progs/tests/auto/calls_inside_calls.sy | 11 ----------- progs/tests/auto/cluster.sy | 14 -------------- progs/tests/auto/compare_constants_equality.sy | 5 ----- progs/tests/auto/compare_constants_unequality.sy | 5 ----- progs/tests/auto/compare_variable.sy | 9 --------- progs/tests/auto/conflict_markers.sy | 11 ----------- progs/tests/auto/constant_function.sy | 4 ---- progs/tests/auto/constant_function_closure.sy | 13 ------------- progs/tests/auto/constant_function_complex.sy | 19 ------------------- progs/tests/auto/constants_in_inner_functions.sy | 20 -------------------- progs/tests/auto/div.sy | 5 ----- progs/tests/auto/else_.sy | 10 ---------- progs/tests/auto/else_if.sy | 12 ------------ progs/tests/auto/expressions.sy | 6 ------ progs/tests/auto/factorial.sy | 12 ------------ progs/tests/auto/field.sy | 3 --- progs/tests/auto/field_assign.sy | 5 ----- progs/tests/auto/field_get.sy | 7 ------- progs/tests/auto/in_rhs.sy | 3 --- progs/tests/auto/instantiate.sy | 5 ----- progs/tests/auto/invalid_assign.sy | 7 ------- progs/tests/auto/more_types.sy | 4 ---- progs/tests/auto/mul.sy | 3 --- progs/tests/auto/multiple_fields.sy | 11 ----------- progs/tests/auto/multiple_returns.sy | 12 ------------ progs/tests/auto/negation.sy | 7 ------- progs/tests/auto/not.sy | 5 ----- progs/tests/auto/one_arg.sy | 5 ----- progs/tests/auto/param_1.sy | 4 ---- progs/tests/auto/param_2.sy | 7 ------- progs/tests/auto/param_and_return.sy | 7 ------- progs/tests/auto/parenthesis.sy | 3 --- progs/tests/auto/passing_functions.sy | 9 --------- progs/tests/auto/passing_functions_mixed.sy | 9 --------- progs/tests/auto/precedence.sy | 8 -------- progs/tests/auto/return_1.sy | 6 ------ progs/tests/auto/returning_closures.sy | 24 ------------------------ progs/tests/auto/simple.sy | 10 ---------- progs/tests/auto/simple_add.sy | 9 --------- progs/tests/auto/simple_break.sy | 12 ------------ progs/tests/auto/simple_continue.sy | 12 ------------ progs/tests/auto/simple_sub.sy | 9 --------- progs/tests/auto/simplest.sy | 4 ---- progs/tests/auto/single_variable.sy | 4 ---- progs/tests/auto/stack_ordering.sy | 6 ------ progs/tests/auto/strange.sy | 15 --------------- progs/tests/auto/sub.sy | 3 --- progs/tests/auto/terms_and_factors.sy | 4 ---- progs/tests/auto/three_arg.sy | 5 ----- progs/tests/auto/two_arg.sy | 5 ----- progs/tests/auto/two_variables.sy | 6 ------ progs/tests/auto/types.sy | 4 ---- progs/tests/auto/uncallable_type.sy | 8 -------- progs/tests/auto/wrong_params.sy | 7 ------- progs/tests/auto/wrong_ret.sy | 7 ------- progs/tests/blob_complex.sy | 19 +++++++++++++++++++ progs/tests/blob_infer.sy | 8 ++++++++ progs/tests/blob_simple.sy | 10 ++++++++++ progs/tests/calls_inside_calls.sy | 11 +++++++++++ progs/tests/cluster.sy | 14 ++++++++++++++ progs/tests/compare_constants_equality.sy | 5 +++++ progs/tests/compare_constants_unequality.sy | 5 +++++ progs/tests/compare_variable.sy | 9 +++++++++ progs/tests/conflict_markers.sy | 11 +++++++++++ progs/tests/constant_function.sy | 4 ++++ progs/tests/constant_function_closure.sy | 13 +++++++++++++ progs/tests/constant_function_complex.sy | 19 +++++++++++++++++++ progs/tests/constants_in_inner_functions.sy | 20 ++++++++++++++++++++ progs/tests/div.sy | 5 +++++ progs/tests/else_.sy | 10 ++++++++++ progs/tests/else_if.sy | 12 ++++++++++++ progs/tests/expressions.sy | 6 ++++++ progs/tests/factorial.sy | 12 ++++++++++++ progs/tests/field.sy | 3 +++ progs/tests/field_assign.sy | 5 +++++ progs/tests/field_get.sy | 7 +++++++ progs/tests/in_rhs.sy | 3 +++ progs/tests/instantiate.sy | 5 +++++ progs/tests/invalid_assign.sy | 7 +++++++ progs/tests/more_types.sy | 4 ++++ progs/tests/mul.sy | 3 +++ progs/tests/multiple_fields.sy | 11 +++++++++++ progs/tests/multiple_returns.sy | 12 ++++++++++++ progs/tests/negation.sy | 7 +++++++ progs/tests/not.sy | 5 +++++ progs/tests/one_arg.sy | 5 +++++ progs/tests/param_1.sy | 4 ++++ progs/tests/param_2.sy | 7 +++++++ progs/tests/param_and_return.sy | 7 +++++++ progs/tests/parenthesis.sy | 3 +++ progs/tests/passing_functions.sy | 9 +++++++++ progs/tests/passing_functions_mixed.sy | 9 +++++++++ progs/tests/precedence.sy | 8 ++++++++ progs/tests/return_1.sy | 6 ++++++ progs/tests/returning_closures.sy | 24 ++++++++++++++++++++++++ progs/tests/simple.sy | 10 ++++++++++ progs/tests/simple_add.sy | 9 +++++++++ progs/tests/simple_break.sy | 12 ++++++++++++ progs/tests/simple_continue.sy | 12 ++++++++++++ progs/tests/simple_sub.sy | 9 +++++++++ progs/tests/simplest.sy | 4 ++++ progs/tests/single_variable.sy | 4 ++++ progs/tests/stack_ordering.sy | 6 ++++++ progs/tests/strange.sy | 15 +++++++++++++++ progs/tests/sub.sy | 3 +++ progs/tests/terms_and_factors.sy | 4 ++++ progs/tests/three_arg.sy | 5 +++++ progs/tests/two_arg.sy | 5 +++++ progs/tests/two_variables.sy | 6 ++++++ progs/tests/types.sy | 4 ++++ progs/tests/uncallable_type.sy | 8 ++++++++ progs/tests/wrong_params.sy | 7 +++++++ progs/tests/wrong_ret.sy | 7 +++++++ 124 files changed, 531 insertions(+), 531 deletions(-) create mode 100644 progs/tests/add.sy create mode 100644 progs/tests/advanced_break.sy create mode 100644 progs/tests/advanced_continue.sy create mode 100644 progs/tests/assignment.sy delete mode 100644 progs/tests/auto/add.sy delete mode 100644 progs/tests/auto/advanced_break.sy delete mode 100644 progs/tests/auto/advanced_continue.sy delete mode 100644 progs/tests/auto/assignment.sy delete mode 100644 progs/tests/auto/blob_complex.sy delete mode 100644 progs/tests/auto/blob_infer.sy delete mode 100644 progs/tests/auto/blob_simple.sy delete mode 100644 progs/tests/auto/calls_inside_calls.sy delete mode 100644 progs/tests/auto/cluster.sy delete mode 100644 progs/tests/auto/compare_constants_equality.sy delete mode 100644 progs/tests/auto/compare_constants_unequality.sy delete mode 100644 progs/tests/auto/compare_variable.sy delete mode 100644 progs/tests/auto/conflict_markers.sy delete mode 100644 progs/tests/auto/constant_function.sy delete mode 100644 progs/tests/auto/constant_function_closure.sy delete mode 100644 progs/tests/auto/constant_function_complex.sy delete mode 100644 progs/tests/auto/constants_in_inner_functions.sy delete mode 100644 progs/tests/auto/div.sy delete mode 100644 progs/tests/auto/else_.sy delete mode 100644 progs/tests/auto/else_if.sy delete mode 100644 progs/tests/auto/expressions.sy delete mode 100644 progs/tests/auto/factorial.sy delete mode 100644 progs/tests/auto/field.sy delete mode 100644 progs/tests/auto/field_assign.sy delete mode 100644 progs/tests/auto/field_get.sy delete mode 100644 progs/tests/auto/in_rhs.sy delete mode 100644 progs/tests/auto/instantiate.sy delete mode 100644 progs/tests/auto/invalid_assign.sy delete mode 100644 progs/tests/auto/more_types.sy delete mode 100644 progs/tests/auto/mul.sy delete mode 100644 progs/tests/auto/multiple_fields.sy delete mode 100644 progs/tests/auto/multiple_returns.sy delete mode 100644 progs/tests/auto/negation.sy delete mode 100644 progs/tests/auto/not.sy delete mode 100644 progs/tests/auto/one_arg.sy delete mode 100644 progs/tests/auto/param_1.sy delete mode 100644 progs/tests/auto/param_2.sy delete mode 100644 progs/tests/auto/param_and_return.sy delete mode 100644 progs/tests/auto/parenthesis.sy delete mode 100644 progs/tests/auto/passing_functions.sy delete mode 100644 progs/tests/auto/passing_functions_mixed.sy delete mode 100644 progs/tests/auto/precedence.sy delete mode 100644 progs/tests/auto/return_1.sy delete mode 100644 progs/tests/auto/returning_closures.sy delete mode 100644 progs/tests/auto/simple.sy delete mode 100644 progs/tests/auto/simple_add.sy delete mode 100644 progs/tests/auto/simple_break.sy delete mode 100644 progs/tests/auto/simple_continue.sy delete mode 100644 progs/tests/auto/simple_sub.sy delete mode 100644 progs/tests/auto/simplest.sy delete mode 100644 progs/tests/auto/single_variable.sy delete mode 100644 progs/tests/auto/stack_ordering.sy delete mode 100644 progs/tests/auto/strange.sy delete mode 100644 progs/tests/auto/sub.sy delete mode 100644 progs/tests/auto/terms_and_factors.sy delete mode 100644 progs/tests/auto/three_arg.sy delete mode 100644 progs/tests/auto/two_arg.sy delete mode 100644 progs/tests/auto/two_variables.sy delete mode 100644 progs/tests/auto/types.sy delete mode 100644 progs/tests/auto/uncallable_type.sy delete mode 100644 progs/tests/auto/wrong_params.sy delete mode 100644 progs/tests/auto/wrong_ret.sy create mode 100644 progs/tests/blob_complex.sy create mode 100644 progs/tests/blob_infer.sy create mode 100644 progs/tests/blob_simple.sy create mode 100644 progs/tests/calls_inside_calls.sy create mode 100644 progs/tests/cluster.sy create mode 100644 progs/tests/compare_constants_equality.sy create mode 100644 progs/tests/compare_constants_unequality.sy create mode 100644 progs/tests/compare_variable.sy create mode 100644 progs/tests/conflict_markers.sy create mode 100644 progs/tests/constant_function.sy create mode 100644 progs/tests/constant_function_closure.sy create mode 100644 progs/tests/constant_function_complex.sy create mode 100644 progs/tests/constants_in_inner_functions.sy create mode 100644 progs/tests/div.sy create mode 100644 progs/tests/else_.sy create mode 100644 progs/tests/else_if.sy create mode 100644 progs/tests/expressions.sy create mode 100644 progs/tests/factorial.sy create mode 100644 progs/tests/field.sy create mode 100644 progs/tests/field_assign.sy create mode 100644 progs/tests/field_get.sy create mode 100644 progs/tests/in_rhs.sy create mode 100644 progs/tests/instantiate.sy create mode 100644 progs/tests/invalid_assign.sy create mode 100644 progs/tests/more_types.sy create mode 100644 progs/tests/mul.sy create mode 100644 progs/tests/multiple_fields.sy create mode 100644 progs/tests/multiple_returns.sy create mode 100644 progs/tests/negation.sy create mode 100644 progs/tests/not.sy create mode 100644 progs/tests/one_arg.sy create mode 100644 progs/tests/param_1.sy create mode 100644 progs/tests/param_2.sy create mode 100644 progs/tests/param_and_return.sy create mode 100644 progs/tests/parenthesis.sy create mode 100644 progs/tests/passing_functions.sy create mode 100644 progs/tests/passing_functions_mixed.sy create mode 100644 progs/tests/precedence.sy create mode 100644 progs/tests/return_1.sy create mode 100644 progs/tests/returning_closures.sy create mode 100644 progs/tests/simple.sy create mode 100644 progs/tests/simple_add.sy create mode 100644 progs/tests/simple_break.sy create mode 100644 progs/tests/simple_continue.sy create mode 100644 progs/tests/simple_sub.sy create mode 100644 progs/tests/simplest.sy create mode 100644 progs/tests/single_variable.sy create mode 100644 progs/tests/stack_ordering.sy create mode 100644 progs/tests/strange.sy create mode 100644 progs/tests/sub.sy create mode 100644 progs/tests/terms_and_factors.sy create mode 100644 progs/tests/three_arg.sy create mode 100644 progs/tests/two_arg.sy create mode 100644 progs/tests/two_variables.sy create mode 100644 progs/tests/types.sy create mode 100644 progs/tests/uncallable_type.sy create mode 100644 progs/tests/wrong_params.sy create mode 100644 progs/tests/wrong_ret.sy diff --git a/progs/tests/add.sy b/progs/tests/add.sy new file mode 100644 index 0000000..3fadd86 --- /dev/null +++ b/progs/tests/add.sy @@ -0,0 +1,3 @@ +start :: fn { + (1, 2, 3, 4) + (4, 3, 2, 1) <=> (5, 5, 5, 5) +} diff --git a/progs/tests/advanced_break.sy b/progs/tests/advanced_break.sy new file mode 100644 index 0000000..591dffd --- /dev/null +++ b/progs/tests/advanced_break.sy @@ -0,0 +1,22 @@ +start :: fn { + + a := 0 + for i := 0, i < 10, i += 1 { + q := 0 + qq := 0 + qqq := 0 + qqqq := 0 + + a = a + 1 + if i == 2 { + break + } + + q + qq + qqq + qqqq + } + a <=> 3 + +} diff --git a/progs/tests/advanced_continue.sy b/progs/tests/advanced_continue.sy new file mode 100644 index 0000000..1a3bb00 --- /dev/null +++ b/progs/tests/advanced_continue.sy @@ -0,0 +1,22 @@ +start :: fn { + + a := 0 + for i := 0, i < 4, i += 1 { + q := 0 + qq := 0 + qqq := 0 + qqqq := 0 + + if i == 2 { + continue + } + a = a + 1 + + q + qq + qqq + qqqq + } + a <=> 3 + +} diff --git a/progs/tests/assignment.sy b/progs/tests/assignment.sy new file mode 100644 index 0000000..5ab9f6b --- /dev/null +++ b/progs/tests/assignment.sy @@ -0,0 +1,7 @@ +start :: fn { + a := 1 + b := 2 + a = b + a <=> 2 + b <=> 2 +} diff --git a/progs/tests/auto/add.sy b/progs/tests/auto/add.sy deleted file mode 100644 index 3fadd86..0000000 --- a/progs/tests/auto/add.sy +++ /dev/null @@ -1,3 +0,0 @@ -start :: fn { - (1, 2, 3, 4) + (4, 3, 2, 1) <=> (5, 5, 5, 5) -} diff --git a/progs/tests/auto/advanced_break.sy b/progs/tests/auto/advanced_break.sy deleted file mode 100644 index 591dffd..0000000 --- a/progs/tests/auto/advanced_break.sy +++ /dev/null @@ -1,22 +0,0 @@ -start :: fn { - - a := 0 - for i := 0, i < 10, i += 1 { - q := 0 - qq := 0 - qqq := 0 - qqqq := 0 - - a = a + 1 - if i == 2 { - break - } - - q - qq - qqq - qqqq - } - a <=> 3 - -} diff --git a/progs/tests/auto/advanced_continue.sy b/progs/tests/auto/advanced_continue.sy deleted file mode 100644 index 1a3bb00..0000000 --- a/progs/tests/auto/advanced_continue.sy +++ /dev/null @@ -1,22 +0,0 @@ -start :: fn { - - a := 0 - for i := 0, i < 4, i += 1 { - q := 0 - qq := 0 - qqq := 0 - qqqq := 0 - - if i == 2 { - continue - } - a = a + 1 - - q - qq - qqq - qqqq - } - a <=> 3 - -} diff --git a/progs/tests/auto/assignment.sy b/progs/tests/auto/assignment.sy deleted file mode 100644 index 5ab9f6b..0000000 --- a/progs/tests/auto/assignment.sy +++ /dev/null @@ -1,7 +0,0 @@ -start :: fn { - a := 1 - b := 2 - a = b - a <=> 2 - b <=> 2 -} diff --git a/progs/tests/auto/blob_complex.sy b/progs/tests/auto/blob_complex.sy deleted file mode 100644 index b139a3a..0000000 --- a/progs/tests/auto/blob_complex.sy +++ /dev/null @@ -1,19 +0,0 @@ -start :: fn { - - a := A() - b := B() - c := C() - b2 := B() - - a - b - c - b2 - - blob A { - c: C - } - blob C { } - blob B { } - -} diff --git a/progs/tests/auto/blob_infer.sy b/progs/tests/auto/blob_infer.sy deleted file mode 100644 index 0a1ce1b..0000000 --- a/progs/tests/auto/blob_infer.sy +++ /dev/null @@ -1,8 +0,0 @@ -start :: fn { - - blob A { } - - a : A = A() - a - -} diff --git a/progs/tests/auto/blob_simple.sy b/progs/tests/auto/blob_simple.sy deleted file mode 100644 index ea832cd..0000000 --- a/progs/tests/auto/blob_simple.sy +++ /dev/null @@ -1,10 +0,0 @@ -start :: fn { - - a := A() - a - - blob A { - a: int - } - -} diff --git a/progs/tests/auto/calls_inside_calls.sy b/progs/tests/auto/calls_inside_calls.sy deleted file mode 100644 index 5f6716b..0000000 --- a/progs/tests/auto/calls_inside_calls.sy +++ /dev/null @@ -1,11 +0,0 @@ -start :: fn { - one := fn -> int { - ret 1 - } - add := fn a: int, b: int -> int { - ret a + b - } - add(one(), one()) <=> 2 - add(add(one(), one()), one()) <=> 3 - add(one(), add(one(), one())) <=> 3 -} diff --git a/progs/tests/auto/cluster.sy b/progs/tests/auto/cluster.sy deleted file mode 100644 index dc8ec72..0000000 --- a/progs/tests/auto/cluster.sy +++ /dev/null @@ -1,14 +0,0 @@ -start :: fn { - - blob A { a: int } - a := A() - a.a = 0 - a.a += 1 - a.a <=> 1 - a.a *= 2 - a.a <=> 2 - a.a /= 2 - a.a <=> 1 - a.a -= 1 - a.a <=> 0 -} diff --git a/progs/tests/auto/compare_constants_equality.sy b/progs/tests/auto/compare_constants_equality.sy deleted file mode 100644 index e8f64ed..0000000 --- a/progs/tests/auto/compare_constants_equality.sy +++ /dev/null @@ -1,5 +0,0 @@ -start :: fn { - if 1 == 2 { - - } -} diff --git a/progs/tests/auto/compare_constants_unequality.sy b/progs/tests/auto/compare_constants_unequality.sy deleted file mode 100644 index 21094da..0000000 --- a/progs/tests/auto/compare_constants_unequality.sy +++ /dev/null @@ -1,5 +0,0 @@ -start :: fn { - if 1 != 1 { - - } -} diff --git a/progs/tests/auto/compare_variable.sy b/progs/tests/auto/compare_variable.sy deleted file mode 100644 index 80fb4a4..0000000 --- a/progs/tests/auto/compare_variable.sy +++ /dev/null @@ -1,9 +0,0 @@ -start :: fn { - a := 1 - if a == 0 { - - } - if a != 1 { - - } -} diff --git a/progs/tests/auto/conflict_markers.sy b/progs/tests/auto/conflict_markers.sy deleted file mode 100644 index 0760582..0000000 --- a/progs/tests/auto/conflict_markers.sy +++ /dev/null @@ -1,11 +0,0 @@ -start :: fn { - -<<<<<<< HEAD - print extern_test(4.0) -======= - print extern_test(5.0) ->>>>>>> 2 - -} - -// errors: [ErrorKind::SyntaxError(_, _), ErrorKind::GitConflictError(3, 7)] diff --git a/progs/tests/auto/constant_function.sy b/progs/tests/auto/constant_function.sy deleted file mode 100644 index 22ddfe2..0000000 --- a/progs/tests/auto/constant_function.sy +++ /dev/null @@ -1,4 +0,0 @@ -a :: fn {} -start :: fn { - a() -} diff --git a/progs/tests/auto/constant_function_closure.sy b/progs/tests/auto/constant_function_closure.sy deleted file mode 100644 index 6c7f0d7..0000000 --- a/progs/tests/auto/constant_function_closure.sy +++ /dev/null @@ -1,13 +0,0 @@ -q : int = 1 - -f :: fn -> int { - q += 1 - ret q -} - -start :: fn { - f() <=> 2 - f() <=> 3 - f() <=> 4 - f() <=> 5 -} diff --git a/progs/tests/auto/constant_function_complex.sy b/progs/tests/auto/constant_function_complex.sy deleted file mode 100644 index 6a60ebe..0000000 --- a/progs/tests/auto/constant_function_complex.sy +++ /dev/null @@ -1,19 +0,0 @@ -h :: fn -> int { - ret 3 -} - -k :: fn -> int { - ret h() -} - -a :: fn -> int { - ret q() -} - -q :: fn -> int { - ret k() -} - -start :: fn { - a() <=> 3 -} diff --git a/progs/tests/auto/constants_in_inner_functions.sy b/progs/tests/auto/constants_in_inner_functions.sy deleted file mode 100644 index 99704e7..0000000 --- a/progs/tests/auto/constants_in_inner_functions.sy +++ /dev/null @@ -1,20 +0,0 @@ -start :: fn { - - q : int = 0 - - f :: fn -> fn -> { - g :: fn { - q += 1 - } - ret g - } - - g := f() - g() - q <=> 1 - g() - q <=> 2 - g() - q <=> 3 - -} diff --git a/progs/tests/auto/div.sy b/progs/tests/auto/div.sy deleted file mode 100644 index df3e7bb..0000000 --- a/progs/tests/auto/div.sy +++ /dev/null @@ -1,5 +0,0 @@ -start :: fn { - a := 2 - a /= 2 - a <=> 1 -} diff --git a/progs/tests/auto/else_.sy b/progs/tests/auto/else_.sy deleted file mode 100644 index 0f1d624..0000000 --- a/progs/tests/auto/else_.sy +++ /dev/null @@ -1,10 +0,0 @@ -start :: fn { - a := 1 - res := 0 - if a == 0 { - - } else { - res = 1 - } - res <=> 1 -} diff --git a/progs/tests/auto/else_if.sy b/progs/tests/auto/else_if.sy deleted file mode 100644 index f31453e..0000000 --- a/progs/tests/auto/else_if.sy +++ /dev/null @@ -1,12 +0,0 @@ -start :: fn { - a := 1 - res := 0 - if a == 0 { - - } else if a == 1 { - res = 1 - } else { - - } - res <=> 1 -} diff --git a/progs/tests/auto/expressions.sy b/progs/tests/auto/expressions.sy deleted file mode 100644 index 99569e4..0000000 --- a/progs/tests/auto/expressions.sy +++ /dev/null @@ -1,6 +0,0 @@ -start :: fn { - 1 + 1 // blargh - 2 // blargh - // HARGH - -} diff --git a/progs/tests/auto/factorial.sy b/progs/tests/auto/factorial.sy deleted file mode 100644 index 770bc33..0000000 --- a/progs/tests/auto/factorial.sy +++ /dev/null @@ -1,12 +0,0 @@ -factorial :: fn n: int -> int { - if n <= 1 { - ret 1 - } - ret n * factorial(n - 1) -} - -start :: fn { - factorial(5) <=> 120 - factorial(6) <=> 720 - factorial(12) <=> 479001600 -} diff --git a/progs/tests/auto/field.sy b/progs/tests/auto/field.sy deleted file mode 100644 index b11e51e..0000000 --- a/progs/tests/auto/field.sy +++ /dev/null @@ -1,3 +0,0 @@ -start :: fn { - blob A { a: int } -} diff --git a/progs/tests/auto/field_assign.sy b/progs/tests/auto/field_assign.sy deleted file mode 100644 index 4fb6dd4..0000000 --- a/progs/tests/auto/field_assign.sy +++ /dev/null @@ -1,5 +0,0 @@ -start :: fn { - blob A { a: int } - a := A() - a.a = 2 -} diff --git a/progs/tests/auto/field_get.sy b/progs/tests/auto/field_get.sy deleted file mode 100644 index 49bb0f2..0000000 --- a/progs/tests/auto/field_get.sy +++ /dev/null @@ -1,7 +0,0 @@ -start :: fn { - blob A { a: int } - a := A() - a.a = 2 - a.a <=> 2 - 2 <=> a.a -} diff --git a/progs/tests/auto/in_rhs.sy b/progs/tests/auto/in_rhs.sy deleted file mode 100644 index 28ed276..0000000 --- a/progs/tests/auto/in_rhs.sy +++ /dev/null @@ -1,3 +0,0 @@ -start :: fn { - 5 <=> 1 * 2 + 3 -} diff --git a/progs/tests/auto/instantiate.sy b/progs/tests/auto/instantiate.sy deleted file mode 100644 index bb2f09c..0000000 --- a/progs/tests/auto/instantiate.sy +++ /dev/null @@ -1,5 +0,0 @@ -start :: fn { - blob A {} - a := A() - a -} diff --git a/progs/tests/auto/invalid_assign.sy b/progs/tests/auto/invalid_assign.sy deleted file mode 100644 index 8ee47ab..0000000 --- a/progs/tests/auto/invalid_assign.sy +++ /dev/null @@ -1,7 +0,0 @@ -start :: fn { - a := 1 - a = 0.1 - a -} - -// errors: [ErrorKind::TypeMismatch(Type::Int, Type::Float)] diff --git a/progs/tests/auto/more_types.sy b/progs/tests/auto/more_types.sy deleted file mode 100644 index c85403a..0000000 --- a/progs/tests/auto/more_types.sy +++ /dev/null @@ -1,4 +0,0 @@ -start :: fn { - a: (str, bool, int) = ("abc", true, 1) - a -} diff --git a/progs/tests/auto/mul.sy b/progs/tests/auto/mul.sy deleted file mode 100644 index 4b33314..0000000 --- a/progs/tests/auto/mul.sy +++ /dev/null @@ -1,3 +0,0 @@ -start :: fn { - (0, 1, 2) * (2, 3, 4) <=> (0, 3, 8) -} diff --git a/progs/tests/auto/multiple_fields.sy b/progs/tests/auto/multiple_fields.sy deleted file mode 100644 index ce4c61f..0000000 --- a/progs/tests/auto/multiple_fields.sy +++ /dev/null @@ -1,11 +0,0 @@ -start :: fn { - blob A { - a: int - b: int - } - a := A() - a.a = 2 - a.b = 3 - a.a + a.b <=> 5 - 5 <=> a.a + a.b -} diff --git a/progs/tests/auto/multiple_returns.sy b/progs/tests/auto/multiple_returns.sy deleted file mode 100644 index 6cb5e1a..0000000 --- a/progs/tests/auto/multiple_returns.sy +++ /dev/null @@ -1,12 +0,0 @@ -start :: fn { - f := fn a: int -> int { - if a == 1 { - ret 2 - } else { - ret 3 - } - } - f(0) <=> 3 - f(1) <=> 2 - f(2) <=> 3 -} diff --git a/progs/tests/auto/negation.sy b/progs/tests/auto/negation.sy deleted file mode 100644 index 0c702aa..0000000 --- a/progs/tests/auto/negation.sy +++ /dev/null @@ -1,7 +0,0 @@ -start :: fn { - -1 <=> 0 - 1 - -1 + 2 <=> 1 - -(1 + 2) <=> -3 - 1 + -1 <=> 0 - 2 * -1 <=> -2 -} diff --git a/progs/tests/auto/not.sy b/progs/tests/auto/not.sy deleted file mode 100644 index 02dd81d..0000000 --- a/progs/tests/auto/not.sy +++ /dev/null @@ -1,5 +0,0 @@ -start :: fn { - f := fn {} - f! - -} diff --git a/progs/tests/auto/one_arg.sy b/progs/tests/auto/one_arg.sy deleted file mode 100644 index e7dee83..0000000 --- a/progs/tests/auto/one_arg.sy +++ /dev/null @@ -1,5 +0,0 @@ -start :: fn { - f := fn a:int { a <=> 1 } - f! 1 - -} diff --git a/progs/tests/auto/param_1.sy b/progs/tests/auto/param_1.sy deleted file mode 100644 index c96089e..0000000 --- a/progs/tests/auto/param_1.sy +++ /dev/null @@ -1,4 +0,0 @@ -start :: fn { - f := fn a: int {} - f(1) -} diff --git a/progs/tests/auto/param_2.sy b/progs/tests/auto/param_2.sy deleted file mode 100644 index 1915c42..0000000 --- a/progs/tests/auto/param_2.sy +++ /dev/null @@ -1,7 +0,0 @@ -start :: fn { - add := fn a: int, b: int -> int { - ret a + b - } - add(1, 1) <=> 2 - add(10, 20) <=> 30 -} diff --git a/progs/tests/auto/param_and_return.sy b/progs/tests/auto/param_and_return.sy deleted file mode 100644 index 2752fcc..0000000 --- a/progs/tests/auto/param_and_return.sy +++ /dev/null @@ -1,7 +0,0 @@ -start :: fn { - f := fn a: int -> int { - ret a * 2 - } - f(1) <=> 2 - f(5) <=> 10 -} diff --git a/progs/tests/auto/parenthesis.sy b/progs/tests/auto/parenthesis.sy deleted file mode 100644 index dd6fe8a..0000000 --- a/progs/tests/auto/parenthesis.sy +++ /dev/null @@ -1,3 +0,0 @@ -start :: fn { - (1 + 2) * 3 <=> 9 -} diff --git a/progs/tests/auto/passing_functions.sy b/progs/tests/auto/passing_functions.sy deleted file mode 100644 index e09a125..0000000 --- a/progs/tests/auto/passing_functions.sy +++ /dev/null @@ -1,9 +0,0 @@ -start :: fn { - g := fn -> int { - ret 1 - } - f := fn inner: fn -> int -> int { - ret inner() - } - f(g) <=> 1 -} diff --git a/progs/tests/auto/passing_functions_mixed.sy b/progs/tests/auto/passing_functions_mixed.sy deleted file mode 100644 index b08128e..0000000 --- a/progs/tests/auto/passing_functions_mixed.sy +++ /dev/null @@ -1,9 +0,0 @@ -start :: fn { - g := fn a: int -> int { - ret a * 2 - } - f := fn inner: fn int -> int, a: int -> int { - ret inner(a) - } - f(g, 2) <=> 4 -} diff --git a/progs/tests/auto/precedence.sy b/progs/tests/auto/precedence.sy deleted file mode 100644 index ae08e05..0000000 --- a/progs/tests/auto/precedence.sy +++ /dev/null @@ -1,8 +0,0 @@ -start :: fn { - f := fn a: int, b: int -> int { - ret a + b - } - 1 + f(2, 3) <=> 6 - 2 * f(2, 3) <=> 10 - f(2, 3) - (2 + 3) <=> 0 -} diff --git a/progs/tests/auto/return_1.sy b/progs/tests/auto/return_1.sy deleted file mode 100644 index 533208f..0000000 --- a/progs/tests/auto/return_1.sy +++ /dev/null @@ -1,6 +0,0 @@ -start :: fn { - f := fn -> int { - ret 1 - } - f() <=> 1 -} diff --git a/progs/tests/auto/returning_closures.sy b/progs/tests/auto/returning_closures.sy deleted file mode 100644 index 4d69d5a..0000000 --- a/progs/tests/auto/returning_closures.sy +++ /dev/null @@ -1,24 +0,0 @@ -start :: fn { - - f : fn -> fn -> int = fn -> fn -> int { - x : int = 0 - f := fn -> int { - x = x + 1 - ret x - } - f() <=> 1 - ret f - } - - a := f() - b := f() - - a() <=> 2 - a() <=> 3 - - b() <=> 2 - b() <=> 3 - - a() <=> 4 - -} diff --git a/progs/tests/auto/simple.sy b/progs/tests/auto/simple.sy deleted file mode 100644 index 99bf586..0000000 --- a/progs/tests/auto/simple.sy +++ /dev/null @@ -1,10 +0,0 @@ -start :: fn { - - a :: 1 - a <=> 1 - b := 2 - { - a <=> 1 - b <=> 2 - } -} diff --git a/progs/tests/auto/simple_add.sy b/progs/tests/auto/simple_add.sy deleted file mode 100644 index 7be4012..0000000 --- a/progs/tests/auto/simple_add.sy +++ /dev/null @@ -1,9 +0,0 @@ -start :: fn { - - a := 0 - b := 99999 - a += 1 - a <=> 1 - b <=> 99999 - -} diff --git a/progs/tests/auto/simple_break.sy b/progs/tests/auto/simple_break.sy deleted file mode 100644 index 6f2e5b6..0000000 --- a/progs/tests/auto/simple_break.sy +++ /dev/null @@ -1,12 +0,0 @@ -start :: fn { - - a := 0 - for i := 0, i < 10, i += 1 { - a = a + 1 - if i == 2 { - break - } - } - a <=> 3 - -} diff --git a/progs/tests/auto/simple_continue.sy b/progs/tests/auto/simple_continue.sy deleted file mode 100644 index 3e26e6c..0000000 --- a/progs/tests/auto/simple_continue.sy +++ /dev/null @@ -1,12 +0,0 @@ -start :: fn { - - a := 0 - for i := 0, i < 4, i += 1 { - if i == 2 { - continue - } - a = a + 1 - } - a <=> 3 - -} diff --git a/progs/tests/auto/simple_sub.sy b/progs/tests/auto/simple_sub.sy deleted file mode 100644 index c220b8f..0000000 --- a/progs/tests/auto/simple_sub.sy +++ /dev/null @@ -1,9 +0,0 @@ -start :: fn { - - a := 0 - b := 99999 - a -= 1 - a <=> -1 - b <=> 99999 - -} diff --git a/progs/tests/auto/simplest.sy b/progs/tests/auto/simplest.sy deleted file mode 100644 index 14a6534..0000000 --- a/progs/tests/auto/simplest.sy +++ /dev/null @@ -1,4 +0,0 @@ -start :: fn { - f := fn {} - f() -} diff --git a/progs/tests/auto/single_variable.sy b/progs/tests/auto/single_variable.sy deleted file mode 100644 index ce4c2ad..0000000 --- a/progs/tests/auto/single_variable.sy +++ /dev/null @@ -1,4 +0,0 @@ -start :: fn { - a := 1 - a <=> 1 -} diff --git a/progs/tests/auto/stack_ordering.sy b/progs/tests/auto/stack_ordering.sy deleted file mode 100644 index f13e5cf..0000000 --- a/progs/tests/auto/stack_ordering.sy +++ /dev/null @@ -1,6 +0,0 @@ -start :: fn { - a := 1 - b := 2 - b <=> 2 - a <=> 1 -} diff --git a/progs/tests/auto/strange.sy b/progs/tests/auto/strange.sy deleted file mode 100644 index b6aad0f..0000000 --- a/progs/tests/auto/strange.sy +++ /dev/null @@ -1,15 +0,0 @@ -start :: fn { - - a := 0 - { - b := 99999 - { - a := 99999 - a - } - b - a -= 1 - } - a <=> -1 - -} diff --git a/progs/tests/auto/sub.sy b/progs/tests/auto/sub.sy deleted file mode 100644 index e5d60f2..0000000 --- a/progs/tests/auto/sub.sy +++ /dev/null @@ -1,3 +0,0 @@ -start :: fn { - (1, -2, 3, -4) - (4, 3, -2, -1) <=> (-3, 1, 1, -5) -} diff --git a/progs/tests/auto/terms_and_factors.sy b/progs/tests/auto/terms_and_factors.sy deleted file mode 100644 index 42a48e2..0000000 --- a/progs/tests/auto/terms_and_factors.sy +++ /dev/null @@ -1,4 +0,0 @@ -start :: fn { - 1 + 1 * 2 <=> 3 - 1 * 2 + 3 <=> 5 -} diff --git a/progs/tests/auto/three_arg.sy b/progs/tests/auto/three_arg.sy deleted file mode 100644 index 56eb634..0000000 --- a/progs/tests/auto/three_arg.sy +++ /dev/null @@ -1,5 +0,0 @@ -start :: fn { - f := fn a:int, b:int, c:int { c <=> 13 } - f! 1, 1 + 2, 1 + 4 * 3 - -} diff --git a/progs/tests/auto/two_arg.sy b/progs/tests/auto/two_arg.sy deleted file mode 100644 index 09ea1f7..0000000 --- a/progs/tests/auto/two_arg.sy +++ /dev/null @@ -1,5 +0,0 @@ -start :: fn { - f := fn a:int, b:int { b <=> 3 } - f! 1, 1 + 2 - -} diff --git a/progs/tests/auto/two_variables.sy b/progs/tests/auto/two_variables.sy deleted file mode 100644 index 93329e3..0000000 --- a/progs/tests/auto/two_variables.sy +++ /dev/null @@ -1,6 +0,0 @@ -start :: fn { - a := 1 - b := 2 - a <=> 1 - b <=> 2 -} diff --git a/progs/tests/auto/types.sy b/progs/tests/auto/types.sy deleted file mode 100644 index bdcdfa4..0000000 --- a/progs/tests/auto/types.sy +++ /dev/null @@ -1,4 +0,0 @@ -start :: fn { - a: (int, float, int) = (1, 1., 1) - a -} diff --git a/progs/tests/auto/uncallable_type.sy b/progs/tests/auto/uncallable_type.sy deleted file mode 100644 index dbe6e81..0000000 --- a/progs/tests/auto/uncallable_type.sy +++ /dev/null @@ -1,8 +0,0 @@ -start :: fn { - f := fn i: int { - i() - } - f -} - -// errors: [ErrorKind::InvalidProgram] diff --git a/progs/tests/auto/wrong_params.sy b/progs/tests/auto/wrong_params.sy deleted file mode 100644 index e49e89b..0000000 --- a/progs/tests/auto/wrong_params.sy +++ /dev/null @@ -1,7 +0,0 @@ -start :: fn { - - f : fn -> int = fn a: int -> int {} - f -} - -// errors: [ErrorKind::TypeMismatch(_, _), ErrorKind::TypeMismatch(Type::Void, Type::Int)] diff --git a/progs/tests/auto/wrong_ret.sy b/progs/tests/auto/wrong_ret.sy deleted file mode 100644 index 6c4a9a5..0000000 --- a/progs/tests/auto/wrong_ret.sy +++ /dev/null @@ -1,7 +0,0 @@ -start :: fn { - - f : fn -> int = fn {} - f -} - -// errors: [ErrorKind::TypeMismatch(_, _)] diff --git a/progs/tests/blob_complex.sy b/progs/tests/blob_complex.sy new file mode 100644 index 0000000..b139a3a --- /dev/null +++ b/progs/tests/blob_complex.sy @@ -0,0 +1,19 @@ +start :: fn { + + a := A() + b := B() + c := C() + b2 := B() + + a + b + c + b2 + + blob A { + c: C + } + blob C { } + blob B { } + +} diff --git a/progs/tests/blob_infer.sy b/progs/tests/blob_infer.sy new file mode 100644 index 0000000..0a1ce1b --- /dev/null +++ b/progs/tests/blob_infer.sy @@ -0,0 +1,8 @@ +start :: fn { + + blob A { } + + a : A = A() + a + +} diff --git a/progs/tests/blob_simple.sy b/progs/tests/blob_simple.sy new file mode 100644 index 0000000..ea832cd --- /dev/null +++ b/progs/tests/blob_simple.sy @@ -0,0 +1,10 @@ +start :: fn { + + a := A() + a + + blob A { + a: int + } + +} diff --git a/progs/tests/calls_inside_calls.sy b/progs/tests/calls_inside_calls.sy new file mode 100644 index 0000000..5f6716b --- /dev/null +++ b/progs/tests/calls_inside_calls.sy @@ -0,0 +1,11 @@ +start :: fn { + one := fn -> int { + ret 1 + } + add := fn a: int, b: int -> int { + ret a + b + } + add(one(), one()) <=> 2 + add(add(one(), one()), one()) <=> 3 + add(one(), add(one(), one())) <=> 3 +} diff --git a/progs/tests/cluster.sy b/progs/tests/cluster.sy new file mode 100644 index 0000000..dc8ec72 --- /dev/null +++ b/progs/tests/cluster.sy @@ -0,0 +1,14 @@ +start :: fn { + + blob A { a: int } + a := A() + a.a = 0 + a.a += 1 + a.a <=> 1 + a.a *= 2 + a.a <=> 2 + a.a /= 2 + a.a <=> 1 + a.a -= 1 + a.a <=> 0 +} diff --git a/progs/tests/compare_constants_equality.sy b/progs/tests/compare_constants_equality.sy new file mode 100644 index 0000000..e8f64ed --- /dev/null +++ b/progs/tests/compare_constants_equality.sy @@ -0,0 +1,5 @@ +start :: fn { + if 1 == 2 { + + } +} diff --git a/progs/tests/compare_constants_unequality.sy b/progs/tests/compare_constants_unequality.sy new file mode 100644 index 0000000..21094da --- /dev/null +++ b/progs/tests/compare_constants_unequality.sy @@ -0,0 +1,5 @@ +start :: fn { + if 1 != 1 { + + } +} diff --git a/progs/tests/compare_variable.sy b/progs/tests/compare_variable.sy new file mode 100644 index 0000000..80fb4a4 --- /dev/null +++ b/progs/tests/compare_variable.sy @@ -0,0 +1,9 @@ +start :: fn { + a := 1 + if a == 0 { + + } + if a != 1 { + + } +} diff --git a/progs/tests/conflict_markers.sy b/progs/tests/conflict_markers.sy new file mode 100644 index 0000000..0760582 --- /dev/null +++ b/progs/tests/conflict_markers.sy @@ -0,0 +1,11 @@ +start :: fn { + +<<<<<<< HEAD + print extern_test(4.0) +======= + print extern_test(5.0) +>>>>>>> 2 + +} + +// errors: [ErrorKind::SyntaxError(_, _), ErrorKind::GitConflictError(3, 7)] diff --git a/progs/tests/constant_function.sy b/progs/tests/constant_function.sy new file mode 100644 index 0000000..22ddfe2 --- /dev/null +++ b/progs/tests/constant_function.sy @@ -0,0 +1,4 @@ +a :: fn {} +start :: fn { + a() +} diff --git a/progs/tests/constant_function_closure.sy b/progs/tests/constant_function_closure.sy new file mode 100644 index 0000000..6c7f0d7 --- /dev/null +++ b/progs/tests/constant_function_closure.sy @@ -0,0 +1,13 @@ +q : int = 1 + +f :: fn -> int { + q += 1 + ret q +} + +start :: fn { + f() <=> 2 + f() <=> 3 + f() <=> 4 + f() <=> 5 +} diff --git a/progs/tests/constant_function_complex.sy b/progs/tests/constant_function_complex.sy new file mode 100644 index 0000000..6a60ebe --- /dev/null +++ b/progs/tests/constant_function_complex.sy @@ -0,0 +1,19 @@ +h :: fn -> int { + ret 3 +} + +k :: fn -> int { + ret h() +} + +a :: fn -> int { + ret q() +} + +q :: fn -> int { + ret k() +} + +start :: fn { + a() <=> 3 +} diff --git a/progs/tests/constants_in_inner_functions.sy b/progs/tests/constants_in_inner_functions.sy new file mode 100644 index 0000000..99704e7 --- /dev/null +++ b/progs/tests/constants_in_inner_functions.sy @@ -0,0 +1,20 @@ +start :: fn { + + q : int = 0 + + f :: fn -> fn -> { + g :: fn { + q += 1 + } + ret g + } + + g := f() + g() + q <=> 1 + g() + q <=> 2 + g() + q <=> 3 + +} diff --git a/progs/tests/div.sy b/progs/tests/div.sy new file mode 100644 index 0000000..df3e7bb --- /dev/null +++ b/progs/tests/div.sy @@ -0,0 +1,5 @@ +start :: fn { + a := 2 + a /= 2 + a <=> 1 +} diff --git a/progs/tests/else_.sy b/progs/tests/else_.sy new file mode 100644 index 0000000..0f1d624 --- /dev/null +++ b/progs/tests/else_.sy @@ -0,0 +1,10 @@ +start :: fn { + a := 1 + res := 0 + if a == 0 { + + } else { + res = 1 + } + res <=> 1 +} diff --git a/progs/tests/else_if.sy b/progs/tests/else_if.sy new file mode 100644 index 0000000..f31453e --- /dev/null +++ b/progs/tests/else_if.sy @@ -0,0 +1,12 @@ +start :: fn { + a := 1 + res := 0 + if a == 0 { + + } else if a == 1 { + res = 1 + } else { + + } + res <=> 1 +} diff --git a/progs/tests/expressions.sy b/progs/tests/expressions.sy new file mode 100644 index 0000000..99569e4 --- /dev/null +++ b/progs/tests/expressions.sy @@ -0,0 +1,6 @@ +start :: fn { + 1 + 1 // blargh + 2 // blargh + // HARGH + +} diff --git a/progs/tests/factorial.sy b/progs/tests/factorial.sy new file mode 100644 index 0000000..770bc33 --- /dev/null +++ b/progs/tests/factorial.sy @@ -0,0 +1,12 @@ +factorial :: fn n: int -> int { + if n <= 1 { + ret 1 + } + ret n * factorial(n - 1) +} + +start :: fn { + factorial(5) <=> 120 + factorial(6) <=> 720 + factorial(12) <=> 479001600 +} diff --git a/progs/tests/field.sy b/progs/tests/field.sy new file mode 100644 index 0000000..b11e51e --- /dev/null +++ b/progs/tests/field.sy @@ -0,0 +1,3 @@ +start :: fn { + blob A { a: int } +} diff --git a/progs/tests/field_assign.sy b/progs/tests/field_assign.sy new file mode 100644 index 0000000..4fb6dd4 --- /dev/null +++ b/progs/tests/field_assign.sy @@ -0,0 +1,5 @@ +start :: fn { + blob A { a: int } + a := A() + a.a = 2 +} diff --git a/progs/tests/field_get.sy b/progs/tests/field_get.sy new file mode 100644 index 0000000..49bb0f2 --- /dev/null +++ b/progs/tests/field_get.sy @@ -0,0 +1,7 @@ +start :: fn { + blob A { a: int } + a := A() + a.a = 2 + a.a <=> 2 + 2 <=> a.a +} diff --git a/progs/tests/in_rhs.sy b/progs/tests/in_rhs.sy new file mode 100644 index 0000000..28ed276 --- /dev/null +++ b/progs/tests/in_rhs.sy @@ -0,0 +1,3 @@ +start :: fn { + 5 <=> 1 * 2 + 3 +} diff --git a/progs/tests/instantiate.sy b/progs/tests/instantiate.sy new file mode 100644 index 0000000..bb2f09c --- /dev/null +++ b/progs/tests/instantiate.sy @@ -0,0 +1,5 @@ +start :: fn { + blob A {} + a := A() + a +} diff --git a/progs/tests/invalid_assign.sy b/progs/tests/invalid_assign.sy new file mode 100644 index 0000000..8ee47ab --- /dev/null +++ b/progs/tests/invalid_assign.sy @@ -0,0 +1,7 @@ +start :: fn { + a := 1 + a = 0.1 + a +} + +// errors: [ErrorKind::TypeMismatch(Type::Int, Type::Float)] diff --git a/progs/tests/more_types.sy b/progs/tests/more_types.sy new file mode 100644 index 0000000..c85403a --- /dev/null +++ b/progs/tests/more_types.sy @@ -0,0 +1,4 @@ +start :: fn { + a: (str, bool, int) = ("abc", true, 1) + a +} diff --git a/progs/tests/mul.sy b/progs/tests/mul.sy new file mode 100644 index 0000000..4b33314 --- /dev/null +++ b/progs/tests/mul.sy @@ -0,0 +1,3 @@ +start :: fn { + (0, 1, 2) * (2, 3, 4) <=> (0, 3, 8) +} diff --git a/progs/tests/multiple_fields.sy b/progs/tests/multiple_fields.sy new file mode 100644 index 0000000..ce4c61f --- /dev/null +++ b/progs/tests/multiple_fields.sy @@ -0,0 +1,11 @@ +start :: fn { + blob A { + a: int + b: int + } + a := A() + a.a = 2 + a.b = 3 + a.a + a.b <=> 5 + 5 <=> a.a + a.b +} diff --git a/progs/tests/multiple_returns.sy b/progs/tests/multiple_returns.sy new file mode 100644 index 0000000..6cb5e1a --- /dev/null +++ b/progs/tests/multiple_returns.sy @@ -0,0 +1,12 @@ +start :: fn { + f := fn a: int -> int { + if a == 1 { + ret 2 + } else { + ret 3 + } + } + f(0) <=> 3 + f(1) <=> 2 + f(2) <=> 3 +} diff --git a/progs/tests/negation.sy b/progs/tests/negation.sy new file mode 100644 index 0000000..0c702aa --- /dev/null +++ b/progs/tests/negation.sy @@ -0,0 +1,7 @@ +start :: fn { + -1 <=> 0 - 1 + -1 + 2 <=> 1 + -(1 + 2) <=> -3 + 1 + -1 <=> 0 + 2 * -1 <=> -2 +} diff --git a/progs/tests/not.sy b/progs/tests/not.sy new file mode 100644 index 0000000..02dd81d --- /dev/null +++ b/progs/tests/not.sy @@ -0,0 +1,5 @@ +start :: fn { + f := fn {} + f! + +} diff --git a/progs/tests/one_arg.sy b/progs/tests/one_arg.sy new file mode 100644 index 0000000..e7dee83 --- /dev/null +++ b/progs/tests/one_arg.sy @@ -0,0 +1,5 @@ +start :: fn { + f := fn a:int { a <=> 1 } + f! 1 + +} diff --git a/progs/tests/param_1.sy b/progs/tests/param_1.sy new file mode 100644 index 0000000..c96089e --- /dev/null +++ b/progs/tests/param_1.sy @@ -0,0 +1,4 @@ +start :: fn { + f := fn a: int {} + f(1) +} diff --git a/progs/tests/param_2.sy b/progs/tests/param_2.sy new file mode 100644 index 0000000..1915c42 --- /dev/null +++ b/progs/tests/param_2.sy @@ -0,0 +1,7 @@ +start :: fn { + add := fn a: int, b: int -> int { + ret a + b + } + add(1, 1) <=> 2 + add(10, 20) <=> 30 +} diff --git a/progs/tests/param_and_return.sy b/progs/tests/param_and_return.sy new file mode 100644 index 0000000..2752fcc --- /dev/null +++ b/progs/tests/param_and_return.sy @@ -0,0 +1,7 @@ +start :: fn { + f := fn a: int -> int { + ret a * 2 + } + f(1) <=> 2 + f(5) <=> 10 +} diff --git a/progs/tests/parenthesis.sy b/progs/tests/parenthesis.sy new file mode 100644 index 0000000..dd6fe8a --- /dev/null +++ b/progs/tests/parenthesis.sy @@ -0,0 +1,3 @@ +start :: fn { + (1 + 2) * 3 <=> 9 +} diff --git a/progs/tests/passing_functions.sy b/progs/tests/passing_functions.sy new file mode 100644 index 0000000..e09a125 --- /dev/null +++ b/progs/tests/passing_functions.sy @@ -0,0 +1,9 @@ +start :: fn { + g := fn -> int { + ret 1 + } + f := fn inner: fn -> int -> int { + ret inner() + } + f(g) <=> 1 +} diff --git a/progs/tests/passing_functions_mixed.sy b/progs/tests/passing_functions_mixed.sy new file mode 100644 index 0000000..b08128e --- /dev/null +++ b/progs/tests/passing_functions_mixed.sy @@ -0,0 +1,9 @@ +start :: fn { + g := fn a: int -> int { + ret a * 2 + } + f := fn inner: fn int -> int, a: int -> int { + ret inner(a) + } + f(g, 2) <=> 4 +} diff --git a/progs/tests/precedence.sy b/progs/tests/precedence.sy new file mode 100644 index 0000000..ae08e05 --- /dev/null +++ b/progs/tests/precedence.sy @@ -0,0 +1,8 @@ +start :: fn { + f := fn a: int, b: int -> int { + ret a + b + } + 1 + f(2, 3) <=> 6 + 2 * f(2, 3) <=> 10 + f(2, 3) - (2 + 3) <=> 0 +} diff --git a/progs/tests/return_1.sy b/progs/tests/return_1.sy new file mode 100644 index 0000000..533208f --- /dev/null +++ b/progs/tests/return_1.sy @@ -0,0 +1,6 @@ +start :: fn { + f := fn -> int { + ret 1 + } + f() <=> 1 +} diff --git a/progs/tests/returning_closures.sy b/progs/tests/returning_closures.sy new file mode 100644 index 0000000..4d69d5a --- /dev/null +++ b/progs/tests/returning_closures.sy @@ -0,0 +1,24 @@ +start :: fn { + + f : fn -> fn -> int = fn -> fn -> int { + x : int = 0 + f := fn -> int { + x = x + 1 + ret x + } + f() <=> 1 + ret f + } + + a := f() + b := f() + + a() <=> 2 + a() <=> 3 + + b() <=> 2 + b() <=> 3 + + a() <=> 4 + +} diff --git a/progs/tests/simple.sy b/progs/tests/simple.sy new file mode 100644 index 0000000..99bf586 --- /dev/null +++ b/progs/tests/simple.sy @@ -0,0 +1,10 @@ +start :: fn { + + a :: 1 + a <=> 1 + b := 2 + { + a <=> 1 + b <=> 2 + } +} diff --git a/progs/tests/simple_add.sy b/progs/tests/simple_add.sy new file mode 100644 index 0000000..7be4012 --- /dev/null +++ b/progs/tests/simple_add.sy @@ -0,0 +1,9 @@ +start :: fn { + + a := 0 + b := 99999 + a += 1 + a <=> 1 + b <=> 99999 + +} diff --git a/progs/tests/simple_break.sy b/progs/tests/simple_break.sy new file mode 100644 index 0000000..6f2e5b6 --- /dev/null +++ b/progs/tests/simple_break.sy @@ -0,0 +1,12 @@ +start :: fn { + + a := 0 + for i := 0, i < 10, i += 1 { + a = a + 1 + if i == 2 { + break + } + } + a <=> 3 + +} diff --git a/progs/tests/simple_continue.sy b/progs/tests/simple_continue.sy new file mode 100644 index 0000000..3e26e6c --- /dev/null +++ b/progs/tests/simple_continue.sy @@ -0,0 +1,12 @@ +start :: fn { + + a := 0 + for i := 0, i < 4, i += 1 { + if i == 2 { + continue + } + a = a + 1 + } + a <=> 3 + +} diff --git a/progs/tests/simple_sub.sy b/progs/tests/simple_sub.sy new file mode 100644 index 0000000..c220b8f --- /dev/null +++ b/progs/tests/simple_sub.sy @@ -0,0 +1,9 @@ +start :: fn { + + a := 0 + b := 99999 + a -= 1 + a <=> -1 + b <=> 99999 + +} diff --git a/progs/tests/simplest.sy b/progs/tests/simplest.sy new file mode 100644 index 0000000..14a6534 --- /dev/null +++ b/progs/tests/simplest.sy @@ -0,0 +1,4 @@ +start :: fn { + f := fn {} + f() +} diff --git a/progs/tests/single_variable.sy b/progs/tests/single_variable.sy new file mode 100644 index 0000000..ce4c2ad --- /dev/null +++ b/progs/tests/single_variable.sy @@ -0,0 +1,4 @@ +start :: fn { + a := 1 + a <=> 1 +} diff --git a/progs/tests/stack_ordering.sy b/progs/tests/stack_ordering.sy new file mode 100644 index 0000000..f13e5cf --- /dev/null +++ b/progs/tests/stack_ordering.sy @@ -0,0 +1,6 @@ +start :: fn { + a := 1 + b := 2 + b <=> 2 + a <=> 1 +} diff --git a/progs/tests/strange.sy b/progs/tests/strange.sy new file mode 100644 index 0000000..b6aad0f --- /dev/null +++ b/progs/tests/strange.sy @@ -0,0 +1,15 @@ +start :: fn { + + a := 0 + { + b := 99999 + { + a := 99999 + a + } + b + a -= 1 + } + a <=> -1 + +} diff --git a/progs/tests/sub.sy b/progs/tests/sub.sy new file mode 100644 index 0000000..e5d60f2 --- /dev/null +++ b/progs/tests/sub.sy @@ -0,0 +1,3 @@ +start :: fn { + (1, -2, 3, -4) - (4, 3, -2, -1) <=> (-3, 1, 1, -5) +} diff --git a/progs/tests/terms_and_factors.sy b/progs/tests/terms_and_factors.sy new file mode 100644 index 0000000..42a48e2 --- /dev/null +++ b/progs/tests/terms_and_factors.sy @@ -0,0 +1,4 @@ +start :: fn { + 1 + 1 * 2 <=> 3 + 1 * 2 + 3 <=> 5 +} diff --git a/progs/tests/three_arg.sy b/progs/tests/three_arg.sy new file mode 100644 index 0000000..56eb634 --- /dev/null +++ b/progs/tests/three_arg.sy @@ -0,0 +1,5 @@ +start :: fn { + f := fn a:int, b:int, c:int { c <=> 13 } + f! 1, 1 + 2, 1 + 4 * 3 + +} diff --git a/progs/tests/two_arg.sy b/progs/tests/two_arg.sy new file mode 100644 index 0000000..09ea1f7 --- /dev/null +++ b/progs/tests/two_arg.sy @@ -0,0 +1,5 @@ +start :: fn { + f := fn a:int, b:int { b <=> 3 } + f! 1, 1 + 2 + +} diff --git a/progs/tests/two_variables.sy b/progs/tests/two_variables.sy new file mode 100644 index 0000000..93329e3 --- /dev/null +++ b/progs/tests/two_variables.sy @@ -0,0 +1,6 @@ +start :: fn { + a := 1 + b := 2 + a <=> 1 + b <=> 2 +} diff --git a/progs/tests/types.sy b/progs/tests/types.sy new file mode 100644 index 0000000..bdcdfa4 --- /dev/null +++ b/progs/tests/types.sy @@ -0,0 +1,4 @@ +start :: fn { + a: (int, float, int) = (1, 1., 1) + a +} diff --git a/progs/tests/uncallable_type.sy b/progs/tests/uncallable_type.sy new file mode 100644 index 0000000..dbe6e81 --- /dev/null +++ b/progs/tests/uncallable_type.sy @@ -0,0 +1,8 @@ +start :: fn { + f := fn i: int { + i() + } + f +} + +// errors: [ErrorKind::InvalidProgram] diff --git a/progs/tests/wrong_params.sy b/progs/tests/wrong_params.sy new file mode 100644 index 0000000..e49e89b --- /dev/null +++ b/progs/tests/wrong_params.sy @@ -0,0 +1,7 @@ +start :: fn { + + f : fn -> int = fn a: int -> int {} + f +} + +// errors: [ErrorKind::TypeMismatch(_, _), ErrorKind::TypeMismatch(Type::Void, Type::Int)] diff --git a/progs/tests/wrong_ret.sy b/progs/tests/wrong_ret.sy new file mode 100644 index 0000000..6c4a9a5 --- /dev/null +++ b/progs/tests/wrong_ret.sy @@ -0,0 +1,7 @@ +start :: fn { + + f : fn -> int = fn {} + f +} + +// errors: [ErrorKind::TypeMismatch(_, _)] -- cgit v1.2.1