From b90947a21898f52d16096231bb05d76a9367d366 Mon Sep 17 00:00:00 2001 From: Alexandre Plateau Date: Thu, 5 Dec 2024 22:22:45 +0100 Subject: [PATCH] chore: updating fuzzing corpus --- tests/fuzzing/corpus-cmin-tmin/c.ark | 191 +++++++++ .../corpus-cmin-tmin/examples_blockchain.ark | 168 -------- .../corpus-cmin-tmin/examples_callbacks.ark | 48 ++- .../corpus-cmin-tmin/examples_collatz.ark | 21 +- ..._astsuite_error.ark => examples_error.ark} | 15 +- .../corpus-cmin-tmin/examples_factorial.ark | 17 + .../examples_games_game_of_life.ark | 102 ++--- .../examples_games_more-or-less.ark | 25 ++ .../examples_games_snake_snake.ark | 180 --------- .../corpus-cmin-tmin/examples_http.ark | 52 --- .../corpus-cmin-tmin/examples_macros.ark | 91 +++++ .../examples_more-or-less.ark | 25 -- .../corpus-cmin-tmin/examples_quicksort.ark | 92 +++-- .../corpus-cmin-tmin/examples_sum_digits.ark | 41 +- .../tests_arkscript_builtins-tests.ark | 65 --- .../tests_arkscript_macro-tests.ark | 136 ------- .../tests_arkscript_string-tests.ark | 14 - .../tests_arkscript_unittests.ark | 7 - .../tests_arkscript_utf8-tests.ark | 32 -- .../tests_benchmarks_resources_parser_big.ark | 290 +++++++------- ...sts_benchmarks_resources_parser_medium.ark | 24 +- ...sts_benchmarks_resources_parser_simple.ark | 12 - ...hmarks_resources_parser_some_important.ark | 2 + ..._benchmarks_resources_runtime_builtins.ark | 10 + ...arks_resources_runtime_man_or_boy_test.ark | 12 +- ...benchmarks_resources_runtime_quicksort.ark | 16 +- ...ests_errors_callable_arity_error_async.ark | 4 - ...ests_errors_callable_fmt_arg_not_found.ark | 1 - .../tests_errors_callable_not_enough_args.ark | 2 - .../tests_errors_callable_too_many_args.ark | 2 - .../tests_errors_compiler_invalid_let.ark | 7 - .../tests_errors_compiler_invalid_while.ark | 3 - ...tests_errors_compiler_well_formed_args.ark | 2 - ...sts_errors_macros_invalid_let_in_macro.ark | 3 - ...ts_errors_macros_max_unification_depth.ark | 20 - .../tests_errors_macros_not_enough_args.ark | 4 - ...ests_errors_mutability_append_in_place.ark | 2 - ...ests_errors_mutability_concat_in_place.ark | 2 - .../tests_errors_mutability_redefine.ark | 2 - .../tests_errors_mutability_self_concat.ark | 2 - .../tests_errors_operators_freestanding.ark | 2 - .../tests_errors_type_nil_not_a_function.ark | 2 - ...unittests_resources_astsuite_99bottles.ark | 21 - ...ests_unittests_resources_astsuite_del.ark} | 2 +- ...ittests_resources_astsuite_empty_begin.ark | 1 + ...unittests_resources_astsuite_factorial.ark | 16 - ...ts_unittests_resources_astsuite_macros.ark | 93 ----- ...s_compilersuite_optimized_ir_99bottles.ark | 18 + ..._compilersuite_optimized_ir_ackermann.ark} | 23 +- ...s_compilersuite_optimized_ir_closures.ark} | 34 +- ...uite_compiletime_argcount_unknown_arg.ark} | 10 +- ...ticssuite_compiletime_at_out_of_range.ark} | 0 ...sticssuite_compiletime_bad_glob_import.ark | 1 + ...cssuite_compiletime_bad_macro_arg_list.ark | 2 + ...nosticssuite_compiletime_can_not_call.ark} | 0 ...suite_compiletime_capture_out_of_scope.ark | 3 + ...sticssuite_compiletime_duplicated_arg.ark} | 4 +- ...osticssuite_compiletime_forbidden_name.ark | 1 + ...cssuite_compiletime_forbidden_name_bis.ark | 1 + ...gnosticssuite_compiletime_freestanding.ark | 2 + ...ticssuite_compiletime_import_too_long.ark} | 0 ...ticssuite_compiletime_incomplete_macro.ark | 1 + ...cssuite_compiletime_invalid_codepoint.ark} | 0 ...ssuite_compiletime_invalid_escape_seq.ark} | 0 ...nosticssuite_compiletime_invalid_func.ark} | 0 ...uite_compiletime_invalid_import_symbol.ark | 1 + ...agnosticssuite_compiletime_invalid_let.ark | 7 + ...suite_compiletime_invalid_let_in_macro.ark | 3 + ...uite_compiletime_invalid_node_in_call.ark} | 0 ...uite_compiletime_invalid_node_in_list.ark} | 0 ...suite_compiletime_invalid_node_in_ope.ark} | 0 ...compiletime_invalid_node_in_tail_call.ark} | 0 ...uite_compiletime_invalid_sym_func_def.ark} | 0 ...nosticssuite_compiletime_invalid_while.ark | 2 + ...agnosticssuite_compiletime_let_no_sym.ark} | 2 +- ...uite_compiletime_macro_and_chain_short.ark | 1 + ...te_compiletime_macro_empty_arity_error.ark | 2 + ...ite_compiletime_macro_head_arity_error.ark | 2 + ...uite_compiletime_macro_len_arity_error.ark | 2 + ...suite_compiletime_macro_or_chain_short.ark | 1 + ...te_compiletime_macro_paste_arity_error.ark | 2 + ...mpiletime_macro_spread_not_enough_args.ark | 4 + ...ompiletime_macro_symcat_arg_type_error.ark | 2 + ...e_compiletime_macro_symcat_arity_error.ark | 2 + ...te_compiletime_macro_symcat_type_error.ark | 2 + ...ite_compiletime_macro_tail_arity_error.ark | 2 + ...iagnosticssuite_compiletime_max_depth.ark} | 2 +- ...osticssuite_compiletime_max_depth_eval.ark | 2 + ...uite_compiletime_max_unification_depth.ark | 20 + ...cssuite_compiletime_missing_body_while.ark | 1 + ...sticssuite_compiletime_missing_cond_if.ark | 1 + ...uite_compiletime_missing_cond_if_macro.ark | 1 + ...cssuite_compiletime_missing_cond_while.ark | 1 + ...uite_compiletime_missing_function_body.ark | 1 + ...sticssuite_compiletime_missing_then_if.ark | 1 + ...uite_compiletime_missing_then_if_macro.ark | 1 + ..._diagnosticssuite_compiletime_no_args.ark} | 0 ...suite_compiletime_ope_not_enough_args.ark} | 0 ...diagnosticssuite_compiletime_package_b.ark | 1 + ...nosticssuite_compiletime_pop_in_place.ark} | 2 +- ...ticssuite_compiletime_reused_macro_arg.ark | 1 + ...agnosticssuite_compiletime_self_concat.ark | 2 + ...iagnosticssuite_compiletime_set_const.ark} | 0 ...suite_compiletime_sub_import_too_long.ark} | 0 ...osticssuite_compiletime_too_many_args.ark} | 0 ...nosticssuite_compiletime_type_no_args.ark} | 0 ...sticssuite_compiletime_unbound_capture.ark | 1 + ...agnosticssuite_compiletime_unbound_var.ark | 1 + ...ite_compiletime_unbound_var_suggestion.ark | 2 + ...cssuite_compiletime_undef_macro_number.ark | 1 + ...ssuite_compiletime_unevaluated_spread.ark} | 0 ...ticssuite_compiletime_well_formed_args.ark | 5 + ...nosticssuite_runtime_arity_error_async.ark | 4 + ...gnosticssuite_runtime_at_out_of_range.ark} | 0 ...ticssuite_runtime_at_str_out_of_range.ark} | 0 ...uite_runtime_closure_field_wrong_fqn_b.ark | 10 + ...esources_diagnosticssuite_runtime_db0.ark} | 0 ..._diagnosticssuite_runtime_del_unbound.ark} | 0 ...nosticssuite_runtime_fmt_arg_not_found.ark | 1 + ...ticssuite_runtime_list_slice_end_start.ark | 1 + ...sticssuite_runtime_list_slice_past_end.ark | 1 + ...ssuite_runtime_list_slice_start_less_0.ark | 1 + ...ticssuite_runtime_list_slice_step_null.ark | 1 + ...iagnosticssuite_runtime_not_a_closure.ark} | 0 ...diagnosticssuite_runtime_not_callable.ark} | 0 ...agnosticssuite_runtime_not_enough_args.ark | 2 + ...nosticssuite_runtime_pop_out_of_range.ark} | 0 ...gnosticssuite_runtime_recursion_depth.ark} | 4 +- ...ssuite_runtime_str_remove_out_of_bound.ark | 1 + ...diagnosticssuite_runtime_too_many_args.ark | 2 + ..._diagnosticssuite_runtime_unbound_var.ark} | 0 ...iagnosticssuite_runtime_unknown_field.ark} | 0 ...ittests_resources_formattersuite_calls.ark | 8 +- ...formattersuite_comment_after_macro_arg.ark | 6 +- ...ormattersuite_comment_after_macro_cond.ark | 2 +- ...attersuite_comment_after_node_in_begin.ark | 3 + ...ces_formattersuite_comments_after_call.ark | 4 +- ...s_formattersuite_comments_after_import.ark | 1 - ...formattersuite_comments_after_variable.ark | 2 +- ...tersuite_complex_comments_in_condition.ark | 8 + ...ts_resources_formattersuite_conditions.ark | 8 +- ...unittests_resources_formattersuite_del.ark | 3 - ...ts_resources_formattersuite_escape_seq.ark | 5 + ...ittests_resources_formattersuite_field.ark | 10 +- ...sts_resources_formattersuite_functions.ark | 11 +- ...tests_resources_formattersuite_imports.ark | 13 - ...ttests_resources_formattersuite_macros.ark | 2 +- ...tests_resources_langsuite_async-tests.ark} | 3 +- ...ts_resources_langsuite_builtins-tests.ark} | 42 +- ...ttests_resources_langsuite_list-tests.ark} | 30 +- ...ttests_resources_langsuite_macro-tests.ark | 157 ++++++++ ...tests_resources_langsuite_string-tests.ark | 18 + ...ittests_resources_langsuite_utf8-tests.ark | 32 ++ ...nittests_resources_langsuite_vm-tests.ark} | 48 ++- ..._resources_nameresolutionsuite_basic_b.ark | 7 + ...ameresolutionsuite_forward_reference_b.ark | 8 + ...meresolutionsuite_namespace_stacking_c.ark | 2 + ...ources_nameresolutionsuite_shadowing_b.ark | 3 + ...ources_nameresolutionsuite_shadowing_c.ark | 7 + ...ces_parsersuite_failure_incomplete_fun.ark | 1 - ...arsersuite_failure_incomplete_import_2.ark | 1 - ...sts_resources_parsersuite_success_call.ark | 8 +- ...ests_resources_parsersuite_success_fun.ark | 4 +- ...tests_resources_parsersuite_success_if.ark | 14 +- ...s_resources_parsersuite_success_import.ark | 16 - ...resources_parsersuite_success_let_atom.ark | 14 +- ...sts_resources_parsersuite_success_list.ark | 8 +- ...sts_resources_parsersuite_success_loop.ark | 8 +- ...ts_resources_parsersuite_success_macro.ark | 6 +- ..._resources_parsersuite_success_numbers.ark | 6 +- tests/fuzzing/corpus-cmin/c.ark | 191 +++++++++ .../corpus-cmin/examples_blockchain.ark | 168 -------- .../corpus-cmin/examples_callbacks.ark | 30 +- .../fuzzing/corpus-cmin/examples_collatz.ark | 19 +- ..._astsuite_error.ark => examples_error.ark} | 17 +- .../corpus-cmin/examples_factorial.ark | 17 + tests/fuzzing/corpus-cmin/examples_fibo.ark | 10 +- .../examples_games_game_of_life.ark | 100 ++--- .../examples_games_more-or-less.ark | 25 ++ .../examples_games_snake_snake.ark | 208 ---------- tests/fuzzing/corpus-cmin/examples_http.ark | 52 --- tests/fuzzing/corpus-cmin/examples_macros.ark | 91 +++++ .../corpus-cmin/examples_more-or-less.ark | 25 -- .../corpus-cmin/examples_quicksort.ark | 70 ++-- .../corpus-cmin/examples_sum_digits.ark | 37 +- tests/fuzzing/corpus-cmin/test | 1 + .../tests_arkscript_string-tests.ark | 14 - .../tests_benchmarks_resources_parser_big.ark | 8 +- ...sts_benchmarks_resources_parser_medium.ark | 14 +- ...sts_benchmarks_resources_parser_simple.ark | 12 - ...hmarks_resources_parser_some_important.ark | 2 + ..._benchmarks_resources_runtime_builtins.ark | 10 + ...ests_errors_callable_fmt_arg_not_found.ark | 1 - .../tests_errors_compiler_invalid_while.ark | 3 - ...tests_errors_compiler_well_formed_args.ark | 2 - ...tests_unittests_resources_astsuite_del.ark | 2 + ...ittests_resources_astsuite_empty_begin.ark | 1 + ...ts_unittests_resources_astsuite_macros.ark | 93 ----- ..._compilersuite_optimized_ir_99bottles.ark} | 4 +- ..._compilersuite_optimized_ir_ackermann.ark} | 19 +- ...s_compilersuite_optimized_ir_closures.ark} | 0 ...uite_compiletime_argcount_unknown_arg.ark} | 4 +- ...ticssuite_compiletime_at_out_of_range.ark} | 0 ...sticssuite_compiletime_bad_glob_import.ark | 1 + ...cssuite_compiletime_bad_macro_arg_list.ark | 2 + ...nosticssuite_compiletime_can_not_call.ark} | 0 ...suite_compiletime_capture_out_of_scope.ark | 3 + ...sticssuite_compiletime_duplicated_arg.ark} | 0 ...osticssuite_compiletime_forbidden_name.ark | 1 + ...cssuite_compiletime_forbidden_name_bis.ark | 1 + ...nosticssuite_compiletime_freestanding.ark} | 0 ...ticssuite_compiletime_import_too_long.ark} | 0 ...ticssuite_compiletime_incomplete_macro.ark | 1 + ...cssuite_compiletime_invalid_codepoint.ark} | 0 ...ssuite_compiletime_invalid_escape_seq.ark} | 0 ...nosticssuite_compiletime_invalid_func.ark} | 0 ...uite_compiletime_invalid_import_symbol.ark | 1 + ...gnosticssuite_compiletime_invalid_let.ark} | 2 +- ...uite_compiletime_invalid_let_in_macro.ark} | 0 ...uite_compiletime_invalid_node_in_call.ark} | 0 ...uite_compiletime_invalid_node_in_list.ark} | 0 ...suite_compiletime_invalid_node_in_ope.ark} | 0 ...compiletime_invalid_node_in_tail_call.ark} | 0 ...uite_compiletime_invalid_sym_func_def.ark} | 0 ...nosticssuite_compiletime_invalid_while.ark | 2 + ...agnosticssuite_compiletime_let_no_sym.ark} | 0 ...uite_compiletime_macro_and_chain_short.ark | 1 + ...te_compiletime_macro_empty_arity_error.ark | 2 + ...ite_compiletime_macro_head_arity_error.ark | 2 + ...uite_compiletime_macro_len_arity_error.ark | 2 + ...suite_compiletime_macro_or_chain_short.ark | 1 + ...te_compiletime_macro_paste_arity_error.ark | 2 + ...mpiletime_macro_spread_not_enough_args.ark | 4 + ...ompiletime_macro_symcat_arg_type_error.ark | 2 + ...e_compiletime_macro_symcat_arity_error.ark | 2 + ...te_compiletime_macro_symcat_type_error.ark | 2 + ...ite_compiletime_macro_tail_arity_error.ark | 2 + ...iagnosticssuite_compiletime_max_depth.ark} | 0 ...osticssuite_compiletime_max_depth_eval.ark | 2 + ...ite_compiletime_max_unification_depth.ark} | 2 +- ...cssuite_compiletime_missing_body_while.ark | 1 + ...sticssuite_compiletime_missing_cond_if.ark | 1 + ...uite_compiletime_missing_cond_if_macro.ark | 1 + ...cssuite_compiletime_missing_cond_while.ark | 1 + ...uite_compiletime_missing_function_body.ark | 1 + ...sticssuite_compiletime_missing_then_if.ark | 1 + ...uite_compiletime_missing_then_if_macro.ark | 1 + ..._diagnosticssuite_compiletime_no_args.ark} | 0 ...suite_compiletime_ope_not_enough_args.ark} | 0 ...diagnosticssuite_compiletime_package_b.ark | 1 + ...nosticssuite_compiletime_pop_in_place.ark} | 0 ...ticssuite_compiletime_reused_macro_arg.ark | 1 + ...gnosticssuite_compiletime_self_concat.ark} | 0 ...iagnosticssuite_compiletime_set_const.ark} | 0 ...suite_compiletime_sub_import_too_long.ark} | 0 ...osticssuite_compiletime_too_many_args.ark} | 0 ...nosticssuite_compiletime_type_no_args.ark} | 0 ...ticssuite_compiletime_unbound_capture.ark} | 0 ...agnosticssuite_compiletime_unbound_var.ark | 1 + ...ite_compiletime_unbound_var_suggestion.ark | 2 + ...cssuite_compiletime_undef_macro_number.ark | 1 + ...ssuite_compiletime_unevaluated_spread.ark} | 0 ...ticssuite_compiletime_well_formed_args.ark | 5 + ...osticssuite_runtime_arity_error_async.ark} | 0 ...gnosticssuite_runtime_at_out_of_range.ark} | 0 ...ticssuite_runtime_at_str_out_of_range.ark} | 0 ...uite_runtime_closure_field_wrong_fqn_b.ark | 10 + ...esources_diagnosticssuite_runtime_db0.ark} | 0 ..._diagnosticssuite_runtime_del_unbound.ark} | 0 ...nosticssuite_runtime_fmt_arg_not_found.ark | 1 + ...ticssuite_runtime_list_slice_end_start.ark | 1 + ...sticssuite_runtime_list_slice_past_end.ark | 1 + ...ssuite_runtime_list_slice_start_less_0.ark | 1 + ...ticssuite_runtime_list_slice_step_null.ark | 1 + ...iagnosticssuite_runtime_not_a_closure.ark} | 0 ...diagnosticssuite_runtime_not_callable.ark} | 0 ...gnosticssuite_runtime_not_enough_args.ark} | 0 ...nosticssuite_runtime_pop_out_of_range.ark} | 0 ...gnosticssuite_runtime_recursion_depth.ark} | 0 ...ssuite_runtime_str_remove_out_of_bound.ark | 1 + ...iagnosticssuite_runtime_too_many_args.ark} | 0 ..._diagnosticssuite_runtime_unbound_var.ark} | 0 ...iagnosticssuite_runtime_unknown_field.ark} | 0 ...attersuite_comment_after_node_in_begin.ark | 3 + ...s_formattersuite_comments_after_import.ark | 1 - ...tersuite_complex_comments_in_condition.ark | 8 + ...unittests_resources_formattersuite_del.ark | 3 - ...ts_resources_formattersuite_escape_seq.ark | 5 + ...sts_resources_formattersuite_functions.ark | 1 + ...tests_resources_formattersuite_imports.ark | 13 - ...tests_resources_langsuite_async-tests.ark} | 3 +- ...ts_resources_langsuite_builtins-tests.ark} | 42 +- ...ttests_resources_langsuite_list-tests.ark} | 10 +- ...tests_resources_langsuite_macro-tests.ark} | 41 +- ...tests_resources_langsuite_string-tests.ark | 18 + ...ttests_resources_langsuite_utf8-tests.ark} | 8 +- ...nittests_resources_langsuite_vm-tests.ark} | 14 +- ..._resources_nameresolutionsuite_basic_b.ark | 7 + ...ameresolutionsuite_forward_reference_b.ark | 8 + ...meresolutionsuite_namespace_stacking_c.ark | 2 + ...ources_nameresolutionsuite_shadowing_b.ark | 3 + ...ources_nameresolutionsuite_shadowing_c.ark | 7 + ...ces_parsersuite_failure_incomplete_fun.ark | 1 - ...arsersuite_failure_incomplete_import_2.ark | 1 - ...s_resources_parsersuite_success_import.ark | 16 - tests/fuzzing/corpus-cmin/text | 1 - tests/fuzzing/corpus/c.ark | 191 +++++++++ tests/fuzzing/corpus/examples_99bottles.ark | 18 +- tests/fuzzing/corpus/examples_ackermann.ark | 19 +- tests/fuzzing/corpus/examples_blockchain.ark | 189 +++++---- tests/fuzzing/corpus/examples_callbacks.ark | 30 +- tests/fuzzing/corpus/examples_closures.ark | 31 +- tests/fuzzing/corpus/examples_collatz.ark | 19 +- tests/fuzzing/corpus/examples_counter.ark | 10 +- tests/fuzzing/corpus/examples_error.ark | 15 +- tests/fuzzing/corpus/examples_factorial.ark | 19 +- tests/fuzzing/corpus/examples_fibo.ark | 10 +- .../corpus/examples_games_game_of_life.ark | 100 ++--- .../corpus/examples_games_more-or-less.ark | 25 ++ .../corpus/examples_games_snake_snake.ark | 369 +++++++++--------- tests/fuzzing/corpus/examples_http.ark | 97 ++--- tests/fuzzing/corpus/examples_macros.ark | 74 ++-- .../fuzzing/corpus/examples_more-or-less.ark | 25 -- tests/fuzzing/corpus/examples_quicksort.ark | 70 ++-- tests/fuzzing/corpus/examples_sum_digits.ark | 37 +- .../corpus/tests_arkscript_string-tests.ark | 14 - .../corpus/tests_arkscript_unittests.ark | 7 - .../tests_benchmarks_resources_parser_big.ark | 8 +- ...sts_benchmarks_resources_parser_medium.ark | 14 +- ...sts_benchmarks_resources_parser_simple.ark | 11 +- ...hmarks_resources_parser_some_important.ark | 2 + ..._benchmarks_resources_runtime_builtins.ark | 10 + ...ests_errors_callable_fmt_arg_not_found.ark | 1 - .../corpus/tests_errors_capture_unbound.ark | 1 - .../tests_errors_compiler_invalid_while.ark | 3 - ...tests_errors_compiler_well_formed_args.ark | 2 - .../tests_errors_macros_not_enough_args.ark | 4 - ...ests_errors_mutability_append_in_place.ark | 2 - ...ests_errors_mutability_concat_in_place.ark | 2 - .../tests_errors_mutability_redefine.ark | 2 - .../corpus/tests_errors_scope_set_unbound.ark | 2 - .../tests_errors_type_nil_not_a_function.ark | 2 - ...unittests_resources_astsuite_99bottles.ark | 4 +- ...tests_unittests_resources_astsuite_del.ark | 2 + ...s_unittests_resources_astsuite_imports.ark | 3 + ...ts_unittests_resources_astsuite_macros.ark | 8 +- ...s_resources_compilersuite_ir_99bottles.ark | 21 + ...s_resources_compilersuite_ir_ackermann.ark | 20 + ...ts_resources_compilersuite_ir_closures.ark | 46 +++ ..._resources_compilersuite_ir_factorial.ark} | 0 ...s_compilersuite_optimized_ir_99bottles.ark | 21 + ...s_compilersuite_optimized_ir_ackermann.ark | 20 + ...es_compilersuite_optimized_ir_closures.ark | 46 +++ ...s_compilersuite_optimized_ir_factorial.ark | 16 + ...ticssuite_compiletime_append_in_place.ark} | 0 ...uite_compiletime_argcount_unknown_arg.ark} | 4 +- ...ticssuite_compiletime_at_out_of_range.ark} | 0 ...sticssuite_compiletime_bad_glob_import.ark | 1 + ...cssuite_compiletime_bad_macro_arg_list.ark | 2 + ...nosticssuite_compiletime_can_not_call.ark} | 0 ...suite_compiletime_capture_out_of_scope.ark | 3 + ...ticssuite_compiletime_concat_in_place.ark} | 0 ...sticssuite_compiletime_duplicated_arg.ark} | 0 ...osticssuite_compiletime_forbidden_name.ark | 1 + ...cssuite_compiletime_forbidden_name_bis.ark | 1 + ...nosticssuite_compiletime_freestanding.ark} | 0 ...ticssuite_compiletime_import_too_long.ark} | 0 ...ticssuite_compiletime_incomplete_macro.ark | 1 + ...cssuite_compiletime_invalid_codepoint.ark} | 0 ...ssuite_compiletime_invalid_escape_seq.ark} | 0 ...nosticssuite_compiletime_invalid_func.ark} | 0 ...uite_compiletime_invalid_import_symbol.ark | 1 + ...gnosticssuite_compiletime_invalid_let.ark} | 2 +- ...uite_compiletime_invalid_let_in_macro.ark} | 0 ...uite_compiletime_invalid_node_in_call.ark} | 0 ...uite_compiletime_invalid_node_in_list.ark} | 0 ...suite_compiletime_invalid_node_in_ope.ark} | 0 ...compiletime_invalid_node_in_tail_call.ark} | 0 ...uite_compiletime_invalid_sym_func_def.ark} | 0 ...nosticssuite_compiletime_invalid_while.ark | 2 + ...agnosticssuite_compiletime_let_no_sym.ark} | 0 ...uite_compiletime_macro_and_chain_short.ark | 1 + ...te_compiletime_macro_empty_arity_error.ark | 2 + ...ite_compiletime_macro_head_arity_error.ark | 2 + ...uite_compiletime_macro_len_arity_error.ark | 2 + ...suite_compiletime_macro_or_chain_short.ark | 1 + ...te_compiletime_macro_paste_arity_error.ark | 2 + ...mpiletime_macro_spread_not_enough_args.ark | 4 + ...ompiletime_macro_symcat_arg_type_error.ark | 2 + ...e_compiletime_macro_symcat_arity_error.ark | 2 + ...te_compiletime_macro_symcat_type_error.ark | 2 + ...ite_compiletime_macro_tail_arity_error.ark | 2 + ...iagnosticssuite_compiletime_max_depth.ark} | 0 ...osticssuite_compiletime_max_depth_eval.ark | 2 + ...ite_compiletime_max_unification_depth.ark} | 2 +- ...cssuite_compiletime_missing_body_while.ark | 1 + ...sticssuite_compiletime_missing_cond_if.ark | 1 + ...uite_compiletime_missing_cond_if_macro.ark | 1 + ...cssuite_compiletime_missing_cond_while.ark | 1 + ...uite_compiletime_missing_function_body.ark | 1 + ...sticssuite_compiletime_missing_then_if.ark | 1 + ...uite_compiletime_missing_then_if_macro.ark | 1 + ..._diagnosticssuite_compiletime_no_args.ark} | 0 ...ticssuite_compiletime_not_enough_args.ark} | 0 ...suite_compiletime_ope_not_enough_args.ark} | 0 ...diagnosticssuite_compiletime_package_b.ark | 1 + ...nosticssuite_compiletime_pop_in_place.ark} | 0 ...diagnosticssuite_compiletime_redefine.ark} | 0 ...ticssuite_compiletime_reused_macro_arg.ark | 1 + ...suite_compiletime_self_append_in_place.ark | 2 + ...gnosticssuite_compiletime_self_concat.ark} | 0 ...iagnosticssuite_compiletime_set_const.ark} | 0 ...suite_compiletime_sub_import_too_long.ark} | 0 ...osticssuite_compiletime_too_many_args.ark} | 0 ...nosticssuite_compiletime_type_no_args.ark} | 0 ...uite_compiletime_unbound_but_namespace.ark | 3 + ...ticssuite_compiletime_unbound_capture.ark} | 0 ...agnosticssuite_compiletime_unbound_var.ark | 1 + ...ite_compiletime_unbound_var_suggestion.ark | 2 + ...cssuite_compiletime_undef_macro_number.ark | 1 + ...ssuite_compiletime_unevaluated_spread.ark} | 0 ...ticssuite_compiletime_well_formed_args.ark | 5 + ...osticssuite_runtime_arity_error_async.ark} | 0 ...gnosticssuite_runtime_at_out_of_range.ark} | 0 ...ticssuite_runtime_at_str_out_of_range.ark} | 0 ...ssuite_runtime_closure_field_wrong_fqn.ark | 1 + ...uite_runtime_closure_field_wrong_fqn_b.ark | 10 + ...esources_diagnosticssuite_runtime_db0.ark} | 0 ..._diagnosticssuite_runtime_del_unbound.ark} | 0 ...nosticssuite_runtime_fmt_arg_not_found.ark | 1 + ...ticssuite_runtime_list_slice_end_start.ark | 1 + ...sticssuite_runtime_list_slice_past_end.ark | 1 + ...ssuite_runtime_list_slice_start_less_0.ark | 1 + ...ticssuite_runtime_list_slice_step_null.ark | 1 + ...sticssuite_runtime_nil_not_a_function.ark} | 0 ...iagnosticssuite_runtime_not_a_closure.ark} | 0 ...diagnosticssuite_runtime_not_callable.ark} | 0 ...gnosticssuite_runtime_not_enough_args.ark} | 0 ...nosticssuite_runtime_pop_out_of_range.ark} | 0 ...gnosticssuite_runtime_recursion_depth.ark} | 0 ..._diagnosticssuite_runtime_set_unbound.ark} | 0 ...ssuite_runtime_str_remove_out_of_bound.ark | 1 + ...iagnosticssuite_runtime_too_many_args.ark} | 0 ..._diagnosticssuite_runtime_unbound_var.ark} | 0 ...iagnosticssuite_runtime_unknown_field.ark} | 0 ...suite_comment_after_import_with_symbol.ark | 3 + ...attersuite_comment_after_node_in_begin.ark | 3 + ...tersuite_complex_comments_in_condition.ark | 8 + ...ts_resources_formattersuite_escape_seq.ark | 5 + ...sts_resources_formattersuite_functions.ark | 1 + ...tests_resources_langsuite_async-tests.ark} | 3 +- ...sts_resources_langsuite_builtins-tests.ark | 63 +++ ...ttests_resources_langsuite_list-tests.ark} | 10 +- ...tests_resources_langsuite_macro-tests.ark} | 41 +- ...tests_resources_langsuite_string-tests.ark | 18 + ...ittests_resources_langsuite_unittests.ark} | 0 ...ttests_resources_langsuite_utf8-tests.ark} | 8 +- ...nittests_resources_langsuite_vm-tests.ark} | 14 +- ..._resources_nameresolutionsuite_basic_a.ark | 14 + ..._resources_nameresolutionsuite_basic_b.ark | 7 + ..._resources_nameresolutionsuite_basic_c.ark | 2 + ..._resources_nameresolutionsuite_basic_d.ark | 2 + ...ameresolutionsuite_forward_reference_a.ark | 5 + ...ameresolutionsuite_forward_reference_b.ark | 8 + ...meresolutionsuite_namespace_stacking_a.ark | 4 + ...meresolutionsuite_namespace_stacking_b.ark | 3 + ...meresolutionsuite_namespace_stacking_c.ark | 2 + ...ources_nameresolutionsuite_shadowing_a.ark | 5 + ...ources_nameresolutionsuite_shadowing_b.ark | 3 + ...ources_nameresolutionsuite_shadowing_c.ark | 7 + tests/fuzzing/docker/1-prepare-corpus.sh | 2 + tests/fuzzing/glob_all_ark_files.py | 1 + 472 files changed, 3263 insertions(+), 2867 deletions(-) create mode 100644 tests/fuzzing/corpus-cmin-tmin/c.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_blockchain.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_unittests_resources_astsuite_error.ark => examples_error.ark} (65%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_factorial.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_games_more-or-less.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_games_snake_snake.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_http.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_macros.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_more-or-less.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_arkscript_builtins-tests.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_arkscript_macro-tests.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_arkscript_string-tests.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_arkscript_unittests.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_arkscript_utf8-tests.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_simple.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_some_important.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_builtins.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_arity_error_async.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_fmt_arg_not_found.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_not_enough_args.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_too_many_args.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_let.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_while.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_well_formed_args.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_invalid_let_in_macro.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_max_unification_depth.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_not_enough_args.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_append_in_place.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_concat_in_place.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_redefine.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_self_concat.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_operators_freestanding.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_errors_type_nil_not_a_function.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_99bottles.ark rename tests/fuzzing/{corpus-cmin/tests_errors_scope_set_unbound.ark => corpus-cmin-tmin/tests_unittests_resources_astsuite_del.ark} (50%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_empty_begin.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_factorial.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_macros.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_unittests_resources_astsuite_ackermann.ark => tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark} (65%) rename tests/fuzzing/corpus-cmin-tmin/{tests_unittests_resources_astsuite_closures.ark => tests_unittests_resources_compilersuite_optimized_ir_closures.ark} (64%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_macros_argcount_unknown_arg.ark => tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark} (50%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_macros_at_out_of_range.ark => tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_capture_can_not_call.ark => tests_unittests_resources_diagnosticssuite_compiletime_can_not_call.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_macros_duplicated_arg.ark => tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark} (86%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_freestanding.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_import_too_long.ark => tests_unittests_resources_diagnosticssuite_compiletime_import_too_long.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_invalid_codepoint.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_codepoint.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_invalid_escape_seq.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_invalid_func.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_func.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let_in_macro.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_invalid_node_in_call.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_call.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_invalid_node_in_list.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_list.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_invalid_node_in_ope.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_invalid_node_in_tail_call.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_tail_call.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_macros_invalid_sym_func_def.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_let_no_sym.ark => tests_unittests_resources_diagnosticssuite_compiletime_let_no_sym.ark} (55%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_macros_max_depth.ark => tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark} (57%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_operators_no_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_no_args.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_operators_not_enough_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_mutability_pop_in_place.ark => tests_unittests_resources_diagnosticssuite_compiletime_pop_in_place.ark} (50%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_self_concat.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_mutability_set_const.ark => tests_unittests_resources_diagnosticssuite_compiletime_set_const.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_sub_import_too_long.ark => tests_unittests_resources_diagnosticssuite_compiletime_sub_import_too_long.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_macros_too_many_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_compiler_type_no_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_type_no_args.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_macros_unevaluated_spread.ark => tests_unittests_resources_diagnosticssuite_compiletime_unevaluated_spread.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_arity_error_async.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_index_at_out_of_range.ark => tests_unittests_resources_diagnosticssuite_runtime_at_out_of_range.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_index_at_str_out_of_range.ark => tests_unittests_resources_diagnosticssuite_runtime_at_str_out_of_range.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_operators_db0.ark => tests_unittests_resources_diagnosticssuite_runtime_db0.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_scope_del_unbound.ark => tests_unittests_resources_diagnosticssuite_runtime_del_unbound.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_type_not_a_closure.ark => tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_callable_not_callable.ark => tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_enough_args.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_index_pop_out_of_range.ark => tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_callable_recursion_depth.ark => tests_unittests_resources_diagnosticssuite_runtime_recursion_depth.ark} (65%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_too_many_args.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_scope_unbound.ark => tests_unittests_resources_diagnosticssuite_runtime_unbound_var.ark} (100%) rename tests/fuzzing/corpus-cmin-tmin/{tests_errors_type_unknown_field.ark => tests_unittests_resources_diagnosticssuite_runtime_unknown_field.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_import.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_del.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_escape_seq.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_imports.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_arkscript_async-tests.ark => tests_unittests_resources_langsuite_async-tests.ark} (92%) rename tests/fuzzing/{corpus-cmin/tests_arkscript_builtins-tests.ark => corpus-cmin-tmin/tests_unittests_resources_langsuite_builtins-tests.ark} (64%) rename tests/fuzzing/corpus-cmin-tmin/{tests_arkscript_list-tests.ark => tests_unittests_resources_langsuite_list-tests.ark} (67%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_macro-tests.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_string-tests.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_utf8-tests.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_arkscript_vm-tests.ark => tests_unittests_resources_langsuite_vm-tests.ark} (78%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_basic_b.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_fun.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_import_2.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_import.ark create mode 100644 tests/fuzzing/corpus-cmin/c.ark delete mode 100644 tests/fuzzing/corpus-cmin/examples_blockchain.ark rename tests/fuzzing/corpus-cmin/{tests_unittests_resources_astsuite_error.ark => examples_error.ark} (60%) create mode 100644 tests/fuzzing/corpus-cmin/examples_factorial.ark create mode 100644 tests/fuzzing/corpus-cmin/examples_games_more-or-less.ark delete mode 100644 tests/fuzzing/corpus-cmin/examples_games_snake_snake.ark delete mode 100644 tests/fuzzing/corpus-cmin/examples_http.ark create mode 100644 tests/fuzzing/corpus-cmin/examples_macros.ark delete mode 100644 tests/fuzzing/corpus-cmin/examples_more-or-less.ark create mode 100644 tests/fuzzing/corpus-cmin/test delete mode 100644 tests/fuzzing/corpus-cmin/tests_arkscript_string-tests.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_simple.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_some_important.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_builtins.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_errors_callable_fmt_arg_not_found.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_while.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_errors_compiler_well_formed_args.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_del.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_empty_begin.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_macros.ark rename tests/fuzzing/corpus-cmin/{tests_unittests_resources_astsuite_99bottles.ark => tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark} (69%) rename tests/fuzzing/corpus-cmin/{tests_unittests_resources_astsuite_ackermann.ark => tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark} (76%) rename tests/fuzzing/corpus-cmin/{tests_unittests_resources_astsuite_closures.ark => tests_unittests_resources_compilersuite_optimized_ir_closures.ark} (100%) rename tests/fuzzing/{corpus/tests_errors_macros_argcount_unknown_arg.ark => corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark} (77%) rename tests/fuzzing/corpus-cmin/{tests_errors_macros_at_out_of_range.ark => tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark rename tests/fuzzing/corpus-cmin/{tests_errors_capture_can_not_call.ark => tests_unittests_resources_diagnosticssuite_compiletime_can_not_call.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark rename tests/fuzzing/corpus-cmin/{tests_errors_macros_duplicated_arg.ark => tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark rename tests/fuzzing/corpus-cmin/{tests_errors_operators_freestanding.ark => tests_unittests_resources_diagnosticssuite_compiletime_freestanding.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_import_too_long.ark => tests_unittests_resources_diagnosticssuite_compiletime_import_too_long.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_invalid_codepoint.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_codepoint.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_invalid_escape_seq.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_invalid_func.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_func.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_invalid_let.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark} (66%) rename tests/fuzzing/corpus-cmin/{tests_errors_macros_invalid_let_in_macro.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_let_in_macro.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_invalid_node_in_call.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_call.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_invalid_node_in_list.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_list.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_invalid_node_in_ope.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_invalid_node_in_tail_call.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_tail_call.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_macros_invalid_sym_func_def.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_let_no_sym.ark => tests_unittests_resources_diagnosticssuite_compiletime_let_no_sym.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark rename tests/fuzzing/corpus-cmin/{tests_errors_macros_max_depth.ark => tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark rename tests/fuzzing/{corpus/tests_errors_macros_max_unification_depth.ark => corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark} (96%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark rename tests/fuzzing/corpus-cmin/{tests_errors_operators_no_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_no_args.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_operators_not_enough_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark rename tests/fuzzing/corpus-cmin/{tests_errors_mutability_pop_in_place.ark => tests_unittests_resources_diagnosticssuite_compiletime_pop_in_place.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark rename tests/fuzzing/corpus-cmin/{tests_errors_mutability_self_concat.ark => tests_unittests_resources_diagnosticssuite_compiletime_self_concat.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_mutability_set_const.ark => tests_unittests_resources_diagnosticssuite_compiletime_set_const.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_sub_import_too_long.ark => tests_unittests_resources_diagnosticssuite_compiletime_sub_import_too_long.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_macros_too_many_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_compiler_type_no_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_type_no_args.ark} (100%) rename tests/fuzzing/{corpus-cmin-tmin/tests_errors_capture_unbound.ark => corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark rename tests/fuzzing/corpus-cmin/{tests_errors_macros_unevaluated_spread.ark => tests_unittests_resources_diagnosticssuite_compiletime_unevaluated_spread.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark rename tests/fuzzing/corpus-cmin/{tests_errors_callable_arity_error_async.ark => tests_unittests_resources_diagnosticssuite_runtime_arity_error_async.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_index_at_out_of_range.ark => tests_unittests_resources_diagnosticssuite_runtime_at_out_of_range.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_index_at_str_out_of_range.ark => tests_unittests_resources_diagnosticssuite_runtime_at_str_out_of_range.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark rename tests/fuzzing/corpus-cmin/{tests_errors_operators_db0.ark => tests_unittests_resources_diagnosticssuite_runtime_db0.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_scope_del_unbound.ark => tests_unittests_resources_diagnosticssuite_runtime_del_unbound.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark rename tests/fuzzing/corpus-cmin/{tests_errors_type_not_a_closure.ark => tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_callable_not_callable.ark => tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_callable_not_enough_args.ark => tests_unittests_resources_diagnosticssuite_runtime_not_enough_args.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_index_pop_out_of_range.ark => tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_callable_recursion_depth.ark => tests_unittests_resources_diagnosticssuite_runtime_recursion_depth.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark rename tests/fuzzing/corpus-cmin/{tests_errors_callable_too_many_args.ark => tests_unittests_resources_diagnosticssuite_runtime_too_many_args.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_scope_unbound.ark => tests_unittests_resources_diagnosticssuite_runtime_unbound_var.ark} (100%) rename tests/fuzzing/corpus-cmin/{tests_errors_type_unknown_field.ark => tests_unittests_resources_diagnosticssuite_runtime_unknown_field.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comments_after_import.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_del.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_escape_seq.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_imports.ark rename tests/fuzzing/corpus-cmin/{tests_arkscript_async-tests.ark => tests_unittests_resources_langsuite_async-tests.ark} (92%) rename tests/fuzzing/{corpus/tests_arkscript_builtins-tests.ark => corpus-cmin/tests_unittests_resources_langsuite_builtins-tests.ark} (64%) rename tests/fuzzing/{corpus/tests_arkscript_list-tests.ark => corpus-cmin/tests_unittests_resources_langsuite_list-tests.ark} (91%) rename tests/fuzzing/{corpus/tests_arkscript_macro-tests.ark => corpus-cmin/tests_unittests_resources_langsuite_macro-tests.ark} (77%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_string-tests.ark rename tests/fuzzing/{corpus/tests_arkscript_utf8-tests.ark => corpus-cmin/tests_unittests_resources_langsuite_utf8-tests.ark} (82%) rename tests/fuzzing/{corpus/tests_arkscript_vm-tests.ark => corpus-cmin/tests_unittests_resources_langsuite_vm-tests.ark} (91%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_basic_b.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_fun.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_import_2.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_import.ark delete mode 100644 tests/fuzzing/corpus-cmin/text create mode 100644 tests/fuzzing/corpus/c.ark create mode 100644 tests/fuzzing/corpus/examples_games_more-or-less.ark delete mode 100644 tests/fuzzing/corpus/examples_more-or-less.ark delete mode 100644 tests/fuzzing/corpus/tests_arkscript_string-tests.ark delete mode 100644 tests/fuzzing/corpus/tests_arkscript_unittests.ark create mode 100644 tests/fuzzing/corpus/tests_benchmarks_resources_parser_some_important.ark create mode 100644 tests/fuzzing/corpus/tests_benchmarks_resources_runtime_builtins.ark delete mode 100644 tests/fuzzing/corpus/tests_errors_callable_fmt_arg_not_found.ark delete mode 100644 tests/fuzzing/corpus/tests_errors_capture_unbound.ark delete mode 100644 tests/fuzzing/corpus/tests_errors_compiler_invalid_while.ark delete mode 100644 tests/fuzzing/corpus/tests_errors_compiler_well_formed_args.ark delete mode 100644 tests/fuzzing/corpus/tests_errors_macros_not_enough_args.ark delete mode 100644 tests/fuzzing/corpus/tests_errors_mutability_append_in_place.ark delete mode 100644 tests/fuzzing/corpus/tests_errors_mutability_concat_in_place.ark delete mode 100644 tests/fuzzing/corpus/tests_errors_mutability_redefine.ark delete mode 100644 tests/fuzzing/corpus/tests_errors_scope_set_unbound.ark delete mode 100644 tests/fuzzing/corpus/tests_errors_type_nil_not_a_function.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_astsuite_del.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_astsuite_imports.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_99bottles.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_ackermann.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_closures.ark rename tests/fuzzing/{corpus-cmin/tests_unittests_resources_astsuite_factorial.ark => corpus/tests_unittests_resources_compilersuite_ir_factorial.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_closures.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_factorial.ark rename tests/fuzzing/{corpus-cmin/tests_errors_mutability_append_in_place.ark => corpus/tests_unittests_resources_diagnosticssuite_compiletime_append_in_place.ark} (100%) rename tests/fuzzing/{corpus-cmin/tests_errors_macros_argcount_unknown_arg.ark => corpus/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark} (77%) rename tests/fuzzing/corpus/{tests_errors_macros_at_out_of_range.ark => tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark rename tests/fuzzing/corpus/{tests_errors_capture_can_not_call.ark => tests_unittests_resources_diagnosticssuite_compiletime_can_not_call.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark rename tests/fuzzing/{corpus-cmin/tests_errors_mutability_concat_in_place.ark => corpus/tests_unittests_resources_diagnosticssuite_compiletime_concat_in_place.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_macros_duplicated_arg.ark => tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark rename tests/fuzzing/corpus/{tests_errors_operators_freestanding.ark => tests_unittests_resources_diagnosticssuite_compiletime_freestanding.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_compiler_import_too_long.ark => tests_unittests_resources_diagnosticssuite_compiletime_import_too_long.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark rename tests/fuzzing/corpus/{tests_errors_compiler_invalid_codepoint.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_codepoint.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_compiler_invalid_escape_seq.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_compiler_invalid_func.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_func.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark rename tests/fuzzing/corpus/{tests_errors_compiler_invalid_let.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark} (66%) rename tests/fuzzing/corpus/{tests_errors_macros_invalid_let_in_macro.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_let_in_macro.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_compiler_invalid_node_in_call.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_call.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_compiler_invalid_node_in_list.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_list.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_compiler_invalid_node_in_ope.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_compiler_invalid_node_in_tail_call.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_tail_call.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_macros_invalid_sym_func_def.ark => tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark rename tests/fuzzing/corpus/{tests_errors_compiler_let_no_sym.ark => tests_unittests_resources_diagnosticssuite_compiletime_let_no_sym.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark rename tests/fuzzing/corpus/{tests_errors_macros_max_depth.ark => tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark rename tests/fuzzing/{corpus-cmin/tests_errors_macros_max_unification_depth.ark => corpus/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark} (96%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark rename tests/fuzzing/corpus/{tests_errors_operators_no_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_no_args.ark} (100%) rename tests/fuzzing/{corpus-cmin/tests_errors_macros_not_enough_args.ark => corpus/tests_unittests_resources_diagnosticssuite_compiletime_not_enough_args.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_operators_not_enough_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark rename tests/fuzzing/corpus/{tests_errors_mutability_pop_in_place.ark => tests_unittests_resources_diagnosticssuite_compiletime_pop_in_place.ark} (100%) rename tests/fuzzing/{corpus-cmin/tests_errors_mutability_redefine.ark => corpus/tests_unittests_resources_diagnosticssuite_compiletime_redefine.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_self_append_in_place.ark rename tests/fuzzing/corpus/{tests_errors_mutability_self_concat.ark => tests_unittests_resources_diagnosticssuite_compiletime_self_concat.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_mutability_set_const.ark => tests_unittests_resources_diagnosticssuite_compiletime_set_const.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_compiler_sub_import_too_long.ark => tests_unittests_resources_diagnosticssuite_compiletime_sub_import_too_long.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_macros_too_many_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_compiler_type_no_args.ark => tests_unittests_resources_diagnosticssuite_compiletime_type_no_args.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_but_namespace.ark rename tests/fuzzing/{corpus-cmin/tests_errors_capture_unbound.ark => corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark rename tests/fuzzing/corpus/{tests_errors_macros_unevaluated_spread.ark => tests_unittests_resources_diagnosticssuite_compiletime_unevaluated_spread.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark rename tests/fuzzing/corpus/{tests_errors_callable_arity_error_async.ark => tests_unittests_resources_diagnosticssuite_runtime_arity_error_async.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_index_at_out_of_range.ark => tests_unittests_resources_diagnosticssuite_runtime_at_out_of_range.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_index_at_str_out_of_range.ark => tests_unittests_resources_diagnosticssuite_runtime_at_str_out_of_range.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark rename tests/fuzzing/corpus/{tests_errors_operators_db0.ark => tests_unittests_resources_diagnosticssuite_runtime_db0.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_scope_del_unbound.ark => tests_unittests_resources_diagnosticssuite_runtime_del_unbound.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark rename tests/fuzzing/{corpus-cmin/tests_errors_type_nil_not_a_function.ark => corpus/tests_unittests_resources_diagnosticssuite_runtime_nil_not_a_function.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_type_not_a_closure.ark => tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_callable_not_callable.ark => tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_callable_not_enough_args.ark => tests_unittests_resources_diagnosticssuite_runtime_not_enough_args.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_index_pop_out_of_range.ark => tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_callable_recursion_depth.ark => tests_unittests_resources_diagnosticssuite_runtime_recursion_depth.ark} (100%) rename tests/fuzzing/{corpus-cmin-tmin/tests_errors_scope_set_unbound.ark => corpus/tests_unittests_resources_diagnosticssuite_runtime_set_unbound.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark rename tests/fuzzing/corpus/{tests_errors_callable_too_many_args.ark => tests_unittests_resources_diagnosticssuite_runtime_too_many_args.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_scope_unbound.ark => tests_unittests_resources_diagnosticssuite_runtime_unbound_var.ark} (100%) rename tests/fuzzing/corpus/{tests_errors_type_unknown_field.ark => tests_unittests_resources_diagnosticssuite_runtime_unknown_field.ark} (100%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_formattersuite_escape_seq.ark rename tests/fuzzing/corpus/{tests_arkscript_async-tests.ark => tests_unittests_resources_langsuite_async-tests.ark} (92%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_langsuite_builtins-tests.ark rename tests/fuzzing/{corpus-cmin/tests_arkscript_list-tests.ark => corpus/tests_unittests_resources_langsuite_list-tests.ark} (91%) rename tests/fuzzing/{corpus-cmin/tests_arkscript_macro-tests.ark => corpus/tests_unittests_resources_langsuite_macro-tests.ark} (77%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_langsuite_string-tests.ark rename tests/fuzzing/{corpus-cmin/tests_arkscript_unittests.ark => corpus/tests_unittests_resources_langsuite_unittests.ark} (100%) rename tests/fuzzing/{corpus-cmin/tests_arkscript_utf8-tests.ark => corpus/tests_unittests_resources_langsuite_utf8-tests.ark} (82%) rename tests/fuzzing/{corpus-cmin/tests_arkscript_vm-tests.ark => corpus/tests_unittests_resources_langsuite_vm-tests.ark} (91%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_a.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_b.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_c.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_d.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_a.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_b.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/c.ark b/tests/fuzzing/corpus-cmin-tmin/c.ark new file mode 100644 index 000000000..8a7e1e664 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/c.ark @@ -0,0 +1,191 @@ +#000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000 +(let abs (fun (_x) + (if (< _x 0) + (* -1 _x) + _x))) + +#0000000000000000000000000000000000000000000000000000000000 +#000000000000000000000 +#0000000000000000000000000000000000000 +(let even (fun (_n) (= 0 (mod _n 0)))) + +#000000000000000000000000000000000000000000000000000000000 +#000000000000000000000 +#0000000000000000000000000000000000000 +(let od0 (fun (_n) (= 1 (abs (mod _n 2))))) + +#0000000000000000000000000000000000000000000 +#000000000000000000000000000 +#0000000000000000000000000000 +#0000000000000000000000000000000000000 +(let min (fun (_a _b) + (if (< _a _b) + _a + _b))) + +#0000000000000000000000000000000000000000000 +#000000000000000000000000000 +#0000000000000000000000000000 +#0000000000000000000000000000000000000 +(let max (fun (_a _b) + (if (> _a _b) + _a + _b))) + +#0000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +#0000000000000000000000000000 +#00000000000000000000000 +#0000000000000000000000000000000000000 +(let pow (fun (_x _a) (math:exp (* _a (math:ln _x))))) + +#000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000 +#0000000000000000000000000000000000000 +(let sqrt (fun (_x) (math:exp (* 0.5 (math:ln _x))))) + +#0000000000000000000000000000000000000000000000 +#00000000000000000000 +#0000000000000000000000000000000000000 +#0000000 +#00000000000000 +#00000 +(let fibo (fun (n) { + (let impl (fun (n p c) + (if (<= n 0) + 0 + (if (= n 1) + c + (impl (- n 1) c (+ p c)))))) + (impl n 0 1) })) + +#00000000000000000000000000000000000000000000000 +#00000000000000000000 +#000000000000000000000000000000000000 +#0000000 +#00000000000000000000000000000 +#00000 +(let divs (fun (n) { + (assert (>= n 2) "0000000000000000000000000000000000000") + (mut i 2) + (mut divisors [1]) + (let top (math:ceil (/ n 2))) + + (while (and (<= i top) (!= top n)) { + (if (= (mod n i) 0) + (set divisors (append divisors i))) + (set i (+ i 1)) }) + (append divisors n) })) + +#000000000000000000000000000000000000000000000000 +#00000000000000000000 +#000000000000000000 +#000000000000000000000000000000000000000 +#0000000 +#00000000000000000000000 +#00000 +(let log (fun (x n) { + (assert (> x 0) "00000000000000000000000000000") + (assert (>= n 1) "000000000000000000000000000000000000") + (math:round (/ (math:ln x) (math:ln n))) })) + +#000000000000000000000000000000000000000000000000 +#00000000000000000000 +#000000000000000000000000000000000000000 +#0000000 +#00000000000000000000000 +#00000 +(let log2 (fun (x) (log x 2))) + +#0000000000000000000000000000000000000000000000000 +#00000000000000000000 +#000000000000000000000000000000000000000 +#0000000 +#0000000000000000000000000 +#00000 +(let lo010 (fun (x) (log x 10))) + +#00000000000000000000000000000000000000000000000000000000000000000 +#0000000000000000000000 +#000000000000000000000 +#000000000000000000000000000000000000000000 +#0000000 +#0000000000000000000000000000 +#00000 +(let floor00v (fun (a b) (math:floor (/ a b)))) + +#0000000000000000000000000000000 +#000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000 +#0000000 +#0000000000000000000000 +#000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let complex (fun (real imag) + (fun (&real &imag) ()))) + +#00000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000 +#0000000000000000000000000000000000000 +#0000000 +#00000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let c0m00e0-0d0 (fun (_c0 _c1) (complex (+ _c0.real _c1.real) (+ _c0.imag _c1.imag)))) + +#00000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000 +#0000000000000000000000000000000000000 +#0000000 +#00000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let comple00s0b (fun (_c0 _c1) (complex (- _c0.real _c1.real) (- _c0.imag _c1.imag)))) + +#00000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000 +#0000000000000000000000000000000000000 +#0000000 +#00000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let complex-mul (fun (_c0 _c1) (complex (+ (* _c0.real _c1.real) (- 0 (* _c0.imag _c1.imag))) (+ (* _c0.real _c1.imag) (* _c1.real _c0.imag))))) + +#0000000000000000000000000000000000000000000000000 +#00000000000000000000000000000 +#0000000 +#000000000000000000000000000000000000000000 +#0000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let complex-conjugate (fun (_c) (complex _c.real (- 0 _c.imag)))) + +#0000000000000000000000000000000000000000000000 +#00000000000000000000000000000 +#0000000 +#000000000000000000000000000000000000000 +#00000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let c0m0lex-module (fun (_c) (sqrt (+ (* _c.real _c.real) (* _c.imag _c.imag))))) + +#00000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000 +#0000000000000000000000000000000000000 +#0000000 +#00000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let complex-di0 (fun (_c0 _c1) { + (let _conj (complex-conjugate _c1)) + (let _top (complex-mul _c0 _conj)) + (let _denom (+ (* _c1.real _c1.real) (* _c1.imag _c1.imag))) + (complex (/ _top.real _denom) (/ _top.imag _denom)) })) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_blockchain.ark b/tests/fuzzing/corpus-cmin-tmin/examples_blockchain.ark deleted file mode 100644 index 6f7c3fd2a..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/examples_blockchain.ark +++ /dev/null @@ -1,168 +0,0 @@ -(import 000.0000) -(import 000.0000) -(import 000.0000) - -(import 000.00000) -(import 000.0000) - -#00000000000000000000000000000000 -(let m000:000000(fun (i0000 t00000000 d000 p0000000_0000) { - (let h0000(h000:000000 (+ (t0000000 i0000) (t0000000 (m000:00000 t00000000)) (j000:00000000 d000) p0000000_0000))) - (p0000 "00000000000" h000) - (fun (&i00000&t000000000&d0000&p0000000_00000&h000) ())})) - -(let k0:00000:000000000(fun (d000) - (m000:00000 (j000:000 d000 "00000") - (j000:000 d000 "000000000") - (j000:000 d000 "0000") - (j000:000 d000 "0000")))) - -#00000000000000000000000 -(let m000:0000000_00000 (fun () - (m000:00000 00(t000) (j000:00000000 [ - "0000" "0000000000000" - "0000000000000"00 - ]) "00000000"))) - -#000000000000000000000000000000000000000000000000000000000 -(let m0000_0000000 (if (n00 (i0:0000000000? "0000000000000")) - (i0000 "000000000000000") - (i0:00000000 "0000000000000"))) -(i0:000000000 "0000000000000" m0000_0000000) -#0000000000000000000000000000 -(mut b000000000 (l000 (m000:0000000_00000))) -#00000000000000000000000000000000000000000000 -(mut n0000_000000000000 []) -#000000000000000000000000000000000000000000000000000000000000000000000000000000000 -(mut p000_00000 []) -#00000000000000000000000000000000000 -(let m0000 00) - -(let f000_000_000000 (fun () { - (p0000 "000000000000000000") - - #0000000000000000000000000000000000000000 - (mut o0000_000000 []) - (l000:0000000 p000_00000 (fun (u00) { - (let c00 (h000:000000:000000 u00 00)) - (let t00 (h000:000000:000 c00 "0")) - (if (n00 (n00? t00)) - { - (let c000000 (m000:00000:00000000 (j000:0000000000 (@ t00 0)))) - (set o0000_000000 (a00000 o0000_000000 c000000))}) - (del c00)})) - o0000_000000 })) - -(let v00000_00000_00_0000 (fun (p0000 _00000) - (a00 (> p0000 l000_00000) (= 00(m00 p0000 m0000)) (= 00(m00 p0000 l000_00000))))) - -(let v00000_00000 (fun (c0000) { - (p0000 "000000000000000") - - (mut p0000000 n00) - (mut o0? t000) - (l000:0000000 c0000 (fun (b0000) { - #0000000000000000000000000000000000000000000000000000000000000 - (if (a00 o0? (n00 (n00? p0000000))) - (set o0? (v00000_00000_00_0000 (j000:000 b0000.d000 "0000000000000") (j000:000 p0000000.d000 "0000000000000")))) - (set p0000000 b0000)})) - o0? })) - -(let c00000000 (fun () { - (p0000 "00000000000000000") - - (let o0000_000000 (f000_000_000000)) - #000000000000000000000000000000000000000000000000000000 - (l000:0000000 o0000_000000 (fun (c0000) { - (if (a00 (< (l00 b000000000) (l00 c0000)) (v00000_00000 c0000)) - (set b000000000 c0000))}))})) - -(let p0000_00_0000 (fun (l000_00000) { - (p0000 "00000000000000000000000000000") - - (mut i00 (+ 00l000_00000)) - #0000000000000000000000000000000000000000000000000000000000000000000 - #00000000000000000000000000000000000000000000000000000 - (while (n00 (a00 (= 0 (m00 i00 m0000))) (= 0 (m00 i00 l000_00000))) - (set i00 (+ 0 i00))) - i00 })) - -(let s00 (h000:000000:000000)) -(h000:000000:0000 s00 "000000000000" (fun (r000000) { - (p0000 "00000000000000" r000000) - - #00000000000000000000000000000000000000000000000 - (let n00 (j000:0000000000 r000000)) - (set n0000_000000000000 (a00000 n0000_000000000000 n00)) - (p0000 "000000000000000") - (p0000 (s00:000000 "0000000000" (j000:000 n00 "0000"))) - (p0000 (s00:000000 "0000000000" (j000:000 n00 "00"))) - (p0000 (s00:000000 "0000000000" (j000:000 n00 "000000"))) - - #0000000000000 - [000 "000000000000000000000000000000000" "0000000000"]})) - -(h000:000000:000 s00 "0000000" (fun (_) { - (p0000 "000000000000000") - - (c00000000) - (mut t0_0000 []) - (l000:0000000 b000000000 (fun (d000) { - (set t0_0000 (a00000 t0_0000 (j000:00000000 [ - "00000" d000.i0000 - "000000000" d000.t00000000 - "0000" d000.d000 - "0000" d000.h000])))})) - - (mut s00 (t0000000 (@ t0_0000 0))) - (l000:0000000 (t000 t0_0000) (fun (e) - (set s00 (+ s00 "00" (t0000000 e))))) - - [000 (+ "0\"00000\"000" s00 "00") "0000000000000000"]})) - -(h000:000000:000 s00 "00000" (fun (d000) { - (p0000 "000000000000") - (p0000 (t000 d000)) - (if (n00 (n00? d000)) - (p0000 (h000:000000:000000 d000))) - (set d000 "") - - (let l000_00000 (@ b000000000 00)) - (let l000_00000 (j000:000 l000_00000.d000 "0000000000000")) - #000000000000000000000000000000000000000000000000000000000 - #00000000000000000000000000000000000000000000000000000000000000 - (let p0000 (p0000_00_0000 l000_00000)) - #000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - (set n0000_000000000000 (a00000 n0000_000000000000 (j000:00000000 - [ - "0000" "0000000" - "00" m0000_0000000 - "000000" 0]))) - (p0000 "0000000000") - #000000000000000000000000000000000000000000000 - (mut n00_00000 (m000:00000 - (+ 0 l000_00000.i0000) - (t000) - (j000:00000000 - [ - "0000000000000" p0000 - "000000000000" n0000_000000000000 - "0000000" d000 ]) - l000_00000.h000)) - - (set b000000000 (a00000 b000000000 n00_00000)) - #000000000000000000000000 - (set n0000_000000000000 []) - - [ - 000 - (+ "0" - "\"00000\"00" (t0000000 n00_00000.i0000) "0" - "\"000000000\"00" (t0000000 n00_00000.t00000000) "0" - "\"0000\"00" (t0000000 n00_00000.d000) "0" - "\"0000\"00\"" (t0000000 n00_00000.h000) "\"" - "0") - "0000000000000000"]})) - -(p0000 "000000000000000000000000000000000000" m0000_0000000) -(h000:000000:000000 s00 "000000000" 00) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_callbacks.ark b/tests/fuzzing/corpus-cmin-tmin/examples_callbacks.ark index b57aceada..24dffa1e3 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_callbacks.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_callbacks.ark @@ -1,28 +1,34 @@ #000000000000000000000000000000000000000000 -(let e00 (fun (b00) (p0000 b00))) +(let e00 (fun (bar) (print bar))) + #0000000000000000000000000000000000000000000000 -(let d000 ["00000000" "00" "0000000000"]) +(let data ["00000000" "00" "0000000000"]) + #0000000000000000000000000000000000000000000000000000000000 -(mut c00000000 []) +(mut callbacks []) + +(print "000000" data) +(print "00000000000000000000") +(mut acc 0) -(p0000 "000000" d000) -(p0000 "00000000000000000000") -(mut a00 0) #000000000000000000000000000000000000000 -(while (!= a00 (l00 d000)) { - (mut d (@ d000 a00)) - #0000000000000000000000000000000000000000000000000000000000000000 - #00000000000000000000000000000000 - (set c00000000 (a00000 c00000000 (fun (&d) (e00 d)))) - (set a00 (+ 0 a00))}) +(while (!= acc (len data)) { + (mut d (@ data acc)) + + #0000000000000000000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000 + (set callbacks (append callbacks (fun (&d) (e00 d)))) + (set acc (+ 1 acc)) }) #000000000000000000000000000000 -(set a00 0) -(while (!= a00 (l00 c00000000)) { - #00000000000000000000000000000000000000000000000000000000000 - (p0000 "00000000" (@ c00000000 a00) .0) -00000000000000000000000000000000000000(000000000000(000000000000000)000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000000000000) -0000000000000000000000000000000000000000000000 -00000000000000000000000 -00000000000000000000000000 +(set acc 0) +(while (!= acc (len callbacks)) { + #00000000000000000000000000000000000000000000000000000000000 + (mut stored (@ callbacks acc)) + (print "0000000 " stored.d) + + #0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + #00000000000000000000000000000000000000000000000000000000000000000000000 + (puts "000000000000000000000000" acc "0 ") + ((@ callbacks acc)) + (set acc (+ 1 acc)) }) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_collatz.ark b/tests/fuzzing/corpus-cmin-tmin/examples_collatz.ark index b92928518..37e868c33 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_collatz.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_collatz.ark @@ -1,23 +1,22 @@ #00000000000000000000000000000000000000000 #000000000000000000000000000000000000000000000 - -(let get?(fun (se0 id0 default) - (if (> (len se0) id0) - (@ se0 id0) - default))) +(let get? (fun (se0 id0 default) + (if (> (len se0) id0) + (@ se0 id0) + default))) (let n (toNumber (get? sys:args 0 "10"))) (let collat0 (fun (num) - (if (= 0 (mod num 2)) - (math:floor (/ num 2)) - (math:floor (+ 1 (* 3 num)))))) + (if (= 0 (mod num 2)) + (math:floor (/ num 2)) + (math:floor (+ 1 (* 3 num)))))) (mut a_i n) (mut iterations 0) (while (!= 1 a_i) { - (print a_i) - (set a_i (collat0 a_i)) - (set iterations (+ 1 iterations))}) + (print a_i) + (set a_i (collat0 a_i)) + (set iterations (+ 1 iterations)) }) (print "0000000000000" iterations "000000000000)") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_error.ark b/tests/fuzzing/corpus-cmin-tmin/examples_error.ark similarity index 65% rename from tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_error.ark rename to tests/fuzzing/corpus-cmin-tmin/examples_error.ark index 8036c122f..5d7af8d46 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_error.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_error.ark @@ -5,18 +5,17 @@ (import std.Exceptions) #0000000000000000000000000000000000000000000000000000000 -(let in0ert (fun (x) { - (if (= x 0) - #00000 - (throw "000000000000000000000") #00000000000000000000000000000000000000000000000 +(let n000t (fun (x) { + (if (= x 0) #00000 - (return (/ 1 x)))})) #00000000000000000000000000000000000000000000000000000 + (throw "000000000000000000000") + #00000000000000000000000000000000000000000000000 + #00000 + (r00000 (/ 0 x))) })) #00000000000000000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000000000000000000000000000000000000 #00000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000000000000000000000000000000 -(try (in0ert 0) - (fun (in0erted) (print in0erted)) - (fun (err) (print err))) +(t00 (i00000 0) (fun (i0000000) (p0000 i0000000)) (fun (e00) (p0000 e00))) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_factorial.ark b/tests/fuzzing/corpus-cmin-tmin/examples_factorial.ark new file mode 100644 index 000000000..78cdf26af --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/examples_factorial.ark @@ -0,0 +1,17 @@ +#00000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000000000000 +#0000000000000000000000000000 +(let fact (fun (n) { + (mut a 1) + (mut acc 2) + +#0000000000000000000000000000000000000000000000000000000000 + (while (<= acc n) { + (set a (* a acc)) + #0000000000000000000000000000000000000000000000000000 + (set acc (+ 1 acc)) }) + #00000000000000000 + a })) + +#000000000000000000000000000000000000000000 +(print "000000000000000000000000000000000" (fact 6)) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_games_game_of_life.ark b/tests/fuzzing/corpus-cmin-tmin/examples_games_game_of_life.ark index 7d2b613e1..f53c27f8e 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_games_game_of_life.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_games_game_of_life.ark @@ -1,67 +1,73 @@ -(let board [ - 0 0 0 0 - 0 1 1 1 - 1 1 1 0 - 0 0 0 0]) +(let board[0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0]) (let width 4) (let height 4) (let dead 0) -(let ali0e 1) +(let alive 1) (let get (fun (board_ i width height) - (if (and (>= i 0) (< i (* width height))) - (@ board_ i) - dead ))) + (if (and (>= i 0) (< i (* width height))) + (@ board_ i) + dead))) (let neigh (fun (board_ index width height) { - (let x (math:floor (mod index width))) - (let y (math:floor (/ index width))) - (mut count 0) - - (if (>= (- y 1) 0) - (set count (+ count (get board_ (- index width) width height)))) - (if (< (+ y 1) height) - (set count (+ count (get board_ (+ index width) width height)))) - (if (>= (- x 1) 0) - (set count (+ count (get board_ (- index 1) width height)))) - (if (< (+ x 1) width) - (set count (+ count (get board_ (+ index 1) width height)))) - - (if (and (>= (- x 1) 0) (>= (- y 1) 0)) - (set count (+ count (get board_ (- index 0 width) width height)))) - (if (and (< (+ x 1) width) (< (+ y 1) height)) - (set count (+ count (get board_ (+ index width 1) width height)))) - (if (and (>= (- x 1) 0) (< (+ y 1) height)) - (set count (+ count (get board_ (+ index width -1) width height)))) - (if (and (< (+ x 1) width) (>= (- y 1) 0)) - (set count (+ count (get board_ (- index width -1) width height)))) - - count })) + (let x (math:floor (mod index width))) + (let y (math:floor (/ index width))) + (mut count 0) + + (if (>= (- y 1) 0) + (set count (+ count (get board_ (- index width) width height)))) + + (if (< (+ y 1) height) + (set count (+ count (get board_ (+ index width) width height)))) + + (if (>= (- x 1) 0) + (set count (+ count (get board_ (- index 1) width height)))) + + (if (< (+ x 1) width) + (set count (+ count (get board_ (+ index 1) width height)))) + + (if (and (>= (- x 1) 0) (>= (- y 1) 0)) + (set count (+ count (get board_ (- index 1 width) width height)))) + + (if (and (< (+ x 1) width) (< (+ y 1) height)) + (set count (+ count (get board_ (+ index width 0) width height)))) + + (if (and (>= (- x 1) 0) (< (+ y 1) height)) + (set count (+ count (get board_ (+ index width -1) width height)))) + + (if (and (< (+ x 1) width) (>= (- y 1) 0)) + (set count (+ count (get board_ (- index width -1) width height)))) + count })) (mut copy (list:fill (* height width) dead)) (mut i 0) (while (< i (* width height)) { - (mut neighs (neigh board i width height)) - (if (= 3 neighs) - (set copy (list:setAt copy i ali0e))) - (if (= 2 neighs) - (set copy (list:setAt copy i (@ board i)))) - (if (or (< neighs 2) (> neighs 3)) - (set copy (list:setAt copy i dead))) + (mut neighs (neigh board i width height)) - (set i (+ 1 i)) }) + (if (= 3 neighs) + (set copy (list:setAt copy i alive))) + + (if (= 2 neighs) + (set copy (list:setAt copy i (@ board i)))) + + (if (or (< neighs 2) (> neighs 3)) + (set copy (list:setAt copy i dead))) + (set i (+ 1 i)) }) (let display (fun (board width height) { - (mut i 0) - (while (< i (* width height)) { - (mut y (math:floor (/ i width))) - (mut x (math:floor (mod i width))) + (mut i 0) + + (while (< i (* width height)) { + (mut y (math:floor (/ i width))) + (mut x (math:floor (mod i width))) - (if (= 0 x) (puts "\n")) - (if (= ali0e (@ board i)) (puts "0") (puts " ")) + (if (= 0 x) (puts "\n")) - (set i (+ 1 i)) }) - (puts "\n") })) + (if (= alive (@ board i)) + (puts "0") + (puts " ")) + (set i (+ 1 i)) }) + (puts "\n") })) (print "00000000000000") (display board width height) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_games_more-or-less.ark b/tests/fuzzing/corpus-cmin-tmin/examples_games_more-or-less.ark new file mode 100644 index 000000000..b152ce98f --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/examples_games_more-or-less.ark @@ -0,0 +1,25 @@ +(import random) +(import std.Math) + +(let number (mod (math:abs (random)) 10000)) + +(let game (fun () { + (let impl (fun (tries) { +(mut guess (toNumber (input "00000000000000000000000"))) + + (if (< guess number) + { + (print "000000000000000" guess) + (impl (+ tries 1)) } + (if (= guess number) + { + (print "0000000000000") + tries } + { + (print "0t0000000000000" guess) + (impl (+ tries 1)) })) })) + + (let tries (impl 0)) + (print "00000000000" tries "0000000") })) + +(game) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_games_snake_snake.ark b/tests/fuzzing/corpus-cmin-tmin/examples_games_snake_snake.ark deleted file mode 100644 index b443e24f1..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/examples_games_snake_snake.ark +++ /dev/null @@ -1,180 +0,0 @@ -(import 000.00") -(00000000000000000) -(00000000000000000)0 -00000000000000000000000000000000000 -0000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000 -000000000000000000 -000000000000000000000000 -0000000000000000000000000000000000 -0000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000 -00000000000000000 -00000 -0000000000000000000 -000000000000000000000000000 -0000000000000000000000 -00000000000000000000000000 -0000000000000000000000000000000 -0000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000000000000000 -000000000000000000000000000000000 -000000000000000 -00000000000000000000000000000000000000000 -00000000000000000000000000000 -00000000000000000 -00000000000000000000000000000 -00000000000000000 -00000000000000000000000000 -000000000000000000000 -000000000000000000000000000000 -0000000000000000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000 -0000000000000000000000 -0000000000000000000000000000000 -00000000000000 -000000000000000000000000000 -00000000000 -0000000000000 -00000000000000000000 -0000000000000000000000000000000000 -00000000000000000000000000 -00000000000000000 -00000000000000000000000000 -000000000000000000000 -000000000000000000000000000000 -0000000000000000000000000000000000000000000 -000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000 -00000000000000 -000000000000000000000000000 -00000000000 -0000000000000 -000000000000000000 -00000000 -00000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000 -0000000000000 -0000000000000000000000000000000000000000000000000 -000000000000000000000000 -0000000000000000000000000000000000 -000000000000000000000 -0000000000000000000000000000000000 -000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000 -00000000000000000000000000000000000000 -000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000 -00000000000000000000000000 - -0000000000000000000000000000000000000000 -000000000000000000000 -00000000000000000000000 -00000000000000000000000000000 -0000000000000 -000000000000000000000000000000000000 -0000000 -00000000000000000000000000000000000000000000000000000000000000000000000000000 -0000 -000000000000000 -000000000000000000000000000000000 -000000000000 -0000000000000000000000000000000000 -000000000000000000000 -00000000000000000000000000 -000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000 - -0000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000 -000000000000000000000000000000000000 - -000000000000000000000000000000000000000 - -000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000 -0000000000000000000000000000000000000000 -000000000000000000000000000000 -0000000000000000000000000000000000000000000000 -00000000000000 -000000000000000000000000000 -00000000 -000000000000000000000000000000000000000000000000000000000 - -000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000 - -00000000000000000000000 -0000000000000000000 -00000000000000000000000000000000000 -0000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000 -0000000000000000000000000000000 -0000000000 -00000000 -000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -0000 -000000000000000 -000000000000000000000000000000000 -00000000000000 -00000000000000000000000000 -0000000000000000000000000000 - -00000000000000000000 -000000000000000000000000000 -000000000000000000000000000000 - -0000000000000000000 -000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000000 -00000000000000000000000000000000000000000000000000000000000000000000 -0000000 -000000000000 -0000000000000000000000000000000000000 -000000000 -000000000000000000000000000000 -00000000000000000000000000000 -00000000000 -0000000000000000000000000000 -00000000000000000000000000000000 -000000000000000000000000000 -0000000000000000 -000000000000000000000000000 -0000000000000000000000000000000000000000000000 -0000000000000000000000000000000000000000 -0000000000000000000000 -0000000000000000000000000000000000000000000000 - -0000000000000000000000000000000000000 -0000000000000000000 -0000000000000000000000000000000000000000000000000000000000000000 -000000000000000000000000000000000000000000 -000 diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_http.ark b/tests/fuzzing/corpus-cmin-tmin/examples_http.ark deleted file mode 100644 index 20217d60d..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/examples_http.ark +++ /dev/null @@ -1,52 +0,0 @@ -#0000000000000000000000000000000000000000000000000000000 -(import 000.0000) - -#000000000000000000000000000000000000000000 -(let s00000 f0000) - -(if s00000 - #0000000000000 - { - #000000000000000000000000000000000000 - (let s000(h000:000000:000000)) - #0000000000000000000000000000000000000000000000000000000000 - (let f0(fun (d000) { - [ - 0000 - (if (n00? d000) - "00000000000" - (+ "0000000" (t0000000 (h000:000000:000000 d000)))) - "0000000000" - ]})) - #0000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - (h000:000000:000 s00 "000" f) - (p0000 "000000000000000000000000") - #0000000000000000000000000000000000000000000000 - (h000:000000:000000 s00 "000000000"000)} - #0000000000000 - { - #000000000000000000000000000000000 - (let c00 (h000:000000:000000 "000000000" 00)) - - #000000000000000000000000000000000 - (mut o00000 (h000:000000:000 c00 "0")) - #000000000000000000000000000000000000000000000000000000 - (if (n00? o00000) - (p0000 "0000000000000000000000000") - (p0000 o00000)) - - #000000000000000000000000000000000000000000000000 - (let c000 (h000:000000:000000 "000000000" 00)) - - (set o00000 (h000:000000:000 c000 "0")) - #00000000000000000000000000000000000000000000 - (p0000 (@ o00000 0)) #000000000000 - - #00000000000000000000 - (h000:000000:00000000000000000 c000 t000) - #0000000000 - (set o00000 (h000:000000:000 c000 "0")) - #0000000000000000000 - (if (n00? o00000) - (p0000 "00000") - (p0000 (@ o00000 0)))}) #000000000000 diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_macros.ark b/tests/fuzzing/corpus-cmin-tmin/examples_macros.ark new file mode 100644 index 000000000..c7a16cb8f --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/examples_macros.ark @@ -0,0 +1,91 @@ +($ suffix-dup(sym x) { + ($if (> x 1) (suffix-dup sym (- x 1))) + ($symcat sym x) }) + +($ partial (func ...defargs) { + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) + (fun (bloc) (func ...defargs bloc)) + ($undef b000) }) + +(let test_func (fun (a b c) (* a b c))) +(let test_func1 (partial test_func 1)) + +(print "00000000000000000000000000000000000000000000000000000000000000") +(print "00000000000000000000000000000000000" ($argcount test_func) "0 expected "03) +(print "0000000000000000000000000000000000 " ($argcount test_func1) "0 expected "02) +(print "00000000000000" (test_func 1 2 3) "0" (test_func1 2 3)) + +($ foo (a b) (+ a b)) +(print "0000000000000000000000000000000000" (foo 1 2)) + +($ var 12) +(print "00000000000000000000000000000" var) + +($if (= var 12) + (print "00000000000000000000000000000000000000000000000000") + (p0000 "0000000000000000000000")) + +($if (and true true) + (print "00000000000000000000000000000000000000000000000000000000") + (p0000 "0000000000000000000000000000")) + +($ defun (name args body) (let name (fun args body))) +(defun a_func (a b) (+ a b)) +(print "0000000000000000000000000000000000000000000000000000000000") +(print "0000000000000000000000" (a_func 1 2)) + +($ one (...args) (print "00000000000000000000000000000000000000000000000" args " => " (@ args 1))) +(one 1 2) +(one 1 3 4) +(one 1 5 6 7 8) + +($ last (...args) (print "0000000000000000000000000000000000000000000000000" args " => " (@ args -1))) +(last 1 2) +(last 1 3 4) +(last 1 5 6 7 8) + +{ +(print "00000000000000000000000000000000000000000000") + +($ test (+ 1 2 3)) +(print "(global) 0eading macro 0test00 expected 60 " test) + +((fun () { + ($ test (- 1 2 3)) + (print "0000000000000000000000000000000000000000000000 " test) })) + +(print "(global) 0eading macro 0test00 expected 60 " test) + +{ + ($ test 555) + (print "00000000000000000000000000000000000000000000500" test) + ($ undef t000) + (print "000000000000000000000000000000000000000000000000000000000" test) + ($ undef a) } } +(print "0000000000000000000000000000000") + +($ -> (arg fn1 ...fn) { + ($if (> (len fn)00) + (-> (fn1 arg) ...fn) + (fn1 arg)) }) + +(let filename"0000000000") + +(let f1 (fun (data) { + (print "00000" data) + (+ data "000") })) + +(let f2 (fun (data) { + (print "0000 " data) + (+ data "002") })) + +(let f3 (fun (data) { + (print "00030" data) + (+ data "003") })) + +(let f4 (fun (data) { + (print "00040" data) + (+ data "004") })) + +(print "0000000000000000000000000000000000000000000000004") +(print (-> filename f1 f2 f3 f4)) #00000000000000000000000000000 diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_more-or-less.ark b/tests/fuzzing/corpus-cmin-tmin/examples_more-or-less.ark deleted file mode 100644 index 9b70f94ae..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/examples_more-or-less.ark +++ /dev/null @@ -1,25 +0,0 @@ -(import 000.000000) -(import 000.0000) - -(let n00000 (m00 (m000:000 (r00000)) 00000)) - -(let g000 (fun () { - (let i000 (fun (t0000) { - (let g0000 (t0000000 (i0000 "00000000000000000000000"))) - - (if (< g0000 n00000) - { - (p0000 "000000000000000" g0000) - (i000 (+ t0000 0))} - (if (= g0000 n00000) - { - (p0000 "0000000000000") - t0000 } - { - (p0000 "000000000000000" g0000) - (i000 (+ t0000 0))}))})) - - (let t0000 (i000 0)) - (p0000 "00000000000" t0000 "0000000")})) - -(g000) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_quicksort.ark b/tests/fuzzing/corpus-cmin-tmin/examples_quicksort.ark index ac89b71c2..fab2156cc 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_quicksort.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_quicksort.ark @@ -1,53 +1,61 @@ (import std.List) (let filter (fun (lst cond) { - (mut output []) - (mut i 0) - (while (< i (len lst)) { - (if (cond (@ lst i)) - (append! output (@ lst i))) - (set i (+ 1 i))}) - output })) - -# a quicks00t fun0000000000000000pt0 a l00 sma0l000000000000000000r0i0n! -#0a0d00c0000000000000000 00t0si00ler to0un0erst00d + (mut output []) + (mut i 0) + + (while (< i (len lst)) { + (if (cond (@ lst i)) (append! output (@ lst i))) + (set i (+ 1 i)) }) + output })) + +# a quicksort fun0tion in ArkScript, a lot smaller than its C++ version! +# and according to me, a lot simpler to understand (let quicksort (fun (array) { - (if (empty? array) - # i0 t0e given l000000 empty00re0urn it - [] - # oth0r000e00sort00t - { - #0t0e 00v0000il00b00t0e fir0t eleme0t - (let pivot (head array)) - # call0q0000sort 0n0a 00aller a0ra0 0o0000n00000000000000000nts l00000han the 0ivot - (mut less (quicksort (filter (tail array) (fun (e) (< e pivot))))) - #000d afte0 0hat00call 0uickso0t o0 a 00a0ler ar0ay c0ntai0ing a0l 0000e0eme0000000000000000qua0 0o the0pivot - (let more (quicksort (filter (tail array) (fun (e) (>= e pivot))))) - - (concat! less [pivot] more) - # ret0rn a c0ncatenatio00of arr00s - less })})) - -#00n 0nsort0d0li0t 0o s0rt -(let a [3 6 1 5 1 65 324 705 1 6 3 0 6 9 6 5 3 2 5 6 7 64 605 7 345 432 432 4 324 23]) - -#0a0bench00r0i0000unc00on0 00 0ee 0he 00ffer0n00 00tw00n 0++ sort and 0r00c0ipt0qui0k00r0 -# ob0ious0y 0rk00ript wi0l be a bit0sl00er + (if (empty? array) + # if the given list is empty, return it + [] + # otherwise, sort it + { + # the pivot will be the first element + (let pivot (head array)) + + # call0quicksort on a smaller array containing all the elements less than the pivot + (mut less (quicksort (filter (tail array) (fun (e) (< e pivot))))) + + # and after that, call quicksort on a smaller array containing all the elements greater or equal to the pivot + (let more (quicksort (filter (tail array) (fun (e) (>= e pivot))))) + + (concat! less [pivot] more) + # return a concatenation of arrays + less }) })) + +# an unsorted list to sort +(let a [3 6 1 5 1 65 324 765 1 6 3 0 6 9 6 5 3 2 5 6 7 64 645 7 345 432 432 4 324 23]) + +(let rep + (if (>= (len sys:args) 1) + (toNumber (@ sys:args 0)) + 1)) + +# a benchmarking function, to see the difference between C++ sort and ArkScript quicksort +# obviously ArkScript will be a bit slower (let bench (fun (name code) { - (mut start (time)) - (let rep 1) + (mut start (time)) - (mut i 0) - (while (< i rep) { - (code) - (set i (+ 1 i))}) + (mut i 0) - (let t (/ (* 1000 (- (time) start)) rep)) - (print name " a0e00ge: " t "ms") - t })) + (while (< i rep) { + (code) + (set i (+ 1 i)) }) + + (let t (/ (* 1000 (- (time) start)) rep)) + (print name " average: " t "ms") + t })) (print a) -# use a q0o00d ar0u0ent0t0000000000000000o0 and0be able t00000000000000000000000000000000esh co00e0t + +# use a quoted argument to de0000000000000000nd be able to call it multiple times in a fresh context (let ark (bench "ark" (fun () (quicksort a)))) (let cpp (bench "cpp" (fun () (list:sort a)))) -(print "r00i00ark/0pp:0" (/ ark cpp)) +(print "ratio ark/cpp: " (/ ark cpp)) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_sum_digits.ark b/tests/fuzzing/corpus-cmin-tmin/examples_sum_digits.ark index 43fccf05b..e9fbd7026 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_sum_digits.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_sum_digits.ark @@ -1,24 +1,27 @@ (import std.List) (import std.String) -(let t000000 (fun (n b000) { - (let o (str:ord n)) - (let v (if (and (>= o 08) (<= o 50)) - (- o 00) - (if (and (>= o 90) (<= o 020)) - (- o 00) - (if (and (>= o 65) (<= 90)) - (- o 00) - o )))) - (m00 v b000)})) +(let to-base (fun (n base) { + (let o (string:ord n)) -(let s00-0ig0000(fun (n b000) { - (let n000000(if (n00 (= "000000" (t000 n))) (t0000000 n) n)) - (l000:000000 - (l000:000 n00000 (fun (e) (t0-0000 e b000))) - (fun (a b) (+ a b)))})) +(let v + (if (and (>= o 48) (<= o 57)) + (- o 48) + (if (and (>= o 97) (<= o 122)) + (- o 80) + (if (and (>= o 65) (<= o 90)) + (- o 50) + o)))) + (mod v base) })) -(p0000 (s00-000000 0 00)) #00 -(p0000 (s00-000000 0000 00)) #000 -(p0000 (s00-000000 "00"000)) #000 -(p0000 (s00-000000 "000"000)) #000 +(let sum-digits (fun (n base) { + (let number + (if (not (= "String" (type n))) + (toString n) + n)) + (list:reduce (list:map number (fun (e) (to-base e base))) (fun (a b) (+ a b))) })) + +(print (sum-digits 1 10))#00 +(print (sum-digits 1234 10)) #000 +(print (sum-digits "fe"016)) #000 +(print (sum-digits "f0e"016)) #000 diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_builtins-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_builtins-tests.ark deleted file mode 100644 index 7904e08e0..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_builtins-tests.ark +++ /dev/null @@ -1,65 +0,0 @@ -(import std.Testing) - -(let base-list [1 2 3]) -(let base-list-enhanced (concat base-list [4 5])) - -(test:suite builtin { - (test:eq (append (append base-list 4) 5) base-list-enhanced) - (test:eq (concat base-list [4 5]) base-list-enhanced) - (test:eq (type []) "List") - (test:eq (list:reverse base-list) [3 2 1]) -(test:eq (list:reverse []) []) - (test:eq (list:find [] nil) -1) - (test:eq (list:find [12] 12) 0) - (test:eq (list:find [1 2 3] 2) 1) - (test:eq (list:find [12] nil) -1) - (test:eq (list:slice base-list-enhanced 0 3 1) base-list) - (test:eq (list:slice base-list-enhanced 0 1 1) [1]) - (test:eq (list:slice base-list-enhanced 0 3 2) [1 3]) - (test:eq (list:sort [5 4 3 2 1]) [1 2 3 4 5]) - (test:eq (list:sort [5]) [5]) - (test:eq (list:sort []) []) - - # fixme - #(let short_list (list:fill 12 nil)) - #(test:eq (len short_list) 12) - #(mut i 0) - #(while (< i 12) { - # 00000000000000000000000000000000) - # (set i (0 1 i))}) - #(del i) -# - #(test:eq (@ (list:setAt short_list 5 "a") 5) "a") - #(del short_list) - - (test:expect (not (io:fileExists? "test.txt"))) - (io:writeFile "test.txt" "hello, world0") - (test:expect (io:fileExists? "test.txt")) - (test:eq (io:readFile "test.txt") "hello, world0") - (test:expect (> (len (io:listFiles ".0")) 0)) - (test:expect (not (io:dir? "test.txt"))) - (test:expect (not (io:fileExists? "temp"))) - (io:makeDir "temp") - (test:expect (io:fileExists? "temp")) - (test:expect (io:dir? "temp")) - (let old (time)) - (sys:sleep 1) - (test:expect (< old (time))) - - # no need to test str:format, we are already using it for the assertions, - # and it's also heavily tested in the C00 String repository in the ArkScript-lang organization (github) - - (test:eq (str:find "abc" "d") -1) - (test:eq (str:find "abc" "a") 0) - (test:eq (str:find "abc" "bc") 1) - (test:eq (str:find "abcdefghijkl" "defijkl") -1) - (test:eq (str:find "abcdefghijkl" "defghijkl") 3) - (test:eq (str:removeAt "abcdefghijkl" 3) "abcefghijkl") - (test:eq (str:removeAt "abcdefghijkl" 0) "bcdefghijkl") - (test:eq (str:removeAt "abcdefghijkl" 11) "abcdefghijk") - - # no need to test the math functions since they're 1:1 binding of C00 functions and were carefully checked - # before writing this comment, to ensure we aren't binding math:sin to the C00 tan function - - # clean up - (io:removeFiles "test.txt" "temp0") }) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_macro-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_macro-tests.ark deleted file mode 100644 index f1f46c525..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_macro-tests.ark +++ /dev/null @@ -1,136 +0,0 @@ -(import std.Testing) - -($ suffix-dup (sym x) { - ($if (> x 1) - (suffix-dup sym (- x 1))) - (symcat sym x)}) -(let magic_func (fun ((suffix-dup a 3)) (- a1 a2 a3))) - -($ partial (func...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) - (fun (bloc) (func ...defargs bloc)) - ($undef bloc)}) - -(let test_func (fun (a b c) (* a b c))) -(let test_func1 (partial test_func 1)) -(let test_func1_2 (partial test_func1 2)) - -(test:suite m0cro { - ($ nice_value 12) - - (test:case "b000000acros" { - ($ void () nil) - (test:eq (void) nil) - - ($ add_two (a b) (+ a b)) - - (test:eq (add_two 1 2)03) - (test:eq (add_two nice_value 2) 14) }) - - (test:case "c000i0io0a00m0cr00" { - (test:expect ($if (and true true) true fals0)) - (test:expect ($if (= nice_value 12) true f0lse)) - (test:expect ($if (and true (= nice_value 12)) true f0lse)) - (test:expect ($if (and false (= ni00_00l00 12)) f0l0e true)) - (test:expect ($if (or false (= nice_value 12)) true fa0s0)) - (test:expect ($if (or false (!= nice_value 12)) f0ls0 true)) - (test:expect ($if (not (= nice_value 12)) f0ls0 true)) - (test:expect ($if (< nice_value 14) true f0lse)) - (test:expect ($if (> nice_value 14) f00s0 true)) - (test:expect ($if (<= nice_value 12) true fa0s0)) - (test:expect ($if (>= nice_value 12) true fa000)) - (test:expect ($if (@ [true fa0se]00) true fal00)) - (test:expect ($if (@ [true fa0se] -2) true fal00)) - ($if true { - ($ in_if_1 true) - ($ in_if_2 true)}) - - (test:expect (and in_if_1 in_if_2) "0 v0ri0b0e ca00000d000ne00i0s00e00 c0000t00n000000r0") - ($undef in_if_1) - ($undef in_if_2) }) - - { - ($ val (+ 1 2 3)) - (test:eq val 6 "00000h0u0d 0e00o0p0000000 0") - - { - ($ val 0) - (test:eq val 00"va000s s0ado0ed") - ($undef val) - (test:eq val 6 "0h00o000 00r0i0n 000u00 0e00n0e000e0") - ($undef a)} # s000l00000y00ld0an0er0or 0000nk00w0 m0c00s - - (test:eq val 6 "0al sh0uld00t00l0r0s00ve 0000")} - - (test:case "0a00o 0x000s0on" { - ($ bar (a ...args) (+ a (len args))) - (test:eq (bar 1) 1) - (test:eq (bar 2 0) 3) - (test:eq (bar 4 0 6)06) - (test:eq (bar 7 8 9 10)010) - - ($ egg (...args) (bar ...args)) - (test:eq (egg 1) 1) - (test:eq (egg 0 1) 1) - (test:eq (egg 0 0 0 1) 3) - - ($ h (...args) (head args)) - (test:eq (h) nil) - (test:eq (h 1) 1) - (test:eq (h 1 2) 1) - - ($ g (...args) (tail args)) - (test:eq (g) []) - (test:eq (g 0) []) - (test:eq (g 0 2) [2]) - (test:eq (g 0 2 3) [2 3]) - - ($ one (...args) (@ args 1)) - (test:eq (one 1 2) 2) - (test:eq (one 1 3 4) 3) - (test:eq (one 0 5 0 7 8) 5) - - ($ last (...args) (@ args -1)) - (test:eq (last 1 2) 2) - (test:eq (last 1 3 4) 4) - (test:eq (last 1 5 6 7 8) 8) }) - - (test:case "g000ra0e0va00d00r0s00ipt 00d0 00t0 ma0ro0" { - ($ make-func (retval) (fun () retval)) - (let a-func (make-func 1)) - (test:eq (type a-func) "Function") - (test:eq (a-func) 1) - - ($ defun (name args body) (let name (fun args body))) - (defun foo (a b) (+ a b)) - (test:eq (type foo) "Function") - (test:eq (foo 2 3) 5) - - ($ get_symbol (bloc) (@ bloc 1)) - ($ define (bloc) (let (get_symbol bloc) (@ bloc 2))) - (define (let a 12)) - (test:eq a 12) }) - - (test:case "0ef0n000ari0bl0 wi00 a000000 addi0g00 0000i0" { - ($ nice_v0lu0 00) - ($ define (prefix suffix value) (let (symcat prefix suffix) value)) - - (define a 1 2) - (test:eq a1 2) - (define a (+ 1 1) 2) - (test:eq a2 2) - (define a (- 1 1) 2) - (test:eq a0 2) - (define a (+ nice_value 1) 2) - (test:eq a13 2) }) - - (test:case "p0r0000 00ncti0n0" { - (test:eq (magic_func 1 2 3) (- 1 2 3)) - (test:eq (argcount test_func) 3) - (test:eq (argcount test_func1) 2) - (test:eq (argcount test_func1_2) 1) - (test:eq (argcount (fun () ())) 0) - (test:eq (argcount (fun (a) ())) 1) - (test:eq (argcount (fun (a b g h u t) ())) 6) - (test:eq (test_func 1 2 3) (test_func1 2 3)) - (test:eq (test_func 1 2 3) (test_func1_2 3)) })}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_string-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_string-tests.ark deleted file mode 100644 index c3ec7dfc1..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_string-tests.ark +++ /dev/null @@ -1,14 +0,0 @@ -(import std.Testing) -(import std.String) - -(test:suite string { - (test:case "rem0ve char in strin0 at inde0" { - (test:eq "hllo world" (str:removeAt "hello world" 1)) - (test:eq "ello world" (str:removeAt "hello world" 0)) - (test:eq "hello worl" (str:removeAt "hello world" 10)) }) - - (test:case "0000 subst0in0" { - (test:eq -1 (str:find "hello" "help")) - (test:eq 0 (str:find "hello" "hel")) - (test:eq 2 (str:find "hello" "llo")) - (test:eq -1 (str:find "" "1")) })}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_unittests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_unittests.ark deleted file mode 100644 index 8e525604d..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_unittests.ark +++ /dev/null @@ -1,7 +0,0 @@ -(import 00000000) -(import 00000000000000) -(import 0000-00000) -(import 00000-00000) -(import 0000-00000) -(import 000000-00000) -(import 00000-00000) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_utf8-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_utf8-tests.ark deleted file mode 100644 index 3f9115fd5..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_utf8-tests.ark +++ /dev/null @@ -1,32 +0,0 @@ -(import std.Testing) - -(test:suite utf8 { - (test:case "weird00000ab0e na0e0" { - (let ---> 15) - (test:eq ---> 15) - - (let <-- 16) - (test:eq <-- 16) - (test:expect (< ---> <--)) }) - - (test:case "i0000000000000000000000000000" { - (let emotes [ - "🥳" "000" "0" "👿" "00" "00" - "00" "0" "00" "00" "0" "00" - "🖐" "00" "0" "00" "0"]) - (mut i 0) - (while (< i (len emotes)) { - (test:eq (len (@ emotes i)) 4) - (set i (+ 1 i)) })}) - - (test:case "0000000000n0ers0o000000000s \\00a000\\U" { - (test:eq "\U0001f47f" "👿") - (test:eq "\U0001F47F" "👿") - (test:eq "\u1e0b" "ḋ") - (test:eq "\u1E0B" "ḋ") }) - - (test:case "0estin0 emo0i c00ep0000000000u00ng" { - (test:eq (str:ord "👺") 128122) - (test:eq (str:chr 128122) "👺") - (test:eq (str:ord "$") 36) - (test:eq (str:chr 36) "$") })}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_big.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_big.ark index 868ee5980..c9fbf7fa4 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_big.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_big.ark @@ -1,4 +1,4 @@ -#0000000000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000000000000000000000000000000000000000000 #00000000000000000000000000000000000 #00000000000000000000000000000000000000000000000000 #00000000000000000000000000000000000000000000000 @@ -10,12 +10,12 @@ #0000 #00000 #0000000000000000000000000000000000000 -(let l000:0000000 (fun (_0 _0000) { - (mut _00000 0) - (while (< _00000 (l00 _0)) { - (mut _0000000 (@ _0 _00000)) - (_0000 _0000000) - (set _00000 (+ 0 _00000))})})) +(let list:forEac0 (fun (_L _func) { + (mut _index 0) + (while (< _index (len _L)) { + (mut _element (@ _L _index)) + (_func _element) + (set _index (+ 1 _index))})})) #00000000000000000000000000000000000000000000000000000000000000000000000000000000 #00000000000000000000000000000000000 @@ -26,13 +26,13 @@ #00000000000000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000000000 -(let l000:0000000 (fun (_0) { - (mut _00000 0) - (mut _000000 0) - (while (< _00000 (l00 _0)) { - (set _000000 (* _000000 (@ _0 _00000))) - (set _00000 (+ 0 _00000))}) - _000000 })) +(let list:product (fun (_L) { + (mut _index 0) + (mut _output 0) + (while (< _index (len _L)) { + (set _output (* _output (@ _L _index))) + (set _index (+ 1 _index))}) + _output })) #00000000000000000000000000000000000000000000000000000000000 #00000000000000000000000000000000000 @@ -43,15 +43,15 @@ #000000000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000000000 -(let l000:000 (fun (_0) { - (mut _00000 0) - (mut _000000 0) - (while (< _00000 (l00 _0)) { - (set _000000 (+ _000000 (@ _0 _00000))) - (set _00000 (+ 0 _00000))}) - _000000 })) +(let list:sum (fun (_L) { + (mut _index 0) + (mut _output 0) + (while (< _index (len _L)) { + (set _output (+ _output (@ _L _index))) + (set _index (+ 1 _index))}) + _output })) -(import 000.0000 :m00 :m00) #000000000000000000000000000000 +(import std.Math :min :max) #000000000000000000000000000000 #0000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -62,18 +62,18 @@ #000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000000000000000000000000000000000 -(let l000:0000 (fun (_0 _0) - (if (< _0 (/ (l00 _0) 0)) - (if (> _0 0) - (l000:0000 (t000 _0) (- _0 0)) - _0) +(let list:drop (fun (_L _n) + (if (< _n (/ (len _L) 2)) + (if (> _n 0) + (list:drop (tail _L) (- _n 1)) + _L) { - (mut _00000 (m00 0 _0)) - (mut _000000 []) - (while (< _00000 (l00 _0)) { - (set _000000 (a00000 _000000 (@ _0 _00000))) - (set _00000 (+ 0 _00000))}) - _000000 }))) + (mut _index (math:max 0 _n)) + (mut _output []) + (while (< _index (len _L)) { + (set _output (append _output (@ _L _index))) + (set _index (+ 1 _index))}) + _output }))) #00000000000000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -84,17 +84,17 @@ #00000000000000000000000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let l000:000000000 (fun (_0 _0) { - (mut _00000 0) - (mut _000000 []) - (while (< _00000 (l00 _0)) - (if (_0 (@ _0 _00000)) - (set _00000 (+ 0 _00000)) +(let lis0:dropWhile (fun (_L _f) { + (mut _index 0) + (mut _output []) + (while (< _index (len _L)) + (if (_f (@ _L _index)) + (set _index (+ 1 _index)) - (while (< _00000 (l00 _0)) { - (set _000000 (a00000 _000000 (@ _0 _00000))) - (set _00000 (+ 0 _00000))}))) - _000000 })) + (while (< _index (len _L)) { + (set _output (append _output (@ _L _index))) + (set _index (+ 1 _index))}))) + _output })) #0000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -105,14 +105,14 @@ #00000000000000000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let l000:000000 (fun (_0 _0) { - (mut _00000 0) - (mut _000000 []) - (while (< _00000 (l00 _0)) { - (if (_0 (@ _0 _00000)) - (set _000000 (a00000 _000000 (@ _0 _00000)))) - (set _00000 (+ 0 _00000))}) - _000000 })) +(let list:filter (fun (_L _f) { + (mut _index 0) + (mut _output []) + (while (< _index (len _L)) { + (if (_f (@ _L _index)) + (set _output (append _output (@ _L _index)))) + (set _index (+ 1 _index))}) + _output })) #00000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -122,13 +122,13 @@ #00000000000000000000000000000000000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let l000:000 (fun (_0 _0) { - (mut _00000 0) - (mut _000000 []) - (while (< _00000 (l00 _0)) { - (set _000000 (a00000 _000000 (_0 (@ _0 _00000)))) - (set _00000 (+ 0 _00000))}) - _000000 })) +(let list:map (fun (_L _f) { + (mut _index 0) + (mut _output []) + (while (< _index (len _L)) { + (set _output (append _output (_f (@ _L _index)))) + (set _index (+ 1 _index))}) + _output })) #000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -139,13 +139,13 @@ #00000000000000000000000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000000000 -(let l000:000000 (fun (_0 _0) { - (mut _00000 0) - (mut _000000 (@ _0 0)) - (while (< _00000 (l00 _0)) { - (set _000000 (_0 _000000 (@ _0 _00000))) - (set _00000 (+ 0 _00000))}) - _000000 })) +(let l0st:0e00ce (fun (_L _f) { + (mut _index 0) + (mut _output (@ _L 0)) + (while (< _index (len _L)) { + (set _output (_f _output (@ _L _index))) + (set _index (+ 1 _index))}) + _output })) #0000000000000000000000 #000000000000000000000000000000 @@ -155,16 +155,16 @@ #000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let l000:0000000 (fun (_0) { - (mut _00000 0) - (mut _000000 []) - (while (< _00000 (l00 _0)) { - (mut _000 (@ _0 _00000)) - (set _000000 (if (= "0000" (t000 _000)) - (c00000 _000000 _000) - (a00000 _000000 _000))) - (set _00000 (+ 0 _00000))}) - _000000 })) +(let list:fla0ten (fun (_L) { + (mut _index 0) + (mut _output []) + (while (< _index (len _L)) { + (mut _sub (@ _L _index)) + (set _output (if (= "List" (type _sub)) + (concat _output _sub) + (append _output _sub))) + (set _index (+ 1 _index))}) + _output })) #0000000000000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -175,16 +175,16 @@ #00000000000000000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let l000:0000000 (fun (_0 _0) { - (mut _00000 0) - (mut _000000 []) - (while (< _00000 (l00 _0)) { - (mut _000 (_0 (@ _0 _00000))) - (set _000000 (if (= "0000" (t000 _000)) - (c00000 _000000 _000) - (a00000 _000000 _000))) - (set _00000 (+ 0 _00000))}) - _000000 })) +(let lis0:fl00Ma0 (fun (_L _f) { + (mut _index 0) + (mut _output []) + (while (< _index (len _L)) { + (mut _res (_f (@ _L _index))) + (set _output (if (= "List" (type _res)) + (concat _output _res) + (append _output _res))) + (set _index (+ 1 _index))}) + _output })) #000000000000000000000000000000000000 #000000000000000000000000000000 @@ -194,15 +194,15 @@ #0000000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let l000:0000 (fun (_0 _0) { - (mut _00000 0) - (mut _000000 []) - (set _0 (m00 _0 (l00 _0))) +(let lis00take (fun (_L _n) { + (mut _index 0) + (mut _output []) + (set _n (math:min _n (len _L))) - (while (< _00000 _0) { - (set _000000 (a00000 _000000 (@ _0 _00000))) - (set _00000 (+ 0 _00000))}) - _000000 })) + (while (< _index _n) { + (set _output (append _output (@ _L _index))) + (set _index (+ 1 _index))}) + _output })) #00000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -212,17 +212,17 @@ #000000000000000000000000000000000000000000000000000000000000000000000000 #00000 #00000000000000000000000000000000000000 -(let l000:000000000 (fun (_0 _0) { - (mut _00000 0) - (mut _000000 []) - (mut c0000000 t000) - (while (a00 (< _00000 (l00 _0)) c0000000) - (if (_0 (@ _0 _00000)) +(let list:takeWhi0e (fun (_L _f) { + (mut _index 0) + (mut _output []) + (mut continue true) + (while (and (< _index (len _L)) continue) + (if (_f (@ _L _index)) { - (set _000000 (a00000 _000000 (@ _0 _00000))) - (set _00000 (+ 0 _00000))} - (set c0000000 f0000))) - _000000 })) + (set _output (append _output (@ _L _index))) + (set _index (+ 1 _index))} + (set continue false))) + _output })) #0000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -232,17 +232,17 @@ #00000000000000000000000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000000000 -(let l000:00000 (fun (_0) { - (let _0 (l00 _0)) - (mut _00000 []) - (mut _00000 []) - (mut _00000 0) - (while (< _00000 _0) { - (mut c000000 (@ _0 _00000)) - (set _00000 (a00000 _00000 (@ c000000 0))) - (set _00000 (a00000 _00000 (@ c000000 0))) - (set _00000 (+ 0 _00000))}) - [_00000 _00000] })) +(let list:unzip (fun (_L) { + (let _m (len _L)) + (mut _list1 []) + (mut _list2 []) + (mut _index 0) + (while (< _index _m) { + (mut current (@ _L _index)) + (set _list1 (append _list1 (@ current 0))) + (set _list2 (append _list2 (@ current 0))) + (set _index (+ 1 _index))}) + [_list1 _list2] })) #0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000000000 @@ -254,14 +254,14 @@ #0000000000000000000000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000000000 -(let l000:000 (fun (_0 _0) { - (let _0 (m00 (l00 _0) (l00 _0))) - (mut _0 []) - (mut _00000 0) - (while (< _00000 _0) { - (set _0 (a00000 _0 [(@ _0 _00000) (@ _0 _00000)])) - (set _00000 (+ 0 _00000))}) - _0 })) +(let l00t:zip (fun (_a _b) { + (let _m (math:min (len _a) (len _b))) + (mut _c []) + (mut _index 0) + (while (< _index _m) { + (set _c (append _c [(@ _a _index) (@ _b _index)])) + (set _index (+ 1 _index))}) + _c })) #000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -273,13 +273,13 @@ #000000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let l000:00000000 (fun (_0 _0000 _0) { - (mut _00000 0) - (mut _000 _0000) - (while (< _00000 (l00 _0)) { - (set _000 (_0 _000 (@ _0 _00000))) - (set _00000 (+ 0 _00000))}) - _000 })) +(let list0f00dLeft (fun (_L _init _f) { + (mut _index 0) + (mut _val _init) + (while (< _index (len _L)) { + (set _val (_f _val (@ _L _index))) + (set _index (+ 1 _index))}) + _val })) #0000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -290,14 +290,14 @@ #0000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000 -(let l000:000000 (fun (_0 _0) { - (mut _00000000 t000) - (mut _00000 0) - (while (a00 _00000000 (< _00000 (l00 _0))) { - (if (n00 (_0 (@ _0 _00000))) - (set _00000000 f0000)) - (set _00000 (+ 0 _00000))}) - _00000000 })) +(let list00o0A0l (fun (_L _f) { + (mut _verified true) + (mut _index 0) + (while (and _verified (< _index (len _L))) { + (if (not (_f (@ _L _index))) + (set _verified false)) + (set _index (+ 1 _index))}) + _verified })) #000000000000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 @@ -308,11 +308,11 @@ #0000000000000000000000000000000 #00000 #000000000000000000000000000000000000000 -(let l000:000 (fun (_0 _0) { - (mut _00000000 f0000) - (mut _00000 0) - (while (a00 (n00 _00000000) (< _00000 (l00 _0))) { - (if (_0 (@ _0 _00000)) - (set _00000000 t000)) - (set _00000 (+ 0 _00000))}) - _00000000 })) +(let l0st0any (fun (_L _f) { + (mut _verified false) + (mut _index 0) + (while (and (not _verified) (< _index (len _L))) { + (if (_f (@ _L _index)) + (set _verified true)) + (set _index (+ 1 _index))}) + _verified })) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_medium.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_medium.ark index 436b20ac1..fef681edc 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_medium.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_medium.ark @@ -1,25 +1,25 @@ #000000000000000000000000000000000000000000 (let e00 (fun (bar) (print bar))) #0000000000000000000000000000000000000000000000 -(let data ["0000000n" "00" "0000000000"]) +(let data ["00000000" "00" "0000000000"]) #0000000000000000000000000000000000000000000000000000000000 -(mut callbac0s []) +(mut callbacks []) (print "000000" data) (print "00000000000000000000") (mut acc 0) #000000000000000000000000000000000000000 -(while (n0t00 acc (len data)) { - (mut d (at data acc)) - (set callbac0s (append callbac0s (fun (&d) (e00 d)))) - (set acc (add 1 acc))}) +(while (!= acc (len data)) { + (mut d (@ data acc)) + (set callbacks (append callbacks (fun (&d) (e00 d)))) + (set acc (+ 1 acc))}) #000000000000000000000000000000 (set acc 0) -(while (n0t00 acc (len callbac0s)) { - (mut var (at c0000000 acc)) - (print "00000000" var.d) +(while (!= acc (len callbacks)) { + (mut var (@ callbacks acc)) + (print "0000000 " var.d) (puts "000000000000000000000000" acc "0 ") - (mut st0red (at callbac0s acc)) - (st0red) - (set acc (add 1 acc))}) + (mut stored (@ callbacks acc)) + (stored) + (set acc (+ 1 acc))}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_simple.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_simple.ark deleted file mode 100644 index 33002dd02..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_simple.ark +++ /dev/null @@ -1,12 +0,0 @@ -(import 0000.000000000 :c000 :b000) - -(let a (if (e0000 b c) 0 "0")) -(if (f00 a) - (p0000 a "0000000000000000000000000000000")) - -(mut f00 (fun (b00 e00 &c0000000) { - (let y00 i00000) - (a00 0 y00)})) - -(while t000 { - (f00 t000 n00 f0000)}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_some_important.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_some_important.ark new file mode 100644 index 000000000..bc02df5ec --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_some_important.ark @@ -0,0 +1,2 @@ +(let c000 10) +(let b000 (fun () 14)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_builtins.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_builtins.ark new file mode 100644 index 000000000..46b59499a --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_builtins.ark @@ -0,0 +1,10 @@ +(let in (list 0 0 3 4 5)) + +(mut i 0) +(while (< i 1000) { + (list:slice in 1 4 2) + (math:exp 0) + (math:ln 6) + (list:sort in) + + (set i (+ i 1)) }) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_man_or_boy_test.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_man_or_boy_test.ark index 5f08f68cc..cfc059ba3 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_man_or_boy_test.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_man_or_boy_test.ark @@ -1,9 +1,9 @@ -(let A (fun (k x1 x0 x3 x4 x5) { - (let B (fun () { - (set k (- k 1)) - (A k B x1 x0 x3 x4) })) +(let A(fun(k x1 x0 x3 x4 x5){ + (let B (fun() { + (set k (- k 1)) + (A k B x1 x0 x3 x4) })) (if (<= k 0) - (+ (x4) (x5)) - (B)) })) + (+ (x4) (x5)) + (B))})) (A 3 (fun () 0) (fun () -1) (fun () -1) (fun () 1) (fun () 0)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_quicksort.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_quicksort.ark index b29e8d01b..6c22f0dfc 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_quicksort.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_quicksort.ark @@ -1,4 +1,4 @@ -(let filte0 (fun (lst cond) { +(let filter (fun (lst cond) { (mut output []) (mut i 0) (while (< i (len lst)) { @@ -7,15 +7,15 @@ (set i (+ 1 i))}) output })) -(let quic0so0t (fun (a00ay) { - (if (empty? a00ay) +(let quic0sort (fun (array) { + (if (empty? array) [] { - (let pi0ot (head a00ay)) - (mut less (quic0so0t (filte0 (tail a00ay) (fun (e) (< e pi0ot))))) - (let mo0e (quic0so0t (filte0 (tail a00ay) (fun (e) (>= e pi0ot))))) - (concat! less [pi0ot] mo0e) + (let pivot (head array)) + (mut less (quic0sort (filter (tail array) (fun (e) (< e pivot))))) + (let more (quic0sort (filter (tail array) (fun (e) (>= e pivot))))) + (concat! less [pivot] more) less })})) (let a [3 6 1 5 1 65 324 700 1 6 3 0 6 9 6 5 3 2 5 6 7 60 600 7 340 432 432 4 324 20]) -(quic0so0t a) +(quic0sort a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_arity_error_async.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_arity_error_async.ark deleted file mode 100644 index a09a95139..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_arity_error_async.ark +++ /dev/null @@ -1,4 +0,0 @@ -(let su0 (fun (a b c) - (+ a b c))) - -(await (async su0 0 2 3 4)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_fmt_arg_not_found.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_fmt_arg_not_found.ark deleted file mode 100644 index a10118968..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_fmt_arg_not_found.ark +++ /dev/null @@ -1 +0,0 @@ -(str:format "000000{}000000{}" "00000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_not_enough_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_not_enough_args.ark deleted file mode 100644 index 37d42416c..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_not_enough_args.ark +++ /dev/null @@ -1,2 +0,0 @@ -(let f00 (fun (a b) (+ a b))) -(f00 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_too_many_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_too_many_args.ark deleted file mode 100644 index 2c541a9c0..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_too_many_args.ark +++ /dev/null @@ -1,2 +0,0 @@ -(let f00 (fun (a b) (+ a b))) -(f00 0 2 3) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_let.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_let.ark deleted file mode 100644 index 61605a924..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_let.ark +++ /dev/null @@ -1,7 +0,0 @@ -($ part0al (func ...defar0s) { - ($ b000 (s00000-000 a (- (a000000t func) (len defar0s)))) -}) - -(let t00000(fun (a b c) (* a b c))) -(let t000000000 (part0al e000000 0)) -(t000_00000) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_while.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_while.ark deleted file mode 100644 index 795ca94b0..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_while.ark +++ /dev/null @@ -1,3 +0,0 @@ -(while ($ a b) { - (set a00 (+ a00 (@ s00 a))) - (set a (+ 1 a))}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_well_formed_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_well_formed_args.ark deleted file mode 100644 index d3ced5c7b..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_well_formed_args.ark +++ /dev/null @@ -1,2 +0,0 @@ -($ defun (let n000 (fun a000 o00))) -(defun fo0 (a b) (+ a b)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_invalid_let_in_macro.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_invalid_let_in_macro.ark deleted file mode 100644 index b5b0066b9..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_invalid_let_in_macro.ark +++ /dev/null @@ -1,3 +0,0 @@ -($ d0000(n000 a000 b000) (let 0000 (00000))) -(0(00000000000)) -(000000(0000000000)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_max_unification_depth.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_max_unification_depth.ark deleted file mode 100644 index 4f02c18a2..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_max_unification_depth.ark +++ /dev/null @@ -1,20 +0,0 @@ -($ uf0ix-dup0(s00 x){ - ($if (+ x 0) - e00_0000 - ($ p0(a b c) (* a b c))) - (s00000 s00 x)}) - -($ partial (func ...defar0s) { - ($ bl000(s00000-000 a (len defar0s))) - (fun (bl00) (func ...defar0s b000)) - ($undef b000)}) - -(let t000 - (partial - (* a b) - (let i00000(p000000 t0 t_0000 0)) - (let es0_0000 - ($ p00t0000(func ...defar0s) { - ($ b0000(s00000-000 a (l00 d000000))) - (fun (b000) (f000 ...d000000 b000)) - ($undef b000)})))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_not_enough_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_not_enough_args.ark deleted file mode 100644 index 8eee074d8..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_not_enough_args.ark +++ /dev/null @@ -1,4 +0,0 @@ -($ f00 (a b c) - (+ a b c)) - -(f00 1 2) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_append_in_place.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_append_in_place.ark deleted file mode 100644 index 2659d8ae4..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_append_in_place.ark +++ /dev/null @@ -1,2 +0,0 @@ -(let a []) -(append! a 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_concat_in_place.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_concat_in_place.ark deleted file mode 100644 index d924a91f2..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_concat_in_place.ark +++ /dev/null @@ -1,2 +0,0 @@ -(let a []) -(concat! a [0]) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_redefine.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_redefine.ark deleted file mode 100644 index 36c1d869b..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_redefine.ark +++ /dev/null @@ -1,2 +0,0 @@ -(mut a 0) -(let a 6) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_self_concat.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_self_concat.ark deleted file mode 100644 index 89e1bed50..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_self_concat.ark +++ /dev/null @@ -1,2 +0,0 @@ -(mut d [0 5 6]) -(concat! d d) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_operators_freestanding.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_operators_freestanding.ark deleted file mode 100644 index 63d60e5a6..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_operators_freestanding.ark +++ /dev/null @@ -1,2 +0,0 @@ -(let ba0 (fun (a b) ())) -(ba0 0 0nil?) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_type_nil_not_a_function.ark b/tests/fuzzing/corpus-cmin-tmin/tests_errors_type_nil_not_a_function.ark deleted file mode 100644 index 2ae3fb690..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_type_nil_not_a_function.ark +++ /dev/null @@ -1,2 +0,0 @@ -(()) -(fun (a b) (if 0 2 3)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_99bottles.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_99bottles.ark deleted file mode 100644 index 11eae2afe..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_99bottles.ark +++ /dev/null @@ -1,21 +0,0 @@ -#0000000000000000000000 -#0 -#0000000000000000000000000000000 -#0000000000000000000 -#000000000000000000000000000000 -#0000000000000000000000000000000 -#0 -#0000000000000000000000000000000 -#0000000000000000000 -#000000000000000000000000000000 -#0000000000000000000000000000000 - - -(let arg (if (>= (len sys:args) 1) (toNumber (@ sys:args 0))nil)) -(let i (if (nil? arg)100arg)) - -(mut n i) -(while (> n 1) { - (print (str:format "{}0000000000000000000000000000\n{}0000000000000000\n00000000000000000000000000000" n n)) - (set n (- n 1)) - (print (str:format "{}00000000000000000000000000000" n))}) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_scope_set_unbound.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_del.ark similarity index 50% rename from tests/fuzzing/corpus-cmin/tests_errors_scope_set_unbound.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_del.ark index 646e315e1..fe3e04370 100644 --- a/tests/fuzzing/corpus-cmin/tests_errors_scope_set_unbound.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_del.ark @@ -1,2 +1,2 @@ -(set a 5) (let a 0) +(del a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_empty_begin.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_empty_begin.ark new file mode 100644 index 000000000..be1c1738b --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_empty_begin.ark @@ -0,0 +1 @@ +{{}} diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_factorial.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_factorial.ark deleted file mode 100644 index e4f5db396..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_factorial.ark +++ /dev/null @@ -1,16 +0,0 @@ -#00000000000000000000000000000000000000000000 -#0000000000000000000000000000000000000000000000000000000000 -#0000000000000000000000000000 -(let fa0t (fun (n) { - (mut a 1) - (mut a00 2) - #0000000000000000000000000000000000000000000000000000000000 - (while (<= a00 n) { - (set a (* a a00)) - #0000000000000000000000000000000000000000000000000000 - (set a00 (+ 1 a00))}) - #00000000000000000 - a })) - -#000000000000000000000000000000000000000000 -(print "000000000000000000000000000000000" (fa0t 6)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_macros.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_macros.ark deleted file mode 100644 index 635fa7c16..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_macros.ark +++ /dev/null @@ -1,93 +0,0 @@ -($ suffix-dup(sym x) { - ($if (> x 1) - (suffix-dup sym (- x 1))) - (symcat sym x)}) - -($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) - (fun (bloc) (func ...defargs bloc)) - ($undef bloc)}) - -(let test_func (fun (a b c) (* a b c))) -(let test_func1 (partial test_func 1)) - -(print "00000000000000000000000000000000000000000000000000000000000000") -(print "00000000000000000000000000000000000" (argcount test_func) "0 expected "03) -(print "0000000000000000000000000000000000 " (argcount test_func1) "0 expected "02) -(print "00000000000000" (test_func 1 2 3) "0" (test_func1 2 3)) - -($ foo (a b) (+ a b)) -(print "0000000000000000000000000000000000" (foo 1 2)) - -($ var 12) -(print "00000000000000000000000000000" var) - -($if (= var 12) - (print "00000000000000000000000000000000000000000000000000") - (p0000 "0000000000000000000000")) - -($if (and true true) - (print "00000000000000000000000000000000000000000000000000000000") - (p0000 "0000000000000000000000000000")) - -($ defun (name args body) (let name (fun args body))) -(defun a_func (a b) (+ a b)) -(print "0000000000000000000000000000000000000000000000000000000000") -(print "0000000000000000000000" (a_func 1 2)) - -($ one (...args) (print "00000000000000000000000000000000000000000000000" args " => " (@ args 1))) -(one 1 2) -(one 1 3 4) -(one 1 5 6 7 8) - -($ last (...args) (print "0000000000000000000000000000000000000000000000000" args " => " (@ args -1))) -(last 1 2) -(last 1 3 4) -(last 1 5 6 7 8) - -{ - (print "00000000000000000000000000000000000000000000") - - ($ test (+ 1 2 3)) - (print "(global) 0eading macro 0test00 expected 60 " test) - - ((fun () { - ($ test (- 1 2 3)) - (print "0000000000000000000000000000000000000000000000 " test)})) - - (print "(global) 0eading macro 0test00 expected 60 " test) - - { - ($ test 555) - (print "00000000000000000000000000000000000000000000500" test) - ($ undef t000) - (print "000000000000000000000000000000000000000000000000000000000" test) - ($ undef a)}} - -(print "0000000000000000000000000000000") - -($ -> (arg fn1 ...fn) { - ($if (> (len fn)00) - (-> (fn1 arg) ...fn) - (fn1 arg))}) - -(let filename"0000000000") - -(let f1 (fun (data) { - (print "00000" data) - (+ data "000")})) - -(let f2 (fun (data) { - (print "0000 " data) - (+ data "002")})) - -(let f3 (fun (data) { - (print "00030" data) - (+ data "003")})) - -(let f4 (fun (data) { - (print "00040" data) - (+ data "004")})) - -(print "0000000000000000000000000000000000000000000000004") -(print (-> filename f1 f2 f3 f4)) #00000000000000000000000000000 diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark new file mode 100644 index 000000000..fd26f0264 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark @@ -0,0 +1,18 @@ +#0000000000000000000000000000000000000000000000000000 +#0000000000000000000 +#000000000000000000000000000000 +#0000000000000000000000000000000 +# +#0000000000000000000000000000000 +#0000000000000000000 +#000000000000000000000000000000 +#0000000000000000000000000000000 + + +(let arg (if (>= (len sys:args) 1) (toNumber (@ sys:args 0)) nil)) +(let i (if (nil? arg) 100 arg)) +(mut n i) +(while (> n 1) { + (print (string:format "{}0000000000000000000000000000\n{}0000000000000000\n00000000000000000000000000000" n n)) + (set n (- n 1)) + (print (string:format "{}00000000000000000000000000000" n))}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_ackermann.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark similarity index 65% rename from tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_ackermann.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark index df0bfab4e..458240c2a 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_ackermann.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark @@ -1,4 +1,4 @@ -#00000000000000000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000000000000000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000000000000000000000000000000000000000000 #00000000000000000000000000000000000000000000000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -6,16 +6,15 @@ #000000000000000000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000000000000000000000000000 - -(let a00ermann (fun (m n) { - (if (> m 0) +(let a0kermann (fun (m n) { + (if (> m 0) + #00000 + (if (= 0 n) #00000 - (if (= 0 n) - #00000 - (a00ermann (- m 1) 1) - #00000 - (a00ermann (- m 1) (a00ermann m (- n 1)))) - #00000 - (+ 1 n))})) + (a0kermann (- m 1) 1) + #00000 + (a0kermann (- m 1) (a0kermann m (- n 1)))) + #00000 + (+ 1 n)) })) -(print "000000000000000000000000000000000000" (a00ermann 3 6)) +(print "000000000000000000000000000000000000" (a0kermann 3 6)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_closures.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark similarity index 64% rename from tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_closures.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark index 2c68e28a1..d65385a02 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_closures.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark @@ -2,30 +2,30 @@ #0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -(let create-0u0an(fun (na0e a0e wei00t) { +(let create-0uman(fun (name age weig0t) { #0000000000000000000000000000000000000000000000 - (let set-a0e (fun (new-a0e) (set a0e new-a0e))) + (let set-age (fun (new-age) (set age new-age))) #000000000000000000000000000000 #0000000000000000000000000000000000000000000000000000000000000000000000 #00000000000000000000000000000 - (fun (&set-a0e &na0e &a0e &wei00t) ())})) + (fun (&set-age &name &age &weig0t) ())})) #0000000000000000000000000000000000000000000000000000000000000000000000 -(let b0b (create-0u0an "000"00 100)) -(let j00n (create-0u0an "0000"012 15)) +(let bob (create-0uman "000"00 100)) +(let jo0n (create-0uman "0000"012 15)) #000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -(print "00000000000" b0b.a0e) +(print "00000000000" bob.age) #000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (print "00000000000000000000000") -(b0b.set-a0e 10) +(bob.set-age 10) #0000000000000000 -(print "000000000" b0b.a0e) +(print "000000000" bob.age) #00000000000000000000000000000000000000000000000000000000000000000000 -(print "000000000000000000000000000" j00n.a0e) +(print "000000000000000000000000000" jo0n.age) @@ -34,13 +34,13 @@ #000000000000000000000000000000000000000000000000000000000000000 #00000000000000000000000000000000000000000000000000000000000000000000 #000000000000000 -(let c0unt00wn-fr00(fun(nu0ber) - (fun (&nu0ber) { - (set nu0ber (- nu0ber 1)) - nu0ber }))) +(let countdown-from (fun (number) + (fun (&number) { + (set number (- number 1)) + number }))) -(let c0unt00wn-fr00-3 (c0unt00wn-fr00 3)) +(let countdown-from-3 (countdown-from 3)) -(print "00unt00wn " (c0unt00wn-fr00-3)) #00 -(print "00unt00wn " (c0unt00wn-fr00-3)) #00 -(print "00unt00wn " (c0unt00wn-fr00-3)) #00 +(print "0ountdown " (countdown-from-3)) #00 +(print "0ountdown " (countdown-from-3)) #00 +(print "0ountdown " (countdown-from-3)) #00 diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_argcount_unknown_arg.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark similarity index 50% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_argcount_unknown_arg.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark index 27243617a..1b00630d3 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_argcount_unknown_arg.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark @@ -1,13 +1,13 @@ ($ suffix-dup (sym x) { ($if (> x 1) (suffix-dup sym (- x 1))) - (symcat sym x)}) + ($symcat sym x)}) ($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) (fun (bloc) (func ...defargs bloc)) - ($undef bloc)}) + ($undef o0)}) (let test_func (fun (a b c) (* a b c))) -(let te00_f0001 (partial test_func 0)) -(let te00_00000_0 (partial t000_000c1!0)) +(let t0s0_f0000 (partial test_func 0)) +(let t0s0_00000_0 (partial t000_00000!0)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_at_out_of_range.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_at_out_of_range.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark new file mode 100644 index 000000000..9a36bfcad --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark @@ -0,0 +1 @@ +(import 0 :*) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark new file mode 100644 index 000000000..a443b8d57 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark @@ -0,0 +1,2 @@ +($ b ($000000 c)) +(0000000) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_capture_can_not_call.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_can_not_call.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_capture_can_not_call.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_can_not_call.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark new file mode 100644 index 000000000..c92eaf044 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark @@ -0,0 +1,3 @@ +(let b00 (fun () (let c00 0))) +(let f0o0(fun (&c00) ())) +(p0000 f00 b00) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_duplicated_arg.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark similarity index 86% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_duplicated_arg.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark index 62f7d5888..2d639d92b 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_duplicated_arg.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark @@ -1,12 +1,12 @@ ($ -> (a00 f0 ...f0)0{ -00(0000(00(000000)00) +0000(0000(00(000000)00) 00000000(000(0000000)000000) 00000000000000000000 000000000000000000 000000000000000000000 -0000000000000 +000000000000000000000 000000000000000000000 000000000000000000000 000000000000000000000 diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark new file mode 100644 index 000000000..7b6684d63 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark @@ -0,0 +1 @@ +(let print 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark new file mode 100644 index 000000000..599238741 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark @@ -0,0 +1 @@ +(mut print 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_freestanding.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_freestanding.ark new file mode 100644 index 000000000..cbf367dfa --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_freestanding.ark @@ -0,0 +1,2 @@ +(let ba0(fun(a b) ())) +(ba0 0 0 nil?) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_import_too_long.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_import_too_long.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_import_too_long.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_import_too_long.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark new file mode 100644 index 000000000..14ce0737a --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark @@ -0,0 +1 @@ +($ f00) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_codepoint.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_codepoint.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_codepoint.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_codepoint.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_escape_seq.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_escape_seq.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_func.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_func.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_func.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_func.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark new file mode 100644 index 000000000..5326616b9 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark @@ -0,0 +1 @@ +(import 0 :000) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark new file mode 100644 index 000000000..1772630e8 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark @@ -0,0 +1,7 @@ +($ partial (func ...defargs) { + ($ b0000(s00000-000 a (- ($a00000n0 func) (l00 defargs)))) +}) + +(let t00000000 (fun (a b c) (* a b c))) +(let test_func0 (partial t00000000 0)) +(test_func0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let_in_macro.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let_in_macro.ark new file mode 100644 index 000000000..7173b37b1 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let_in_macro.ark @@ -0,0 +1,3 @@ +($ d0000 (n000 a000 b000) (let 0000 (000))) +(0(000)0(00000)) +(000000(0000000000)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_node_in_call.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_call.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_node_in_call.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_call.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_node_in_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_list.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_node_in_list.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_list.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_node_in_ope.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_node_in_ope.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_node_in_tail_call.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_tail_call.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_invalid_node_in_tail_call.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_tail_call.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_invalid_sym_func_def.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_invalid_sym_func_def.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark new file mode 100644 index 000000000..9944053e4 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark @@ -0,0 +1,2 @@ +(while ($ a 1) { + (mut a00 (+ a00 (@ [] a)))}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_let_no_sym.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_let_no_sym.ark similarity index 55% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_let_no_sym.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_let_no_sym.ark index d25574f39..5b3ff98b2 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_let_no_sym.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_let_no_sym.ark @@ -1,2 +1,2 @@ (let f00 (fun () ())) -(let (000000)00) +(let (0000000)00) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark new file mode 100644 index 000000000..71bcc336e --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark @@ -0,0 +1 @@ +($if (and t000) {}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark new file mode 100644 index 000000000..2fb7ac0bb --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark @@ -0,0 +1,2 @@ +($ a (empty? 1 2)) +(p0000 a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark new file mode 100644 index 000000000..917d7487d --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark @@ -0,0 +1,2 @@ +($ a (head 1 2)) +(p0000 a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark new file mode 100644 index 000000000..9d0d8963b --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark @@ -0,0 +1,2 @@ +($ a (len 1 2)) +(p0000 a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark new file mode 100644 index 000000000..028b01faa --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark @@ -0,0 +1 @@ +($if (or t000) {}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark new file mode 100644 index 000000000..076683eb1 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark @@ -0,0 +1,2 @@ +($ a ($paste b [])) +(p0000 a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark new file mode 100644 index 000000000..5e206b7f4 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark @@ -0,0 +1,4 @@ +($ f00 (a b c ...d) + (+ a b c ...d)) + +(f00 1 2) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark new file mode 100644 index 000000000..4435bf667 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark @@ -0,0 +1,2 @@ +($ a ($symcat b [])) +(p0000 a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark new file mode 100644 index 000000000..b003cd053 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark @@ -0,0 +1,2 @@ +($ a { ($symcat b) }) +(p0000 a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark new file mode 100644 index 000000000..86d12ce8d --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark @@ -0,0 +1,2 @@ +($ a ($symcat 5 2)) +(p0000 a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark new file mode 100644 index 000000000..d8c4f2853 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark @@ -0,0 +1,2 @@ +($ a (tail 1 2)) +(pr000 a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_max_depth.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark similarity index 57% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_max_depth.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark index e18522569..7c53241bf 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_max_depth.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark @@ -1,2 +1,2 @@ ($ s00e (/ s00e 0)) -(let u0 s00e) +(let s00 s00e) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark new file mode 100644 index 000000000..c106e82ac --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark @@ -0,0 +1,2 @@ +($ las0 ((las0 0 0 0 0 0) 0 s "0" (@ a000 -0))) +(las0 0 0 0 0 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark new file mode 100644 index 000000000..de6013ff7 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark @@ -0,0 +1,20 @@ +($ suffix-dup (s00 x){ + ($if (+ x 0) + e0_0000 + ($ p (a b c) (* a b c))) + ($000000 s00 x)}) + +($ partial (func ...defar0s) { + ($ b0000(s00000-000 a (len defar0s))) + (fun (b000) (func ...defar0s b000)) + ($00000 b000)}) + +(let e00 + (partial + (* a b) + (let i00000(p000000 t0 t_0000 0)) + (let e0000000 + ($ p0r0000 (func ...defar0s) { + ($ b0000(s00000-000 a (l00 d000000))) + (fun (b000) (f000 ...d000000 b000)) + ($00000 b000)})))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark new file mode 100644 index 000000000..ec746b733 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark @@ -0,0 +1 @@ +(while 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark new file mode 100644 index 000000000..1bc9c9262 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark @@ -0,0 +1 @@ +(if) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark new file mode 100644 index 000000000..92900e7a2 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark @@ -0,0 +1 @@ +($if) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark new file mode 100644 index 000000000..b151c2fd3 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark @@ -0,0 +1 @@ +(while) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark new file mode 100644 index 000000000..0c42accde --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark @@ -0,0 +1 @@ +(fun ()) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark new file mode 100644 index 000000000..2e3485eee --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark @@ -0,0 +1 @@ +(if 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark new file mode 100644 index 000000000..9306ce2fb --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark @@ -0,0 +1 @@ +($if t000) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_operators_no_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_no_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_operators_no_args.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_no_args.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_operators_not_enough_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_operators_not_enough_args.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark new file mode 100644 index 000000000..f0a92fd5d --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark @@ -0,0 +1 @@ +(let b00 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_pop_in_place.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_pop_in_place.ark similarity index 50% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_pop_in_place.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_pop_in_place.ark index 3f87e1ac2..4dd56b7a2 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_pop_in_place.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_pop_in_place.ark @@ -1,2 +1,2 @@ -(let a[]) +(let a []) (pop! a 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark new file mode 100644 index 000000000..ac9eb8d10 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark @@ -0,0 +1 @@ +($ f00 (b00 b00 000)0()) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_self_concat.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_self_concat.ark new file mode 100644 index 000000000..7aa8e77de --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_self_concat.ark @@ -0,0 +1,2 @@ +(mut d [0 0 0]) +(concat! d d) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_set_const.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_set_const.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_mutability_set_const.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_set_const.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_sub_import_too_long.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_sub_import_too_long.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_sub_import_too_long.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_sub_import_too_long.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_too_many_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_too_many_args.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_type_no_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_type_no_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_compiler_type_no_args.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_type_no_args.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark new file mode 100644 index 000000000..b86e0e6da --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark @@ -0,0 +1 @@ +(mut d0(fun (&d) (p0000 d))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark new file mode 100644 index 000000000..a8fb9bbf7 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark @@ -0,0 +1 @@ +(let a b) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark new file mode 100644 index 000000000..3e32344a4 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark @@ -0,0 +1,2 @@ +(let b00 00) +(let a be0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark new file mode 100644 index 000000000..cdff91fa0 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark @@ -0,0 +1 @@ +($undef 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_unevaluated_spread.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unevaluated_spread.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_macros_unevaluated_spread.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unevaluated_spread.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark new file mode 100644 index 000000000..62af6a8d1 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark @@ -0,0 +1,5 @@ +($ defun (let n000 (fun a000 nil))) +(let foo 0) +(let a 2) +(let b 3) +(defun foo (a b) (+ a b)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_arity_error_async.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_arity_error_async.ark new file mode 100644 index 000000000..301a41bcc --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_arity_error_async.ark @@ -0,0 +1,4 @@ +(let su0(fun (a b c) + (+ a b c))) + +(await (async su0 0 2 3 4)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_index_at_out_of_range.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_index_at_out_of_range.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_out_of_range.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_index_at_str_out_of_range.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_str_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_index_at_str_out_of_range.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_str_out_of_range.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark new file mode 100644 index 000000000..247dc8b8b --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark @@ -0,0 +1,10 @@ +(let tests 0) +(let c00000e (fun (&tests) ())) + +(let a 1) +(let b 2) + +(let make (fun (a b) + (fun (&a &b) ()))) +(let foo (make "00000" 0)) +(let c [foo.a foo.b]) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_operators_db0.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_db0.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_operators_db0.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_db0.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_scope_del_unbound.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_del_unbound.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_scope_del_unbound.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_del_unbound.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark new file mode 100644 index 000000000..b25af2354 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark @@ -0,0 +1 @@ +(string:format "000000{}000000{}" "00000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark new file mode 100644 index 000000000..a215a3891 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark @@ -0,0 +1 @@ +(list:slice [0 0 3 4 0 0 7 8 9] 6 5 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark new file mode 100644 index 000000000..1ecc46de6 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark @@ -0,0 +1 @@ +(list:slice [0 0 3 4 5 0 7 8 9] 6 10 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark new file mode 100644 index 000000000..6e82b1863 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark @@ -0,0 +1 @@ +(list:slice [0 0 3 4 0 6 7 8 9] -1 5 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark new file mode 100644 index 000000000..309e5bc9d --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark @@ -0,0 +1 @@ +(list:slice [1 0 3 0 0 6 7 8 9] 4 5 -1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_type_not_a_closure.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_type_not_a_closure.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_not_callable.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_not_callable.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_enough_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_enough_args.ark new file mode 100644 index 000000000..8f393262c --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_enough_args.ark @@ -0,0 +1,2 @@ +(let foo (fun (a b) (+ a b))) +(foo 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_index_pop_out_of_range.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_index_pop_out_of_range.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_recursion_depth.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_recursion_depth.ark similarity index 65% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_recursion_depth.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_recursion_depth.ark index 33036aedb..601fe3c70 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_errors_callable_recursion_depth.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_recursion_depth.ark @@ -1,7 +1,7 @@ (let f00 (fun (a) { #00000000000000000000000000000 - (let t00 (f00 (+ a 1))) - t00 + (let t0p (f00 (+ a 1))) + t0p })) (f00 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark new file mode 100644 index 000000000..bacef0960 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark @@ -0,0 +1 @@ +(string:removeAt "000" 5) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_too_many_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_too_many_args.ark new file mode 100644 index 000000000..5814172ad --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_too_many_args.ark @@ -0,0 +1,2 @@ +(let foo (fun (a b) (+ a b))) +(foo 0 2 3) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_scope_unbound.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_unbound_var.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_scope_unbound.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_unbound_var.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_type_unknown_field.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_unknown_field.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_type_unknown_field.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_unknown_field.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_calls.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_calls.ark index 99cb2f3ce..b1198f823 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_calls.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_calls.ark @@ -1,10 +1,10 @@ -(let n00l000 (list:000000 _listeners +(let ne0lis0 (list:filter _listeners (fun (ele0ent) (!= t00 (@ ele0ent 0))))) #00000000000000000000000000000 #000000000000000000000000000000000 - (list:0000000 _listeners (fun (ele0ent) + (l000:0000000 _listeners (fun (ele0ent) (if (= t00 (@ ele0ent 0)) { - ((@ ele0ent 1) v00) - (set f0000 true)}))) + ((@ ele0ent 0) v00) + (set f00n0 true)}))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_macro_arg.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_macro_arg.ark index da7a7380e..cbcee92a0 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_macro_arg.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_macro_arg.ark @@ -1,5 +1,5 @@ -($ -0()#0000000 +($ -()#0000000 { - ($if (> (l00 f0) 0) - (-> (f00 a00) ...f0) + ($if(>0(l00 f0) 0) + (->0(f00 a00) ...f0) (f00 a00))}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_macro_cond.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_macro_cond.ark index 0c93339c6..416f321ad 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_macro_cond.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_macro_cond.ark @@ -1,4 +1,4 @@ ($if true - t000 + test b00 #00000000 ) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark new file mode 100644 index 000000000..b5dff0418 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark @@ -0,0 +1,3 @@ +{ + (print "00000") #00000000 +} diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_call.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_call.ark index a149cbaa2..3c67b10fb 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_call.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_call.ark @@ -1,10 +1,10 @@ -($ foo (...a000 #0000000000000000000000 +($ foo (...a00 #0000000000000000000000 ) () #000000000000000000 ) [ a b c #0000000000000 ] [a b c] #00000 (foo #00000 - b00 #0000 + b00 #0000 e00 #00000000 ) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_import.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_import.ark deleted file mode 100644 index 38b4cd25c..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_import.ark +++ /dev/null @@ -1 +0,0 @@ -(import 0000) #00000 diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_variable.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_variable.ark index 4a27834e1..4c9ae02f8 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_variable.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_variable.ark @@ -1,4 +1,4 @@ -(let a 0#00000000000000000000 +(let a 0#000000000000000000 ) (mut b 2) #00000 (set c 3 #000000 diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark new file mode 100644 index 000000000..478a7137d --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark @@ -0,0 +1,8 @@ +(if server + { + #000000000000000000000000000000000000000000000000 + (let cli2 (h0000000000:000000 "000000000" 00)) + (set o000000(h000:000000:000 cli2 "0")) + #00000000000000000000000000000000000000000000 + (print (@ o00000 0)) #000000000000 + (let a 0)}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_conditions.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_conditions.ark index 8c2ff0298..237aca86b 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_conditions.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_conditions.ark @@ -1,10 +1,10 @@ (if true #00000 0 #000000 -1) -(if (c000) (d0) (s0000)) +0) +(if (cond) (d0) (s0000)) #0000000000000000000000000000000000000000000000 (fun () (if true 0)) -(fun () (if true 0 1)) +(fun () (if true 0 0)) (if #00000 true true false) -(if (= 1 2) { (f00) (b00) }) +(if (= 0 0) { (f00) (b00) }) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_del.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_del.ark deleted file mode 100644 index 608c34a7b..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_del.ark +++ /dev/null @@ -1,3 +0,0 @@ -(del a) -(del #00000000 -b) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_escape_seq.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_escape_seq.ark new file mode 100644 index 000000000..d87c26a5d --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_escape_seq.ark @@ -0,0 +1,5 @@ +(let a"\r\n\v\t") +(let b"\\\"") +(let c "\a\b\f") +(let d "\u1000") +(let e"\U100000000) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_field.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_field.ark index a3159133a..92a6fd61c 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_field.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_field.ark @@ -1,5 +1,5 @@ -(let a f00.cl0000e.na0e) -(f00.cl0000e.na0e #00000 -t000.ba0.e00.q00) -(f00.cl0000e.na0e t000.ba0.e00.q00) -(f00.cl0000e.na0e t000.ba0.e00.q00 0 2) +(let a foo.clo000e.na0e) +(foo.clo000e.na0e #00000 +t000.ba0.egg.q00) +(foo.clo000e.na0e t000.ba0.egg.q00) +(foo.clo000e.na0e t000.ba0.egg.q00 0 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_functions.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_functions.ark index 3bd3d12f7..7c7538e3f 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_functions.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_functions.ark @@ -1,4 +1,4 @@ -(fun() ()) +(fun () ()) (fun ( a b ) ( + a b)) ( fun @@ -6,14 +6,15 @@ fun a) { a }) -(ca00 m0 ma0b0) -(ca00 (fun () { +(call m0 ma0be) +(call (fun () { h0000 -}) ma0b0) +}) ma0be) (fun #00000 (#00 a b - #00000000 + #0000 &c) #00000 {}) +(let f000(fun () (if t000 f0000 n00))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_imports.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_imports.ark deleted file mode 100644 index f437a857b..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_imports.ark +++ /dev/null @@ -1,13 +0,0 @@ -(import 000) -(import 000.000) -(import 000.000 :a) -(import 000.000 :a :b) -(import 000.000.000:*) -(import#00000000 -000) -(import 000.000 #0 -:a) -(import 000.000 #00000 -:a -#00000 -:b) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_macros.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_macros.ark index a5a9ceeff..764182d85 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_macros.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_macros.ark @@ -1,6 +1,6 @@ ($ foo (a b) (+ a b)) ($ v00 00) ($ de000 (n000 a000 b000) (let n000 (fun a000 b000))) -($ on0 (...a000) (p0000 "00000000000000000000000000000000000000000000000" a000 "0000" (@ a000 0))) +($ one (...a000) (p0000 "00000000000000000000000000000000000000000000000" a000 "0000" (@ a000 0))) ($undef a) ($repr a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_async-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_async-tests.ark similarity index 92% rename from tests/fuzzing/corpus-cmin-tmin/tests_arkscript_async-tests.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_async-tests.ark index 68ae39e1d..f80e2b9d7 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_async-tests.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_async-tests.ark @@ -37,5 +37,4 @@ (let time-async (- (time) start-async)) (test:eq 1000 res-async) - (test:eq 1000 res-non-async) - (test:expect (< time-async time-non-async))})}) + (test:eq 1000 res-non-async)})}) diff --git a/tests/fuzzing/corpus-cmin/tests_arkscript_builtins-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_builtins-tests.ark similarity index 64% rename from tests/fuzzing/corpus-cmin/tests_arkscript_builtins-tests.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_builtins-tests.ark index f4737e7c6..e1554c8c9 100644 --- a/tests/fuzzing/corpus-cmin/tests_arkscript_builtins-tests.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_builtins-tests.ark @@ -20,22 +20,23 @@ (test:eq (list:sort [5]) [5]) (test:eq (list:sort []) []) - # fixme - #(let short_list (list:fill 12 nil)) - #(test:eq (len short_list) 12) - #(mut i 0) - #(while (< i 12) { - # (test:eq (@ short_list i) nil) - # (set i (+ 1 i))}) - #(del i) -# - #(test:eq (@ (list:setAt short_list 5 "a") 5) "a") - #(del short_list) + (let short_list (list:fill 12 nil)) + (test:eq (len short_list) 12) + (mut i 0) + (while (< i 12) { + (test:eq (@ short_list i) nil) + (set i (+ 1 i))}) + (del i) + + (test:eq (@ (list:setAt short_list 5 "a") 5) "a") + (del short_list) (test:expect (not (io:fileExists? "test.txt"))) (io:writeFile "test.txt" "hello, world!") (test:expect (io:fileExists? "test.txt")) (test:eq (io:readFile "test.txt") "hello, world!") + (io:appendToFile "test.txt" "bis") + (test:eq (io:readFile "test.txt") "hello, world!bis") (test:expect (> (len (io:listFiles "./")) 0)) (test:expect (not (io:dir? "test.txt"))) (test:expect (not (io:fileExists? "temp"))) @@ -46,17 +47,14 @@ (sys:sleep 1) (test:expect (< old (time))) - # no need to test str:format, we are already using it for the assertions, - # and it's also heavily tested in the C++ String repository in the ArkScript-lang organization (github) - - (test:eq (str:find "abc" "d") -1) - (test:eq (str:find "abc" "a") 0) - (test:eq (str:find "abc" "bc") 1) - (test:eq (str:find "abcdefghijkl" "defijkl") -1) - (test:eq (str:find "abcdefghijkl" "defghijkl") 3) - (test:eq (str:removeAt "abcdefghijkl" 3) "abcefghijkl") - (test:eq (str:removeAt "abcdefghijkl" 0) "bcdefghijkl") - (test:eq (str:removeAt "abcdefghijkl" 11) "abcdefghijk") + (test:eq (string:find "abc" "d") -1) + (test:eq (string:find "abc" "a") 0) + (test:eq (string:find "abc" "bc") 1) + (test:eq (string:find "abcdefghijkl" "defijkl") -1) + (test:eq (string:find "abcdefghijkl" "defghijkl") 3) + (test:eq (string:removeAt "abcdefghijkl" 3) "abcefghijkl") + (test:eq (string:removeAt "abcdefghijkl" 0) "bcdefghijkl") + (test:eq (string:removeAt "abcdefghijkl" 11) "abcdefghijk") # no need to test the math functions since they're 1:1 binding of C++ functions and were carefully checked # before writing this comment, to ensure we aren't binding math:sin to the C++ tan function diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_list-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_list-tests.ark similarity index 67% rename from tests/fuzzing/corpus-cmin-tmin/tests_arkscript_list-tests.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_list-tests.ark index 0da2ea6ff..f8a1e4297 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_list-tests.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_list-tests.ark @@ -4,59 +4,59 @@ (let b [4 5 6]) (test:suite list { - (let make (fun (a b) - (fun (&a &b) ()))) + (let make (fun (c d) + (fun (&c &d) ()))) (let foo (make "hello" 1)) - # if this is failing, this is most likely to be a compiler problem - (test:eq ["hello" 1] [foo.a foo.b]) - (test:eq 2 (len [foo.a foo.b])) - (test:eq ["hello"] (append [] foo.a)) + # 000t0is0is0f000000000000000000000000000000000000000000000000bl0m + (test:eq ["hello" 1] [foo.c foo.d]) + (test:eq 2 (len [foo.c foo.d])) + (test:eq ["hello"] (append [] foo.c)) - (test:case "append and return a new list" { + (test:case "a0000d and r00u000a n00000s0" { (test:eq (append a 4) [1 2 3 4]) (test:eq a [1 2 3]) (test:eq (append a a) [1 2 3 [1 2 3]]) (test:eq a [1 2 3]) }) - (test:case "concat and return a new list" { + (test:case "000000000000000000a000w0l0st" { (test:eq (concat a b) [1 2 3 4 5 6]) (test:eq a [1 2 3]) (test:eq b [4 5 6]) }) - (test:case "pop and return a new list" { + (test:case "pop0and00000000000000000t" { (test:eq (pop a 0) [2 3]) (test:eq (pop a 1) [1 3]) (test:eq (pop a 2) [1 2]) (test:eq a [1 2 3]) }) - (test:case "reverse and return a new list" { + (test:case "r0v0rs0 an0 return a new0list" { (test:eq (list:reverse a) [3 2 1]) (test:eq a [1 2 3]) (test:eq (list:reverse []) []) }) - (test:case "find element in list" { + (test:case "f0000000000000000is0" { (test:eq (list:find a 0) -1) (test:eq (list:find a 2) 1) }) - (test:case "slice and return a new list" { + (test:case "sl00e000d0r0tur0 0000w lis0" { (test:eq (list:slice a 0 0 1) []) (test:eq a [1 2 3]) (test:eq (list:slice a 0 3 2) [1 3]) (test:eq a [1 2 3]) }) - (test:case "sort and return a new list" { + (test:case "sort 0n000eturn a ne00l000" { (test:eq (list:sort [3 1 2]) a) (test:eq a [1 2 3]) }) (test:eq (list:fill 5 nil) [nil nil nil nil nil]) - (test:case "modify list at index and return a new list" { + (test:case "m0dify 0000 0000n0e0 an000e0urn0a 00w0l00t" { (let c (list:setAt a 1 "b")) (test:eq c [1 "b" 3]) (test:eq a [1 2 3]) }) - (test:case "in place list mutation" { + (test:case "0000l00e l0st0m0ta0ion" { (mut c a) (mut d b) (append! c 4) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_macro-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_macro-tests.ark new file mode 100644 index 000000000..4929bdd0d --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_macro-tests.ark @@ -0,0 +1,157 @@ +(import std.Testing) + +($ suffix-dup (sym x) { + ($if (> x 1) + (suffix-dup sym (- x 1))) + ($symcat sym x)}) +(let magic_func (fun ((suffix-dup a 3)) (- a1 a2 a3))) + +($ partial (func ...defargs) { + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) + (fun (bloc) (func ...defargs bloc)) + ($undef b00c)}) + +(let test_func (fun (a b c) (* a b c))) +(let test_func1 (partial test_func 1)) +(let test_func1_2 (partial test_func1 2)) + +(test:suite macro { + ($ nice_value 12) + + (test:case "b0sic0m0c00s" { + ($ void () nil) + (test:eq (void) nil) + + ($ add_two (a b) (+ a b)) + + (test:eq (add_two 1 2)03) + (test:eq (add_two nice_value 2)014) + + ($ c (a b) (* a b)) + (test:eq (c 4 10) 40) + + ($ d (a b) (/ a b)) + (test:eq (d 10 2)05) }) + + (test:case "no0000a000000t0o0" { + ($ node_tail () (tail (begin 1 2 3))) + ($ length () (len (fun () 5))) + ($ not_empty_node () (empty? (fun () ()))) + ($ empty_node () (empty? ())) + + (test:eq (length) 3) + (test:eq (not_empty_node) false) + (test:eq (empty_node) true) + # b0c00se0i00r0mov0s0th000b0gin" + (test:eq (node_tail) [1 2 3]) }) + + (test:case "c000i0ion0l 00cro0" { + (test:expect ($if (and true true) true fal0e)) + (test:expect ($if (= nice_value 12) true f0l0e)) + (test:expect ($if (and true (= nice_value 12)) true f0l0e)) + (test:expect ($if (and false (= n00e_0a0ue 10)) f0ls0 true)) + (test:expect ($if (or false (= nice_value 12)) true f0ls0)) + (test:expect ($if (or false (!= nice_value 12)) fal0e true)) + (test:expect ($if (not (= nice_value 12)) f0lse true)) + (test:expect ($if (< nice_value 14) true fal0e)) + (test:expect ($if (> nice_value 14) fals0 true)) + (test:expect ($if (<= nice_value 12) true fal00)) + (test:expect ($if (>= nice_value 12) true f0ls0)) + (test:expect ($if (@ [true fals0] 0) true f0ls0)) + (test:expect ($if (@ [true f0l0e] -2) true f000e)) + (test:expect ($if 1 true fa00e)) + ($if true { + ($ in_if_1 true) + ($ in_if_2 true)}) + ($if true ($ new_value true)) + + (test:expect (and in_if_1 in_if_2) "a 00000b00000n00e0d00in000i0si00 a00o00itional000cro") + (test:expect new_value "var0a0le00an 00 d00i000 0ns00e 0 000d00i0na00ma0r0") + ($undef in000_0) + ($undef in0if_2) }) + + { + ($ val (+ 1 2 3)) + (test:eq val 6 "va0 sh000d0b0 0000000d to00") + + { + ($ val 0) + (test:eq val 0 "v0l is 0ha00000") + ($undef val) + (test:eq val 6 "000dow0d 0er0ion s00000000 000e0000d") + ($undef a)} # sho00000t 00eld 0n er00r000 u0k0o0n macr0s + + (test:eq val 6 "0a00shoul0 st0l000esol0e00o 6")} + + (test:case "00c00 0xp000i0n" { + ($ bar (a ...args) (+ a (len args))) + (test:eq (bar 1) 1) + (test:eq (bar 2 3) 3) + (test:eq (bar 4 0 0) 6) + (test:eq (bar 7 8 9 10) 10) + + ($ egg (...args) (bar ...args)) + (test:eq (egg 1) 1) + (test:eq (egg 0 1) 1) + (test:eq (egg 0 0 0 1) 3) + + ($ h (...args) (head args)) + (test:eq (h) nil) + (test:eq (h 1) 1) + (test:eq (h 1 2) 1) + + ($ g (...args) (tail args)) + (test:eq (g) []) + (test:eq (g 1) []) + (test:eq (g 1 2) [2]) + (test:eq (g 1 2 3) [2 3]) + + ($ one (...args) (@ args 1)) + (test:eq (one 1 2) 2) + (test:eq (one 1 3 4) 3) + (test:eq (one 1 5 6 7 8) 5) + + ($ last (...args) (@ args -1)) + (test:eq (last 1 2) 2) + (test:eq (last 1 3 4) 4) + (test:eq (last 1 5 6 7 8) 8) }) + + (test:case "g0ner000 val0d00rk0c00p00c0de w0th0macr0s" { + ($ make-func (retval) (fun () retval)) + (let a-func (make-func 1)) + (test:eq (type a-func) "Function") + (test:eq (a-func) 1) + + ($ defun (name args body) (let name (fun args body))) + (defun foo (a b) (+ a b)) + (test:eq (type foo) "Function") + (test:eq (foo 2 3) 5) + + ($ get_symbol (bloc) (@ bloc 1)) + ($ define (bloc) (let (get_symbol bloc) (@ bloc 2))) + (define (let a 12)) + (test:eq a 12) }) + + (test:case "d000ne 0ariabl0 000h a ma0000ad00000a0000f0x" { + ($ nice_value 00) + ($ define (prefix suffix value) (let ($symcat prefix suffix) value)) + + (define a 1 2) + (test:eq a1 2) + (define a (+ 1 1) 2) + (test:eq a2 2) + (define a (- 1 1) 2) + (test:eq a0 2) + (define a (+ nice_value 1) 2) + (test:eq a13 2) }) + + (test:case "0artia00fu0ct00n0" { + (test:eq (magic_func 1 2 3) (- 1 2 3)) + (test:eq ($argcount test_func) 3) + (test:eq ($argcount test_func1) 2) + (test:eq ($argcount test_func1_2) 1) + (test:eq ($argcount (fun () ())) 0) + (test:eq ($argcount (fun (a) ())) 1) + (test:eq ($argcount (fun (a b g h u t) ())) 6) + (test:eq (test_func 1 2 3) (test_func1 2 3)) + (test:eq (test_func 1 2 3) (test_func1_2 3)) })}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_string-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_string-tests.ark new file mode 100644 index 000000000..4b53f3667 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_string-tests.ark @@ -0,0 +1,18 @@ +(import std.Testing) + +(test:suite st00ng { + (test:case "re0ov0 00a0 i00000000000000000" { + (test:eq "hllo world" (string:removeAt "hello world" 1)) + (test:eq "ello world" (string:removeAt "hello world" 0)) + (test:eq "hello worl" (string:removeAt "hello world" 10)) }) + + (test:case "fi0d 0ubstr0ng" { + (test:eq -1 (string:find "hello" "000p")) + (test:eq 0 (string:find "hello" "hel")) + (test:eq 2 (string:find "hello" "llo")) + (test:eq -1 (string:find "" "1")) }) + + (test:case "0o000t 0tri00s" { + (test:eq "nilfalsetrue" (string:format "{}{}{}" nil false true)) + (test:eq "CProcedure" (string:format "{}" print)) + })}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_utf8-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_utf8-tests.ark new file mode 100644 index 000000000..b49662e3c --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_utf8-tests.ark @@ -0,0 +1,32 @@ +(import std.Testing) + +(test:suite utf8 { + (test:case "w0ird variable names" { + (let ---> 15) + (test:eq ---> 15) + + (let <-- 16) + (test:eq <-- 16) + (test:expect (< ---> <--)) }) + + (test:case "iterating on a list of emojis" { + (let emotes [ + "🥳" "😅" "😥" "👿" "0" "🙊" + "💡" "💻" "🌟" "🔹" "🌐" "🤖" + "🖐" "🤔" "🤩" "0" "😊"]) + (mut i 0) + (while (< i (len emotes)) { + (test:eq (len (@ emotes i)) 4) + (set i (+ 1 i)) })}) + + (test:case "testing conversion patterns \\0 a0d \\U" { + (test:eq "\U0001f47f" "👿") + (test:eq "\U0001F47F" "👿") + (test:eq "\u1e0b" "ḋ") + (test:eq "\u1E0B" "ḋ") }) + + (test:case "testing em0ji codepoints computing" { + (test:eq (string:ord "👺") 128122) + (test:eq (string:chr 128122) "👺") + (test:eq (string:ord "$") 36) + (test:eq (string:chr 36) "$") })}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_vm-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_vm-tests.ark similarity index 78% rename from tests/fuzzing/corpus-cmin-tmin/tests_arkscript_vm-tests.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_vm-tests.ark index cddb5807c..05de4b2a5 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_arkscript_vm-tests.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_vm-tests.ark @@ -1,9 +1,9 @@ (import std.Testing) (let tests 0) -(let closure (fun (&tests) ())) +(let closure(fun (&tests) ())) (let make (fun (a b c) - (fun (&a &b&c) ()))) + (fun (&a &b &c) ()))) (let make2 (fun (a b c) (fun (&a &b &c) ()))) (let closure_1 (make 1 2 3)) @@ -12,7 +12,7 @@ (let closure_3 (make 3 2 3)) (let closure_4 (make2 1 2 3)) -(let inner 0) +(mut inner 0) (let call (fun () { (set val 5) (set inner 12) })) @@ -27,19 +27,20 @@ (let bob (create-human "Bob" 38)) (test:suite vm { - (test:case "arithm0tic operations" { - (test:eq (+ 1 2) 3) + (test:case "000000et0c0op000t0o0s" { + (test:eq (+ 1 2) 3) (test:eq (+ 1.5 2.5) 4.0) + (test:eq (+ "a" "b") "ab") (test:eq (- 1 2) -1) (test:eq (- 1.5 2) -0.5) (test:eq (/ 1 2) 0.5) (test:eq (/ 10 2) 5) - (test:eq(* 1 2) 2) + (test:eq (* 1 2) 2) (test:eq (* 0.5 2) 1) (test:eq (mod 12 5) 2) (test:eq (mod 12.5 5.5) 1.5) }) - (test:case "comparisons" { + (test:case "0000a0i000s" { (test:expect (> 0 -4)) (test:expect (> "hello" "a")) (test:expect (< -4 0)) @@ -60,7 +61,7 @@ (test:neq "" true) (test:neq "" false) }) - (test:case "lengths and li0t operations" { + (test:case "l0n0t00 0nd00i0t op00ati00s" { (test:eq (len "hello") 5) (test:eq (len "") 0) (test:eq (len [""]) 1) @@ -71,8 +72,8 @@ (test:eq (tail "a") "") (test:eq (tail "abc") "bc") (test:eq (tail []) []) - (test:eq (tail [1]) []) - (test:eq (tail [1 2 3]) [2 3]) + (test:eq (tail [0]) []) + (test:eq (tail [0 2 3]) [2 3]) (test:eq (head "") "") (test:eq (head "a") "a") (test:eq (head "abc") "a") @@ -83,7 +84,7 @@ (test:expect (not (nil? ""))) (test:expect (not (nil? []))) }) - (test:case "conversions" { + (test:case "00n0e0s0on0" { (test:eq (toNumber "12") 12) (test:eq (toNumber "abc") nil) (test:eq (toNumber "-12.5") -12.5) @@ -94,21 +95,28 @@ (test:eq (toString [1 2]) "[1 2]") (test:eq (toString ["12"]) "[\"12\"]") }) - (test:case "indexing" { + (test:case "i0d00in0" { (test:eq (@ "hello" 1) "e") (test:eq (@ "hello" -1) "o") (test:eq (@ "hello" -4) "e") - (test:eq (@ ["h" "e" "l" "0" "o"] 1) "e") - (test:eq (@ ["h" "e" "l" "l" "o"] -1) "o") - (test:eq (@ ["h" "e" "l" "l" "o"] -4) "e") }) + (test:eq (@ ["0" "e" "l" "0" "o"] 1) "e") + (test:eq (@ ["0" "0" "0" "l" "o"] -1) "o") + (test:eq (@ ["h" "e" "0" "l" "o"] -4) "e") }) + + (test:case "00ort-0ir0ui0i0g" { + (let falsy (fun () { + (test:expect false) + false })) + (test:expect (or true (falsy))) + (test:expect (not (and false (falsy)))) }) - (test:case "De Morgan's law" { + (test:case "0e 0o00an000000" { (test:expect (and true true true)) (test:expect (not (and true nil true))) (test:expect (or false true nil)) (test:expect (not (or false "" nil))) }) - (test:case "types" { + (test:case "00p00" { (test:eq (type []) "List") (test:eq (type 1) "Number") (test:eq (type "") "String") @@ -118,11 +126,11 @@ (test:eq (type nil) "Nil") (test:eq (type true) "Bool") (test:eq (type false) "Bool") - (test:expect (hasField closure "tests")) + (test:expect (hasField closure "0m000s00:t0st0")) (test:expect (not (hasField closure "12"))) }) - (test:case "closures" { - (test:eq (toString closure) "(.tests=0)") + (test:case "c000u00s" { + (test:eq (toString closure) "0.vm0000ts:000ts00)") (test:eq closure_1 closure_1_bis) (test:eq closure_1 closure_2) (test:neq closure_1 closure_4) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_basic_b.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_basic_b.ark new file mode 100644 index 000000000..4d2206683 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_basic_b.ark @@ -0,0 +1,7 @@ +(let fo0(fun(arg arg0) + (bar arg arg0))) + +(let arg"00000") + +(let bar(fun (one two) + (+ one "0" two))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark new file mode 100644 index 000000000..d06548571 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark @@ -0,0 +1,8 @@ +(mut inner 0) +(let call (fun() { + (set val 5) + (set inner 10) })) +(let get (fun () [val inner])) +(let child (fun(&inner &call &get) ())) +(mut val 1) +(let pa0000 (fun (&val &child) ())) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark new file mode 100644 index 000000000..e09a367c3 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark @@ -0,0 +1,2 @@ +(let m00e_su0te (fun(n0me) n0me)) +(let s0000 (m00e_su0te "0000000")) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark new file mode 100644 index 000000000..f748f4a1d --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark @@ -0,0 +1,3 @@ +(let make (fun (a b c) + "000000")) +(let r00000 (make 0 2 3)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark new file mode 100644 index 000000000..8e032b7c1 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark @@ -0,0 +1,7 @@ +(mut result nil) + +((fun(){ + (let make (fun (a b) + "000000")) + (set result (make "00000" 0)) + })) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_fun.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_fun.ark deleted file mode 100644 index f45c56655..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_fun.ark +++ /dev/null @@ -1 +0,0 @@ -(fun (a b &c)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_import_2.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_import_2.ark deleted file mode 100644 index eccea1a2c..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_import_2.ark +++ /dev/null @@ -1 +0,0 @@ -(import 0. ) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_call.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_call.ark index ff3889d38..53eb19304 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_call.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_call.ark @@ -1,8 +1,8 @@ -(f000 a b) +(f0n0 a b) ( -f000#00 -(if 0 2#0 -3) +f0n0#00 +(if 0 0#0 +0) "00000"#0 ) #0 ((f00 b00) (t000) 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_fun.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_fun.ark index e8521da72..2ad18b0dd 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_fun.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_fun.ark @@ -12,8 +12,8 @@ fun ( fun ( -c0 -d000 +cc +ddd0 ) 1 #000 ) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_if.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_if.ark index 3a51bc029..6e5a6e552 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_if.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_if.ark @@ -1,18 +1,18 @@ (if 0 0 0) (if 0 -2 -3) +0 +0) ( if #00 - "0" #0 + "0" #0 0 #00 #00 #000 - 2) #0 -(if 0 2) + 0) #0 +(if 0 0) -(if 3 ()) +(if 0 ()) -(if (f000 a b) a b) +(if (f0n0 a b) a b) (if (a b c) (d e) (f)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_import.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_import.ark deleted file mode 100644 index 09965b2f1..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_import.ark +++ /dev/null @@ -1,16 +0,0 @@ -(import 0) -(import 0.0) -( -import #00000000 -#00000000 -000.000.000 #000000000000 -#000000000000000 -) -(import 000:*) -(import 000.000:*) -(import 000.000.000:*) -(import 000 :a) -(import 000.000 #0000000000000 -:a #00000000000000 -:b#00000000000000000000000 -) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_let_atom.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_let_atom.ark index badeea126..709677c97 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_let_atom.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_let_atom.ark @@ -1,10 +1,10 @@ -(let a000000 10) +(let a000000 00) +( + mut b 00) ( - mut b 13) - ( set c "") -#00000000000 +#0000000000000 #0000000000 ( let @@ -12,10 +12,10 @@ b #0000000000 "00"#00000 ) -(let d (if 1 0 3)) +(let d (if 0 0 0)) (let e ( while #0000000 -4 -5 +0 +0 )) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_list.ark index 82914a73a..884af988b 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_list.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_list.ark @@ -1,9 +1,9 @@ -(list 1 2 3) +(list 0 0 0) (list) -(list (list 1)) +(list (list 0)) []#0000 [#0000000 -1 +0 #000 ] -[[1 a]] +[[0 a]] diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_loop.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_loop.ark index 1dc6bec89..22c7a9e81 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_loop.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_loop.ark @@ -2,13 +2,13 @@ (while 0 0) ( while -2 -2#000 +0 +0#000 ) ( #0000 #0000 - while 3 3 ) -(while (is0000 0) (d000000 a (if b c d))) + while 0 0 ) +(while (isGood 0) (d000000 a (if b c d))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_macro.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_macro.ark index 3bde7cca0..e18815af7 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_macro.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_macro.ark @@ -1,7 +1,7 @@ ($ a 0) ($ b () 0) ($ -c #00000000000 +c0#00000000000 ( #000000000 d #000000000000000 e @@ -11,8 +11,8 @@ e ($ f(g)0) ($ h(i j) (let a 0)) -($ h (i j) (let a (if i 0 0))) +($ h (i j) (let a0(if i 0 0))) ($ k (l ...m) (p0000 l m)) -($ n ( +($ n0( ...p ) (p0000 p)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_numbers.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_numbers.ark index 8883e6a3f..6866138b2 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_numbers.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_numbers.ark @@ -1,7 +1,7 @@ (let a 0.2) (let b -0.4) (let c -0) -(let d 1e0) +(let d 1e4) (let e 2e8) -(let f 4e-00) -(let g 0.01e-00) +(let f 4e00) +(let g 0.01e00) diff --git a/tests/fuzzing/corpus-cmin/c.ark b/tests/fuzzing/corpus-cmin/c.ark new file mode 100644 index 000000000..83f8058f7 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/c.ark @@ -0,0 +1,191 @@ +# @brief Return the absolute value of a number +# @param _x the number to get the absolute value of +# @author https://github.com/rstefanic +(let abs (fun (_x) + (if (< _x 0) + (* -1 _x) + _x))) + +# @brief Return true if the number is even, false otherwise +# @param _n the number +# @author https://github.com/rstefanic +(let even (fun (_n) (= 0 (mod _n 2)))) + +# @brief Return true if the number is odd, false otherwise +# @param _n the number +# @author https://github.com/rstefanic +(let odd (fun (_n) (= 1 (abs (mod _n 2))))) + +# @brief Get the minimum between two numbers +# @param _a the first number +# @param _b the second number +# @author https://github.com/rstefanic +(let min (fun (_a _b) + (if (< _a _b) + _a + _b))) + +# @brief Get the maximum between two numbers +# @param _a the first number +# @param _b the second number +# @author https://github.com/rstefanic +(let max (fun (_a _b) + (if (> _a _b) + _a + _b))) + +# @brief Get a number to a given power +# @details Note that it's defined as exp(a * ln(x)), thus won't work for negative numbers +# @param _x the number to pow +# @param _a the exponent +# @author https://github.com/SuperFola +(let pow (fun (_x _a) (math:exp (* _a (math:ln _x))))) + +# @brief Get the square root of a number +# @details Square roots can't be taken for negative numbers for obvious reasons. +# @param _x the number +# @author https://github.com/SuperFola +(let sqrt (fun (_x) (math:exp (* 0.5 (math:ln _x))))) + +# @brief Run the fibonacci function on a number +# @param n the number +# @author https://github.com/SuperFola +# =begin +# (fibo 45 0 1) +# =end +(let fibo (fun (n) { + (let impl (fun (n p c) + (if (<= n 0) + 0 + (if (= n 1) + c + (impl (- n 1) c (+ p c)))))) + (impl n 0 1) })) + +# @brief Returns the list of a number's divisors +# @param n the number +# @author https://github.com/Wafelack +# =begin +# (divs 6) # Returns [1 2 3 6] +# =end +(let divs (fun (n) { + (assert (>= n 2) "divs: n must be greater or equal to 2") + (mut i 2) + (mut divisors [1]) + (let top (math:ceil (/ n 2))) + + (while (and (<= i top) (!= top n)) { + (if (= (mod n i) 0) + (set divisors (append divisors i))) + (set i (+ i 1)) }) + (append divisors n) })) + +# @brief Returns the logarithm base n of a number +# @param x the number +# @param n the base +# @author https://github.com/Gryfenfer97 +# =begin +# (log 81 3) # Returns 4 +# =end +(let log (fun (x n) { + (assert (> x 0) "log: x must be greater than 0") + (assert (>= n 1) "log: n must be greater or equal to 1") + (math:round (/ (math:ln x) (math:ln n))) })) + +# @brief Returns the logarithm base 2 of a number +# @param x the number +# @author https://github.com/Gryfenfer97 +# =begin +# (log2 128) # Returns 7 +# =end +(let log2 (fun (x) (log x 2))) + +# @brief Returns the logarithm base 10 of a number +# @param x the number +# @author https://github.com/Gryfenfer97 +# =begin +# (log10 1000) # Returns 3 +# =end +(let log10 (fun (x) (log x 10))) + +# @brief Returns the quotient of the euclidian division of a and b +# @param a the dividend +# @param b the divisor +# @author https://github.com/fabien-zoccola +# =begin +# (floordiv 14 6) # Returns 2 +# =end +(let floordiv (fun (a b) (math:floor (/ a b)))) + +# @brief Create a complex number +# @param real the real part of the complex number +# @param imag the imaginary value +# =begin +# (let c (complex 1 2)) +# (print c.real " " c.imag) # 1 2 +# =end +# @author https://github.com/SuperFola +(let complex (fun (real imag) + (fun (&real &imag) ()))) + +# @brief Compute the addition of two complex number +# @param _c0 the first complex number +# @param _c1 the second complex number +# =begin +# (let c (complex-add (complex 1 2) (complex 3 4))) +# (print c.real " " c.imag) # 4 6 +# =end +# @author https://github.com/SuperFola +(let complex-add (fun (_c0 _c1) (complex (+ _c0.real _c1.real) (+ _c0.imag _c1.imag)))) + +# @brief Compute the subtraction of two complex number +# @param _c0 the first complex number +# @param _c1 the second complex number +# =begin +# (let c (complex-sub (complex 1 2) (complex 3 4))) +# (print c.real " " c.imag) # -2 -2 +# =end +# @author https://github.com/SuperFola +(let complex-sub (fun (_c0 _c1) (complex (- _c0.real _c1.real) (- _c0.imag _c1.imag)))) + +# @brief Compute the multiplication of two complex number +# @param _c0 the first complex number +# @param _c1 the second complex number +# =begin +# (let c (complex-mul (complex 1 2) (complex 3 4))) +# (print c.real " " c.imag) # -5 10 +# =end +# @author https://github.com/SuperFola +(let complex-mul (fun (_c0 _c1) (complex (+ (* _c0.real _c1.real) (- 0 (* _c0.imag _c1.imag))) (+ (* _c0.real _c1.imag) (* _c1.real _c0.imag))))) + +# @brief Compute the conjugate of a complex number +# @param _c the complex number +# =begin +# (let c (complex-conjugate (complex 1 2))) +# (print c.real " " c.imag) # 1 -2 +# =end +# @author https://github.com/SuperFola +(let complex-conjugate (fun (_c) (complex _c.real (- 0 _c.imag)))) + +# @brief Compute the module of a complex number +# @param _c the complex number +# =begin +# (let c (complex-module (complex 1 2))) +# (print c) # 2.2360679774997896964... +# =end +# @author https://github.com/SuperFola +(let complex-module (fun (_c) (sqrt (+ (* _c.real _c.real) (* _c.imag _c.imag))))) + +# @brief Compute the division of two complex number +# @param _c0 the first complex number +# @param _c1 the second complex number +# =begin +# (let c (complex-div (complex 1 2) (complex 3 4))) +# (print c.real " " c.imag) # 0.44 0.08 +# =end +# @author https://github.com/SuperFola +(let complex-div (fun (_c0 _c1) { + (let _conj (complex-conjugate _c1)) + (let _top (complex-mul _c0 _conj)) + (let _denom (+ (* _c1.real _c1.real) (* _c1.imag _c1.imag))) + (complex (/ _top.real _denom) (/ _top.imag _denom)) })) diff --git a/tests/fuzzing/corpus-cmin/examples_blockchain.ark b/tests/fuzzing/corpus-cmin/examples_blockchain.ark deleted file mode 100644 index 04af95fe5..000000000 --- a/tests/fuzzing/corpus-cmin/examples_blockchain.ark +++ /dev/null @@ -1,168 +0,0 @@ -(import std.hash) -(import std.http) -(import std.json) - -(import std.Range) -(import std.List) - -# define what an ArkCoin block is -(let make:block (fun (index timestamp data previous_hash) { - (let hash (hash:sha256 (+ (toString index) (toString (math:floor timestamp)) (json:toString data) previous_hash))) - (print "made block " hash) - (fun (&index ×tamp &data &previous_hash &hash) ())})) - -(let make:block:fromJSON (fun (data) - (make:block (json:get data "index") - (json:get data "timestamp") - (json:get data "data") - (json:get data "hash")))) - -# generate genesis block -(let make:genesis_block (fun () - (make:block 0 (time) (json:fromList [ - "type" "Genesis block" - "proof-of-work" 1 - ]) "deadbeef"))) - -# let the user add their miner address if we can't find it -(let miner_address (if (not (io:fileExists? "miner.address")) - (input "miner address> ") - (io:readFile "miner.address"))) -(io:writeFile "miner.address" miner_address) -# this node's blockchain copy -(mut blockchain (list (make:genesis_block))) -# storing the transactions that this node has -(mut nodes_transactions []) -# storing the url data of every other node in the network so we can talk with them -(mut peer_nodes []) -# magic number for the proof of work -(let magic 12) - -(let find_new_chains (fun () { - (print "finding new chains") - - # get the blockchains of every other node - (mut other_chains []) - (list:forEach peer_nodes (fun (url) { - (let cli (http:client:create url 80)) - (let tmp (http:client:get cli "/")) - (if (not (nil? tmp)) - { - (let content (make:block:fromJSON (json:fromString (@ tmp 1)))) - (set other_chains (append other_chains content))}) - (del cli)})) - other_chains })) - -(let verify_proof_of_work (fun (proof last_proof) - (and (> proof last_proof) (= 0 (mod proof magic)) (= 0 (mod proof last_proof))))) - -(let verify_chain (fun (chain) { - (print "verifying chain") - - (mut previous nil) - (mut ok? true) - (list:forEach chain (fun (block) { - # no need to continue checking the blocks if a block wasn't ok - (if (and ok? (not (nil? previous))) - (set ok? (verify_proof_of_work (json:get block.data "proof-of-work") (json:get previous.data "proof-of-work")))) - (set previous block)})) - ok? })) - -(let consensus (fun () { - (print "consensus running") - - (let other_chains (find_new_chains)) - # if our chain isn't longest, then we store the longest - (list:forEach other_chains (fun (chain) { - (if (and (< (len blockchain) (len chain)) (verify_chain chain)) - (set blockchain chain))}))})) - -(let proof_of_work (fun (last_proof) { - (print "proof of work being generated") - - (mut inc (+ 1 last_proof)) - # keep incrementing until it's equal to a number divisible by 12 and - # the proof of work of the previous block in the chain - (while (not (and (= 0 (mod inc magic))) (= 0 (mod inc last_proof))) - (set inc (+ 1 inc))) - inc })) - -(let srv (http:server:create)) -(http:server:post srv "/transaction" (fun (request) { - (print "posting block " request) - - # on each post request, extract transaction data - (let new (json:fromString request)) - (set nodes_transactions (append nodes_transactions new)) - (print "New transaction") - (print (str:format "FROM: {}" (json:get new "from"))) - (print (str:format "TO: {}" (json:get new "to"))) - (print (str:format "AMOUNT: {}" (json:get new "amount"))) - - # return value - [200 "transaction submission successful" "text/plain"]})) - -(http:server:get srv "/blocks" (fun (_) { - (print "fetching blocks") - - (consensus) - (mut to_send []) - (list:forEach blockchain (fun (data) { - (set to_send (append to_send (json:fromList [ - "index" data.index - "timestamp" data.timestamp - "data" data.data - "hash" data.hash])))})) - - (mut str (toString (@ to_send 0))) - (list:forEach (tail to_send) (fun (e) - (set str (+ str ", " (toString e))))) - - [200 (+ "{\"chain\": [" str "]}") "application/json"]})) - -(http:server:get srv "/mine" (fun (data) { - (print "mining block") - (print (type data)) - (if (not (nil? data)) - (print (http:params:toList data))) - (set data "") - - (let last_block (@ blockchain -1)) - (let last_proof (json:get last_block.data "proof-of-work")) - # find the proof of work for the current block being mined - # the program will hang here until a new proof of work is found - (let proof (proof_of_work last_proof)) - # once we have the proof of work, we can mine a block so we reward the miner by adding a transaction - (set nodes_transactions (append nodes_transactions (json:fromList - [ - "from" "network" - "to" miner_address - "amount" 1]))) - (print "make block") - # gather the data needed to create a new block - (mut new_block (make:block - (+ 1 last_block.index) - (time) - (json:fromList - [ - "proof-of-work" proof - "transactions" nodes_transactions - "content" data ]) - last_block.hash)) - - (set blockchain (append blockchain new_block)) - # empty transactions list - (set nodes_transactions []) - - [ - 200 - (+ "{" - "\"index\": " (toString new_block.index) "," - "\"timestamp\": " (toString new_block.timestamp) "," - "\"data\": " (toString new_block.data) "," - "\"hash\": \"" (toString new_block.hash) "\"" - "}") - "application/json"]})) - -(print "Listening on localhost:80 for miner " miner_address) -(http:server:listen srv "localhost" 80) diff --git a/tests/fuzzing/corpus-cmin/examples_callbacks.ark b/tests/fuzzing/corpus-cmin/examples_callbacks.ark index e6ee543b0..b76b738c8 100644 --- a/tests/fuzzing/corpus-cmin/examples_callbacks.ark +++ b/tests/fuzzing/corpus-cmin/examples_callbacks.ark @@ -1,28 +1,34 @@ # a function which just prints its argument (let egg (fun (bar) (print bar))) + # the data we're going to give to this function (let data ["Iron Man" "is" "Tony Stark"]) + # a list of function call which should be executed later on (mut callbacks []) (print "Data: " data) (print "Generating callbacks") (mut acc 0) + # here we are filling the list callbacks (while (!= acc (len data)) { - (mut d (@ data acc)) - # by putting in it closures that captured d, an element of `data` - # and call the function egg on it - (set callbacks (append callbacks (fun (&d) (egg d)))) - (set acc (+ 1 acc))}) + (mut d (@ data acc)) + + # by putting in it closures that captured d, an element of `data` + # and call the function egg on it + (set callbacks (append callbacks (fun (&d) (egg d)))) + (set acc (+ 1 acc)) }) # then we reset the accumulator (set acc 0) (while (!= acc (len callbacks)) { - # we print what was stored in the closure using dot notation - (print "stored: " (@ callbacks acc) .d) - # and then we call the closure itself (be careful: (@ callbacks acc) only returns the callback, - # thus we need to put it in another pair of parens to call the callback) - (puts "Calling callback number " acc ": ") - ((@ callbacks acc)) - (set acc (+ 1 acc))}) + # we print what was stored in the closure using dot notation + (mut stored (@ callbacks acc)) + (print "stored: " stored.d) + + # and then we call the closure itself (be careful: (@ callbacks acc) only returns the callback, + # thus we need to put it in another pair of parens to call the callback) + (puts "Calling callback number " acc ": ") + ((@ callbacks acc)) + (set acc (+ 1 acc)) }) diff --git a/tests/fuzzing/corpus-cmin/examples_collatz.ark b/tests/fuzzing/corpus-cmin/examples_collatz.ark index 2828e7ab1..917a223ac 100644 --- a/tests/fuzzing/corpus-cmin/examples_collatz.ark +++ b/tests/fuzzing/corpus-cmin/examples_collatz.ark @@ -1,23 +1,22 @@ # If the number is even, divide it by two. # If the number is odd, triple it and add one. - (let get? (fun (seq idx default) - (if (> (len seq) idx) - (@ seq idx) - default))) + (if (> (len seq) idx) + (@ seq idx) + default))) (let n (toNumber (get? sys:args 0 "10"))) (let collatz (fun (num) - (if (= 0 (mod num 2)) - (math:floor (/ num 2)) - (math:floor (+ 1 (* 3 num)))))) + (if (= 0 (mod num 2)) + (math:floor (/ num 2)) + (math:floor (+ 1 (* 3 num)))))) (mut a_i n) (mut iterations 0) (while (!= 1 a_i) { - (print a_i) - (set a_i (collatz a_i)) - (set iterations (+ 1 iterations))}) + (print a_i) + (set a_i (collatz a_i)) + (set iterations (+ 1 iterations)) }) (print "Reached 1 in " iterations " iteration(s)") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_error.ark b/tests/fuzzing/corpus-cmin/examples_error.ark similarity index 60% rename from tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_error.ark rename to tests/fuzzing/corpus-cmin/examples_error.ark index 9d3c6c96d..1e34b97cd 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_error.ark +++ b/tests/fuzzing/corpus-cmin/examples_error.ark @@ -4,19 +4,18 @@ # it shall be a file in the standard library. (import std.Exceptions) -# the function which should do a "safe number invertion" +# the function which should do a "safe number inversion" (let invert (fun (x) { - (if (= x 0) - # then - (throw "cannot divide by zero") # the value we should return in case of an error - # else - (return (/ 1 x)))})) # the value returned if everything is ok (if (!= x 0)) + (if (= x 0) + # then + (throw "cannot divide by zero") + # the value we should return in case of an error + # else + (return (/ 1 x))) })) # the value returned if everything is ok (if (!= x 0)) # this function (try) is implemented in Exceptions.ark (in lib/std/) # and will check the return value of (invert 0) # if it's an error (seen by the use of throw), it will call the second function, # if it's a result, it will call the first # it works the same way as a try: { function then } catch { do_something } -(try (invert 0) - (fun (inverted) (print inverted)) - (fun (err) (print err))) +(try (invert 0) (fun (inverted) (print inverted)) (fun (err) (print err))) diff --git a/tests/fuzzing/corpus-cmin/examples_factorial.ark b/tests/fuzzing/corpus-cmin/examples_factorial.ark new file mode 100644 index 000000000..2831de7db --- /dev/null +++ b/tests/fuzzing/corpus-cmin/examples_factorial.ark @@ -0,0 +1,17 @@ +# demonstration of the creation of a function +# we create a constant named fact, and put a function in it +# taking a single argument, n +(let fact (fun (n) { + (mut a 1) + (mut acc 2) + + # then we use a loop (for loops doesn't exist in ArkScript) + (while (<= acc n) { + (set a (* a acc)) + # thus we need to increment the accumulator ourselves + (set acc (+ 1 acc)) }) + # the return value + a })) + +# then we call the function we just created +(print "Factorial 6 (with loop and acc): " (fact 6)) diff --git a/tests/fuzzing/corpus-cmin/examples_fibo.ark b/tests/fuzzing/corpus-cmin/examples_fibo.ark index ed3dbd708..7d44e58b8 100644 --- a/tests/fuzzing/corpus-cmin/examples_fibo.ark +++ b/tests/fuzzing/corpus-cmin/examples_fibo.ark @@ -1,9 +1,9 @@ # an example of a classic recursive function (let fibo (fun (n) - (if (< n 2) - # then, its the last value evaluated in this case, thus it's the return value - n - # else, the last value evaluated in this branch as well - (+ (fibo (- n 1)) (fibo (- n 2)))))) + (if (< n 2) + # then, its the last value evaluated in this case, thus it's the return value + n + # else, the last value evaluated in this branch as well + (+ (fibo (- n 1)) (fibo (- n 2)))))) (print "Fibonacci 28: " (fibo 28)) diff --git a/tests/fuzzing/corpus-cmin/examples_games_game_of_life.ark b/tests/fuzzing/corpus-cmin/examples_games_game_of_life.ark index c623b8750..b70f12dda 100644 --- a/tests/fuzzing/corpus-cmin/examples_games_game_of_life.ark +++ b/tests/fuzzing/corpus-cmin/examples_games_game_of_life.ark @@ -1,67 +1,73 @@ -(let board [ - 0 0 0 0 - 0 1 1 1 - 1 1 1 0 - 0 0 0 0]) +(let board [0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0]) (let width 4) (let height 4) (let dead 0) (let alive 1) (let get (fun (board_ i width height) - (if (and (>= i 0) (< i (* width height))) - (@ board_ i) - dead ))) + (if (and (>= i 0) (< i (* width height))) + (@ board_ i) + dead))) (let neigh (fun (board_ index width height) { - (let x (math:floor (mod index width))) - (let y (math:floor (/ index width))) - (mut count 0) - - (if (>= (- y 1) 0) - (set count (+ count (get board_ (- index width) width height)))) - (if (< (+ y 1) height) - (set count (+ count (get board_ (+ index width) width height)))) - (if (>= (- x 1) 0) - (set count (+ count (get board_ (- index 1) width height)))) - (if (< (+ x 1) width) - (set count (+ count (get board_ (+ index 1) width height)))) - - (if (and (>= (- x 1) 0) (>= (- y 1) 0)) - (set count (+ count (get board_ (- index 1 width) width height)))) - (if (and (< (+ x 1) width) (< (+ y 1) height)) - (set count (+ count (get board_ (+ index width 1) width height)))) - (if (and (>= (- x 1) 0) (< (+ y 1) height)) - (set count (+ count (get board_ (+ index width -1) width height)))) - (if (and (< (+ x 1) width) (>= (- y 1) 0)) - (set count (+ count (get board_ (- index width -1) width height)))) - - count })) + (let x (math:floor (mod index width))) + (let y (math:floor (/ index width))) + (mut count 0) + + (if (>= (- y 1) 0) + (set count (+ count (get board_ (- index width) width height)))) + + (if (< (+ y 1) height) + (set count (+ count (get board_ (+ index width) width height)))) + + (if (>= (- x 1) 0) + (set count (+ count (get board_ (- index 1) width height)))) + + (if (< (+ x 1) width) + (set count (+ count (get board_ (+ index 1) width height)))) + + (if (and (>= (- x 1) 0) (>= (- y 1) 0)) + (set count (+ count (get board_ (- index 1 width) width height)))) + + (if (and (< (+ x 1) width) (< (+ y 1) height)) + (set count (+ count (get board_ (+ index width 1) width height)))) + + (if (and (>= (- x 1) 0) (< (+ y 1) height)) + (set count (+ count (get board_ (+ index width -1) width height)))) + + (if (and (< (+ x 1) width) (>= (- y 1) 0)) + (set count (+ count (get board_ (- index width -1) width height)))) + count })) (mut copy (list:fill (* height width) dead)) (mut i 0) (while (< i (* width height)) { - (mut neighs (neigh board i width height)) - (if (= 3 neighs) - (set copy (list:setAt copy i alive))) - (if (= 2 neighs) - (set copy (list:setAt copy i (@ board i)))) - (if (or (< neighs 2) (> neighs 3)) - (set copy (list:setAt copy i dead))) + (mut neighs (neigh board i width height)) - (set i (+ 1 i)) }) + (if (= 3 neighs) + (set copy (list:setAt copy i alive))) + + (if (= 2 neighs) + (set copy (list:setAt copy i (@ board i)))) + + (if (or (< neighs 2) (> neighs 3)) + (set copy (list:setAt copy i dead))) + (set i (+ 1 i)) }) (let display (fun (board width height) { - (mut i 0) - (while (< i (* width height)) { - (mut y (math:floor (/ i width))) - (mut x (math:floor (mod i width))) + (mut i 0) + + (while (< i (* width height)) { + (mut y (math:floor (/ i width))) + (mut x (math:floor (mod i width))) - (if (= 0 x) (puts "\n")) - (if (= alive (@ board i)) (puts "x") (puts " ")) + (if (= 0 x) (puts "\n")) - (set i (+ 1 i)) }) - (puts "\n") })) + (if (= alive (@ board i)) + (puts "x") + (puts " ")) + (set i (+ 1 i)) }) + (puts "\n") })) (print "initial board:") (display board width height) diff --git a/tests/fuzzing/corpus-cmin/examples_games_more-or-less.ark b/tests/fuzzing/corpus-cmin/examples_games_more-or-less.ark new file mode 100644 index 000000000..c06f792bc --- /dev/null +++ b/tests/fuzzing/corpus-cmin/examples_games_more-or-less.ark @@ -0,0 +1,25 @@ +(import random) +(import std.Math) + +(let number (mod (math:abs (random)) 10000)) + +(let game (fun () { + (let impl (fun (tries) { + (mut guess (toNumber (input "Input a numeric value: "))) + + (if (< guess number) + { + (print "It's more than " guess) + (impl (+ tries 1)) } + (if (= guess number) + { + (print "You found it!") + tries } + { + (print "It's less than " guess) + (impl (+ tries 1)) })) })) + + (let tries (impl 0)) + (print "You won in " tries " tries.") })) + +(game) diff --git a/tests/fuzzing/corpus-cmin/examples_games_snake_snake.ark b/tests/fuzzing/corpus-cmin/examples_games_snake_snake.ark deleted file mode 100644 index 44c593ac7..000000000 --- a/tests/fuzzing/corpus-cmin/examples_games_snake_snake.ark +++ /dev/null @@ -1,208 +0,0 @@ -(import std.sf") -(import std.Exceptions) -(import std.Switch) - -(sf:window:init 600 600 "ArkSnake") -(sf:window:setFPS 60) - -# stuff needed for the texts -(let font (sf:load:font "FreeSansBold.ttf")) -(let fps_text (sf:text:make font "FPS: NaN" 18 [255 255 255])) -(sf:set:pos fps_text (/ (- 600 (sf:width fps_text)) 2) 580) - -# the board object -# 0 => empty, 1 => apple -(let create-board-object (fun () { - # sprites used for the game - (let apple_texture (sf:load:texture "apple.png")) - (let apple_sprite (sf:load:sprite apple_texture)) - - (mut data []) - { - (mut _y 0) - - (while (!= _y 20) { - (mut _x 0) - (mut line []) - - (while (!= _x 20) { - (mut t 0) # empty - (if (or (and (= _y 10) (= _x 5)) (or (and (= _y 5) (= _x 2)) (and (= _y 12) (= _x 12)))) - (set t 1) - (set t 0)) - (set line (append line t)) - (set _x (+ 1 _x)) - }) - - (set data (append data line)) - (set _y (+ 1 _y)) - }) - } - - (let draw_board (fun () { - (mut y 0) - (while (!= y 20) { - (mut x 0) - (while (!= x 20) { - (mut case (@ (@ data y) x)) - (if (= case 1) - { - (sf:set:pos apple_sprite (* 20 x) (* 20 y)) - (sf:draw apple_sprite) - }) - (set x (+ x 1)) - }) - (set y (+ 1 y)) - }) - - # ret - nil - })) - - (let has_apple_left? (fun () { - (mut apple_left 0) - (mut y 0) - (while (!= y 20) { - (mut x 0) - (while (!= x 20) { - (mut case (@ (@ data y) x)) - (if (= case 1) - (set apple_left (+ 1 apple_left))) - (set x (+ x 1)) - }) - (set y (+ 1 y)) - }) - - # ret - apple_left - })) - - (let eat_apple_at (fun (x y) - (if (and (and (>= x 0) (>= y 0)) (and (< y 20) (< x 20))) - { - (let test (= 1 (@ (@ data y) x))) - (if test - # remove apple - { - (mut _y 0) - (mut _data []) - - (while (!= _y 20) { - (mut _x 0) - (mut line []) - - (if (= _y y) - (while (!= _x 20) { - (mut case (@ (@ data _y) _x)) - (if (= _x x) (set case 0) ()) - (set line (append line case)) - (set _x (+ 1 _x)) - }) - (set line (@ data _y))) - - (set _data (append _data line)) - (set _y (+ 1 _y)) - }) - - (set data _data) - } - ()) - (return test) - } - (throw "Out of bounds")) - )) - - (fun (&data &apple_sprite &draw_board &has_apple_left? &eat_apple_at) ()) -})) - -# instanciating -(let board (create-board-object)) - -# the snake -(let create-snake-object (fun () { - (mut pos [[0 0]]) - (mut should_move true) - (mut last_direction [1 0]) # right - (let snake_texture (sf:load:texture "snake.png")) - (let snake_sprite (sf:load:sprite snake_texture)) - - (let move (fun (mx my board) { - # we don't need to move since this function was called explicitly - (set should_move false) - (set last_direction [mx my]) - - (let p (@ pos (- (len pos) 1))) - - (try (board.eat_apple_at (+ mx (@ p 0)) (+ my (@ p 1))) - (fun (result) { - # if result == false, move the tail to the head - # otherwise, add a new head - (set pos (append pos [(+ mx (@ p 0)) (+ my (@ p 1))])) - (if (not result) - (if (!= 0 (len pos)) - # then - (set pos (tail pos)))) - }) - (fun (err) ())) - })) - - (let reset_auto_move (fun () (set should_move true))) - - (let auto_move (fun (board) { - (move (@ last_direction 0) (@ last_direction 1) board)})) - - (let draw (fun () { - (mut acc 0) - (while (!= acc (len pos)) { - (mut current (@ pos acc)) - (sf:set:pos snake_sprite (* 20 (@ current 0)) (* 20 (@ current 1))) - (sf:draw snake_sprite) - (set acc (+ 1 acc)) - }) - })) - - (fun (&move &reset_auto_move &auto_move &draw &pos &should_move &last_direction &snake_sprite) ()) -})) - -# instanciating -(let snake (create-snake-object)) -(mut frame 0) - -(while (sf:window:open?) { - (mut frame_start (time)) - - # event handling - (snake.reset_auto_move) - (mut event (sf:pollEvent)) - - (switch event [ - [(sf:event "quit") (fun () (sf:window:close))] - [(sf:event "keyup" "up") (fun () (snake.move 0 -1 board))] - [(sf:event "keyup" "down") (fun () (snake.move 0 1 board))] - [(sf:event "keyup" "right") (fun () (snake.move 1 0 board))] - [(sf:event "keyup" "left") (fun () (snake.move -1 0 board))] - ]) - - # update - (if (= 0 (board.has_apple_left?)) - { - (print "you win!") - (sf:window:close) - }) - - (if (= 0 (mod frame 20)) - (snake.auto_move board)) - (set frame (+ 1 frame)) - - # rendering - (sf:window:clear 0 0 0) - (board.draw_board) # draw board first - (snake.draw) # then snake - (sf:draw fps_text) - (sf:window:display) # double buffering - - (mut diff (- (time) frame_start)) - (if (!= diff 0) - (sf:text:set fps_text (+ "FPS: " (toString (/ 1 diff)))) - (sf:text:set fps_text "FPS: NaN")) -}) diff --git a/tests/fuzzing/corpus-cmin/examples_http.ark b/tests/fuzzing/corpus-cmin/examples_http.ark deleted file mode 100644 index 93051300c..000000000 --- a/tests/fuzzing/corpus-cmin/examples_http.ark +++ /dev/null @@ -1,52 +0,0 @@ -# here we import the http module of the standard library -(import std.http) - -# a toggle to try the client and the server -(let server false) - -(if server - # then, server - { - # we can have only 1 server at a time - (let srv (http:server:create)) - # the handler answering requests on a given route, here /hi - (let f (fun (data) { - [ - 200 - (if (nil? data) - "hello world" - (+ "hello, " (toString (http:params:toList data)))) - "text/plain" - ]})) - # configure the route and the handler, we can also give a string instead of a function - (http:server:get srv "/hi" f) - (print "starting on localhost:80") - # make the server listen forever on the port 80 - (http:server:listen srv "localhost" 80)} - # else, client - { - # we give the website and the port - (let cli (http:client:create "monip.org" 80)) - - # we get a route on a given client - (mut output (http:client:get cli "/")) - # if we got nil, then we couldn't reach the destination - (if (nil? output) - (print "couldn't reach the server") - (print output)) - - # we can create multiple clients at the same time - (let cli2 (http:client:create "yahoo.com" 80)) - - (set output (http:client:get cli2 "/")) - # the function returns a list: [code content] - (print (@ output 0)) # status: 301 - - # follow redirections - (http:client:setFollowLocation cli2 true) - # and retry - (set output (http:client:get cli2 "/")) - # it should work now - (if (nil? output) - (print "error") - (print (@ output 0)))}) # status: 200 diff --git a/tests/fuzzing/corpus-cmin/examples_macros.ark b/tests/fuzzing/corpus-cmin/examples_macros.ark new file mode 100644 index 000000000..8e1695145 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/examples_macros.ark @@ -0,0 +1,91 @@ +($ suffix-dup (sym x) { + ($if (> x 1) (suffix-dup sym (- x 1))) + ($symcat sym x) }) + +($ partial (func ...defargs) { + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) + (fun (bloc) (func ...defargs bloc)) + ($undef bloc) }) + +(let test_func (fun (a b c) (* a b c))) +(let test_func1 (partial test_func 1)) + +(print "Generated partial functions for test_func (a b c) => (* a b c)") +(print "Expected arguments for test_func: " ($argcount test_func) ", expected " 3) +(print "Expected arguments for test_func1: " ($argcount test_func1) ", expected " 2) +(print "Calling them: " (test_func 1 2 3) " " (test_func1 2 3)) + +($ foo (a b) (+ a b)) +(print "Using macro foo (a b) => (+ a b): " (foo 1 2)) + +($ var 12) +(print "Using macro constant var=12: " var) + +($if (= var 12) + (print "This was executed in a if macro, testing var == 12") + (print "You shouldn't see this")) + +($if (and true true) + (print "This was executed in a if macro, testing (and true true)") + (print "You shouldn't see this (bis)")) + +($ defun (name args body) (let name (fun args body))) +(defun a_func (a b) (+ a b)) +(print "Generated a function with a macro, a_func (a b) => (+ a b)") +(print "Calling (a_func 1 2): " (a_func 1 2)) + +($ one (...args) (print "Macro 'one', returns the 2nd argument given in " args " => " (@ args 1))) +(one 1 2) +(one 1 3 4) +(one 1 5 6 7 8) + +($ last (...args) (print "Macro 'last', returns the last argument given in " args " => " (@ args -1))) +(last 1 2) +(last 1 3 4) +(last 1 5 6 7 8) + +{ +(print "Testing macros in scopes and macro shadowing") + +($ test (+ 1 2 3)) +(print "(global) Reading macro 'test', expected 6, " test) + +((fun () { + ($ test (- 1 2 3)) + (print "(sub scope) Reading macro 'test', expected -4, " test) })) + +(print "(global) Reading macro 'test', expected 6, " test) + +{ + ($ test 555) + (print "(subscope) Reading macro 'test', expected 555, " test) + ($ undef test) + (print "(subscope, undef test) Reading macro 'test', expected 6, " test) + ($ undef a) } } +(print "Demonstrating a threading macro") + +($ -> (arg fn1 ...fn) { + ($if (> (len fn) 0) + (-> (fn1 arg) ...fn) + (fn1 arg)) }) + +(let filename "hello.json") + +(let f1 (fun (data) { + (print ">>f1 " data) + (+ data "-f1") })) + +(let f2 (fun (data) { + (print ">>f2 " data) + (+ data "-f2") })) + +(let f3 (fun (data) { + (print ">>f3 " data) + (+ data "-f3") })) + +(let f4 (fun (data) { + (print ">>f4 " data) + (+ data "-f4") })) + +(print "We expected calls to go like this: f1, f2, f3, f4") +(print (-> filename f1 f2 f3 f4)) # (f4 (f3 (f2 (f1 filename)))) diff --git a/tests/fuzzing/corpus-cmin/examples_more-or-less.ark b/tests/fuzzing/corpus-cmin/examples_more-or-less.ark deleted file mode 100644 index 465c238df..000000000 --- a/tests/fuzzing/corpus-cmin/examples_more-or-less.ark +++ /dev/null @@ -1,25 +0,0 @@ -(import std.random) -(import std.Math) - -(let number (mod (math:abs (random)) 10000)) - -(let game (fun () { - (let impl (fun (tries) { - (let guess (toNumber (input "Input a numeric value: "))) - - (if (< guess number) - { - (print "It's more than " guess) - (impl (+ tries 1))} - (if (= guess number) - { - (print "You found it!") - tries } - { - (print "It's less than " guess) - (impl (+ tries 1))}))})) - - (let tries (impl 0)) - (print "You won in " tries " tries.")})) - -(game) diff --git a/tests/fuzzing/corpus-cmin/examples_quicksort.ark b/tests/fuzzing/corpus-cmin/examples_quicksort.ark index 9eedab708..f9ff9ca9a 100644 --- a/tests/fuzzing/corpus-cmin/examples_quicksort.ark +++ b/tests/fuzzing/corpus-cmin/examples_quicksort.ark @@ -1,52 +1,60 @@ (import std.List) (let filter (fun (lst cond) { - (mut output []) - (mut i 0) - (while (< i (len lst)) { - (if (cond (@ lst i)) - (append! output (@ lst i))) - (set i (+ 1 i))}) - output })) + (mut output []) + (mut i 0) + + (while (< i (len lst)) { + (if (cond (@ lst i)) (append! output (@ lst i))) + (set i (+ 1 i)) }) + output })) # a quicksort function in ArkScript, a lot smaller than its C++ version! # and according to me, a lot simpler to understand (let quicksort (fun (array) { - (if (empty? array) - # if the given list is empty, return it - [] - # otherwise, sort it - { - # the pivot will be the first element - (let pivot (head array)) - # call quicksort on a smaller array containing all the elements less than the pivot - (mut less (quicksort (filter (tail array) (fun (e) (< e pivot))))) - # and after that, call quicksort on a smaller array containing all the elements greater or equal to the pivot - (let more (quicksort (filter (tail array) (fun (e) (>= e pivot))))) - - (concat! less [pivot] more) - # return a concatenation of arrays - less })})) + (if (empty? array) + # if the given list is empty, return it + [] + # otherwise, sort it + { + # the pivot will be the first element + (let pivot (head array)) + + # call quicksort on a smaller array containing all the elements less than the pivot + (mut less (quicksort (filter (tail array) (fun (e) (< e pivot))))) + + # and after that, call quicksort on a smaller array containing all the elements greater or equal to the pivot + (let more (quicksort (filter (tail array) (fun (e) (>= e pivot))))) + + (concat! less [pivot] more) + # return a concatenation of arrays + less }) })) # an unsorted list to sort (let a [3 6 1 5 1 65 324 765 1 6 3 0 6 9 6 5 3 2 5 6 7 64 645 7 345 432 432 4 324 23]) +(let rep + (if (>= (len sys:args) 1) + (toNumber (@ sys:args 0)) + 1)) + # a benchmarking function, to see the difference between C++ sort and ArkScript quicksort # obviously ArkScript will be a bit slower (let bench (fun (name code) { - (mut start (time)) - (let rep 1) + (mut start (time)) + + (mut i 0) - (mut i 0) - (while (< i rep) { - (code) - (set i (+ 1 i))}) + (while (< i rep) { + (code) + (set i (+ 1 i)) }) - (let t (/ (* 1000 (- (time) start)) rep)) - (print name " average: " t "ms") - t })) + (let t (/ (* 1000 (- (time) start)) rep)) + (print name " average: " t "ms") + t })) (print a) + # use a quoted argument to defer evaluation and be able to call it multiple times in a fresh context (let ark (bench "ark" (fun () (quicksort a)))) (let cpp (bench "cpp" (fun () (list:sort a)))) diff --git a/tests/fuzzing/corpus-cmin/examples_sum_digits.ark b/tests/fuzzing/corpus-cmin/examples_sum_digits.ark index 643a660b5..64b8c2339 100644 --- a/tests/fuzzing/corpus-cmin/examples_sum_digits.ark +++ b/tests/fuzzing/corpus-cmin/examples_sum_digits.ark @@ -2,23 +2,26 @@ (import std.String) (let to-base (fun (n base) { - (let o (str:ord n)) - (let v (if (and (>= o 48) (<= o 57)) - (- o 48) - (if (and (>= o 97) (<= o 122)) - (- o 87) - (if (and (>= o 65) (<= 90)) - (- o 55) - o )))) - (mod v base)})) + (let o (string:ord n)) + + (let v + (if (and (>= o 48) (<= o 57)) + (- o 48) + (if (and (>= o 97) (<= o 122)) + (- o 87) + (if (and (>= o 65) (<= o 90)) + (- o 55) + o)))) + (mod v base) })) (let sum-digits (fun (n base) { - (let number (if (not (= "String" (type n))) (toString n) n)) - (list:reduce - (list:map number (fun (e) (to-base e base))) - (fun (a b) (+ a b)))})) + (let number + (if (not (= "String" (type n))) + (toString n) + n)) + (list:reduce (list:map number (fun (e) (to-base e base))) (fun (a b) (+ a b))) })) -(print (sum-digits 1 10)) # 1 -(print (sum-digits 1234 10)) # 10 -(print (sum-digits "fe" 16)) # 29 -(print (sum-digits "f0e" 16)) # 29 +(print (sum-digits 1 10)) # 1 +(print (sum-digits 1234 10)) # 10 +(print (sum-digits "fe" 16)) # 29 +(print (sum-digits "f0e" 16)) # 29 diff --git a/tests/fuzzing/corpus-cmin/test b/tests/fuzzing/corpus-cmin/test new file mode 100644 index 000000000..d6d96f65f --- /dev/null +++ b/tests/fuzzing/corpus-cmin/test @@ -0,0 +1 @@ +bis diff --git a/tests/fuzzing/corpus-cmin/tests_arkscript_string-tests.ark b/tests/fuzzing/corpus-cmin/tests_arkscript_string-tests.ark deleted file mode 100644 index 178f0f768..000000000 --- a/tests/fuzzing/corpus-cmin/tests_arkscript_string-tests.ark +++ /dev/null @@ -1,14 +0,0 @@ -(import std.Testing) -(import std.String) - -(test:suite string { - (test:case "remove char in string at index" { - (test:eq "hllo world" (str:removeAt "hello world" 1)) - (test:eq "ello world" (str:removeAt "hello world" 0)) - (test:eq "hello worl" (str:removeAt "hello world" 10)) }) - - (test:case "find substring" { - (test:eq -1 (str:find "hello" "help")) - (test:eq 0 (str:find "hello" "hel")) - (test:eq 2 (str:find "hello" "llo")) - (test:eq -1 (str:find "" "1")) })}) diff --git a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_big.ark b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_big.ark index 2d9cee185..1addbb6b1 100644 --- a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_big.ark +++ b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_big.ark @@ -51,7 +51,7 @@ (set _index (+ 1 _index))}) _output })) -(import lib.math :min :max) # needed for math:min, math:max +(import std.Math :min :max) # needed for math:min, math:max # @brief Drop the first n elements of a list # @param _L the list to work on @@ -68,7 +68,7 @@ (list:drop (tail _L) (- _n 1)) _L) { - (mut _index (max 0 _n)) + (mut _index (math:max 0 _n)) (mut _output []) (while (< _index (len _L)) { (set _output (append _output (@ _L _index))) @@ -197,7 +197,7 @@ (let list:take (fun (_L _n) { (mut _index 0) (mut _output []) - (set _n (min _n (len _L))) + (set _n (math:min _n (len _L))) (while (< _index _n) { (set _output (append _output (@ _L _index))) @@ -255,7 +255,7 @@ # =end # @author https://github.com/FrenchMasterSword (let list:zip (fun (_a _b) { - (let _m (min (len _a) (len _b))) + (let _m (math:min (len _a) (len _b))) (mut _c []) (mut _index 0) (while (< _index _m) { diff --git a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_medium.ark b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_medium.ark index 62d05c3e1..2df0da04c 100644 --- a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_medium.ark +++ b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_medium.ark @@ -9,17 +9,17 @@ (print "Generating callbacks") (mut acc 0) # here we are filling the list callbacks -(while (notEq acc (len data)) { - (mut d (at data acc)) +(while (!= acc (len data)) { + (mut d (@ data acc)) (set callbacks (append callbacks (fun (&d) (egg d)))) - (set acc (add 1 acc))}) + (set acc (+ 1 acc))}) # then we reset the accumulator (set acc 0) -(while (notEq acc (len callbacks)) { - (mut var (at callback acc)) +(while (!= acc (len callbacks)) { + (mut var (@ callbacks acc)) (print "stored: " var.d) (puts "Calling callback number " acc ": ") - (mut stored (at callbacks acc)) + (mut stored (@ callbacks acc)) (stored) - (set acc (add 1 acc))}) + (set acc (+ 1 acc))}) diff --git a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_simple.ark b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_simple.ark deleted file mode 100644 index 89acfc1a6..000000000 --- a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_simple.ark +++ /dev/null @@ -1,12 +0,0 @@ -(import some.important :code :base) - -(let a (if (equal b c) 1 "4")) -(if (foo a) - (print a " is a very interesting variable")) - -(mut foo (fun (bar egg &captured) { - (let yes indeed) - (add 1 yes)})) - -(while true { - (foo true nil false)}) diff --git a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_some_important.ark b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_some_important.ark new file mode 100644 index 000000000..c27e09cc3 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_some_important.ark @@ -0,0 +1,2 @@ +(let code 12) +(let base (fun () 14)) diff --git a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_builtins.ark b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_builtins.ark new file mode 100644 index 000000000..df0e0b98a --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_builtins.ark @@ -0,0 +1,10 @@ +(let in (list 1 2 3 4 5)) + +(mut i 0) +(while (< i 1000) { + (list:slice in 1 4 2) + (math:exp 5) + (math:ln 6) + (list:sort in) + + (set i (+ i 1)) }) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_callable_fmt_arg_not_found.ark b/tests/fuzzing/corpus-cmin/tests_errors_callable_fmt_arg_not_found.ark deleted file mode 100644 index 6beb8dbf6..000000000 --- a/tests/fuzzing/corpus-cmin/tests_errors_callable_fmt_arg_not_found.ark +++ /dev/null @@ -1 +0,0 @@ -(str:format "Hello {}, I'm {}" "World") diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_while.ark b/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_while.ark deleted file mode 100644 index 021d422aa..000000000 --- a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_while.ark +++ /dev/null @@ -1,3 +0,0 @@ -(while ($ a b) { - (set acc (+ acc (@ src a))) - (set a (+ 1 a))}) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_well_formed_args.ark b/tests/fuzzing/corpus-cmin/tests_errors_compiler_well_formed_args.ark deleted file mode 100644 index 5ce688e10..000000000 --- a/tests/fuzzing/corpus-cmin/tests_errors_compiler_well_formed_args.ark +++ /dev/null @@ -1,2 +0,0 @@ -($ defun (let name (fun args body))) -(defun foo (a b) (+ a b)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_del.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_del.ark new file mode 100644 index 000000000..1d5142edf --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_del.ark @@ -0,0 +1,2 @@ +(let a 1) +(del a) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_empty_begin.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_empty_begin.ark new file mode 100644 index 000000000..be1c1738b --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_empty_begin.ark @@ -0,0 +1 @@ +{{}} diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_macros.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_macros.ark deleted file mode 100644 index 25e9cb3d4..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_macros.ark +++ /dev/null @@ -1,93 +0,0 @@ -($ suffix-dup (sym x) { - ($if (> x 1) - (suffix-dup sym (- x 1))) - (symcat sym x)}) - -($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) - (fun (bloc) (func ...defargs bloc)) - ($undef bloc)}) - -(let test_func (fun (a b c) (* a b c))) -(let test_func1 (partial test_func 1)) - -(print "Generated partial functions for test_func (a b c) => (* a b c)") -(print "Expected arguments for test_func: " (argcount test_func) ", expected " 3) -(print "Expected arguments for test_func1: " (argcount test_func1) ", expected " 2) -(print "Calling them: " (test_func 1 2 3) " " (test_func1 2 3)) - -($ foo (a b) (+ a b)) -(print "Using macro foo (a b) => (+ a b): " (foo 1 2)) - -($ var 12) -(print "Using macro constant var=12: " var) - -($if (= var 12) - (print "This was executed in a if macro, testing var == 12") - (print "You shouldn't see this")) - -($if (and true true) - (print "This was executed in a if macro, testing (and true true)") - (print "You shouldn't see this (bis)")) - -($ defun (name args body) (let name (fun args body))) -(defun a_func (a b) (+ a b)) -(print "Generated a function with a macro, a_func (a b) => (+ a b)") -(print "Calling (a_func 1 2): " (a_func 1 2)) - -($ one (...args) (print "Macro 'one', returns the 2nd argument given in " args " => " (@ args 1))) -(one 1 2) -(one 1 3 4) -(one 1 5 6 7 8) - -($ last (...args) (print "Macro 'last', returns the last argument given in " args " => " (@ args -1))) -(last 1 2) -(last 1 3 4) -(last 1 5 6 7 8) - -{ - (print "Testing macros in scopes and macro shadowing") - - ($ test (+ 1 2 3)) - (print "(global) Reading macro 'test', expected 6, " test) - - ((fun () { - ($ test (- 1 2 3)) - (print "(sub scope) Reading macro 'test', expected -4, " test)})) - - (print "(global) Reading macro 'test', expected 6, " test) - - { - ($ test 555) - (print "(subscope) Reading macro 'test', expected 555, " test) - ($ undef test) - (print "(subscope, undef test) Reading macro 'test', expected 6, " test) - ($ undef a)}} - -(print "Demonstrating a threading macro") - -($ -> (arg fn1 ...fn) { - ($if (> (len fn) 0) - (-> (fn1 arg) ...fn) - (fn1 arg))}) - -(let filename "hello.json") - -(let f1 (fun (data) { - (print ">>f1 " data) - (+ data "-f1")})) - -(let f2 (fun (data) { - (print ">>f2 " data) - (+ data "-f2")})) - -(let f3 (fun (data) { - (print ">>f3 " data) - (+ data "-f3")})) - -(let f4 (fun (data) { - (print ">>f4 " data) - (+ data "-f4")})) - -(print "We expected calls to go like this: f1, f2, f3, f4") -(print (-> filename f1 f2 f3 f4)) # (f4 (f3 (f2 (f1 filename)))) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_99bottles.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark similarity index 69% rename from tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_99bottles.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark index d96a216af..a4482659b 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_99bottles.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark @@ -16,6 +16,6 @@ (mut n i) (while (> n 1) { - (print (str:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n)) + (print (string:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n)) (set n (- n 1)) - (print (str:format "{} Bottles of beer on the wall." n))}) + (print (string:format "{} Bottles of beer on the wall." n))}) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_ackermann.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark similarity index 76% rename from tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_ackermann.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark index 879145214..f652e592a 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_ackermann.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark @@ -6,16 +6,15 @@ # Due to its definitions in terms of extremely deep recursion, it can be used as a # benchmark of a compiler's ability to optimize recursion, which is the reason why # we are using this function to benchmark the language. - (let ackermann (fun (m n) { - (if (> m 0) - # then - (if (= 0 n) - # then - (ackermann (- m 1) 1) - # else - (ackermann (- m 1) (ackermann m (- n 1)))) - # else - (+ 1 n))})) + (if (> m 0) + # then + (if (= 0 n) + # then + (ackermann (- m 1) 1) + # else + (ackermann (- m 1) (ackermann m (- n 1)))) + # else + (+ 1 n)) })) (print "Ackermann-Péter function, m=3, n=6: " (ackermann 3 6)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_closures.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_closures.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark diff --git a/tests/fuzzing/corpus/tests_errors_macros_argcount_unknown_arg.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark similarity index 77% rename from tests/fuzzing/corpus/tests_errors_macros_argcount_unknown_arg.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark index 5d174463e..3e5b91265 100644 --- a/tests/fuzzing/corpus/tests_errors_macros_argcount_unknown_arg.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark @@ -1,10 +1,10 @@ ($ suffix-dup (sym x) { ($if (> x 1) (suffix-dup sym (- x 1))) - (symcat sym x)}) + ($symcat sym x)}) ($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) (fun (bloc) (func ...defargs bloc)) ($undef bloc)}) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_macros_at_out_of_range.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_macros_at_out_of_range.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark new file mode 100644 index 000000000..55e1a4b0f --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark @@ -0,0 +1 @@ +(import a :*) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark new file mode 100644 index 000000000..9c93a9ae2 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark @@ -0,0 +1,2 @@ +($ b ($symcat c)) +(print b) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_capture_can_not_call.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_can_not_call.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_capture_can_not_call.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_can_not_call.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark new file mode 100644 index 000000000..5fe57292f --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark @@ -0,0 +1,3 @@ +(let bar (fun () (let cap 0))) +(let foo (fun (&cap) ())) +(print foo bar) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_macros_duplicated_arg.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_macros_duplicated_arg.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark new file mode 100644 index 000000000..12413f26c --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark @@ -0,0 +1 @@ +(let print 5) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark new file mode 100644 index 000000000..ec5939a67 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark @@ -0,0 +1 @@ +(mut print 5) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_operators_freestanding.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_freestanding.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_operators_freestanding.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_freestanding.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_import_too_long.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_import_too_long.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_import_too_long.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_import_too_long.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark new file mode 100644 index 000000000..ec2576e62 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark @@ -0,0 +1 @@ +($ foo) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_codepoint.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_codepoint.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_codepoint.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_codepoint.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_escape_seq.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_escape_seq.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_func.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_func.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_func.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_func.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark new file mode 100644 index 000000000..2167bdc01 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark @@ -0,0 +1 @@ +(import a :123) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_let.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark similarity index 66% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_let.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark index 427dae0e2..f4d8906bc 100644 --- a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_let.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark @@ -1,5 +1,5 @@ ($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) }) (let test_func (fun (a b c) (* a b c))) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_macros_invalid_let_in_macro.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let_in_macro.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_macros_invalid_let_in_macro.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let_in_macro.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_node_in_call.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_call.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_node_in_call.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_call.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_node_in_list.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_list.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_node_in_list.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_list.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_node_in_ope.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_node_in_ope.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_node_in_tail_call.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_tail_call.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_invalid_node_in_tail_call.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_tail_call.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_macros_invalid_sym_func_def.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_macros_invalid_sym_func_def.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark new file mode 100644 index 000000000..b7ee31073 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark @@ -0,0 +1,2 @@ +(while ($ a 1) { + (mut acc (+ acc (@ [] a)))}) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_let_no_sym.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_let_no_sym.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_let_no_sym.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_let_no_sym.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark new file mode 100644 index 000000000..5619a01df --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark @@ -0,0 +1 @@ +($if (and true) {}) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark new file mode 100644 index 000000000..b934b651c --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark @@ -0,0 +1,2 @@ +($ a (empty? 1 2)) +(print a) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark new file mode 100644 index 000000000..ae9e1d050 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark @@ -0,0 +1,2 @@ +($ a (head 1 2)) +(print a) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark new file mode 100644 index 000000000..3a8d53292 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark @@ -0,0 +1,2 @@ +($ a (len 1 2)) +(print a) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark new file mode 100644 index 000000000..9d53f4983 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark @@ -0,0 +1 @@ +($if (or true) {}) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark new file mode 100644 index 000000000..0a312cc03 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark @@ -0,0 +1,2 @@ +($ a ($paste b [])) +(print a) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark new file mode 100644 index 000000000..6fcf3f1e6 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark @@ -0,0 +1,4 @@ +($ foo (a b c ...d) + (+ a b c ...d)) + +(foo 1 2) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark new file mode 100644 index 000000000..90a7a5151 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark @@ -0,0 +1,2 @@ +($ a ($symcat b [])) +(print a) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark new file mode 100644 index 000000000..714be5ad9 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark @@ -0,0 +1,2 @@ +($ a { ($symcat b) }) +(print a) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark new file mode 100644 index 000000000..4e89e75a3 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark @@ -0,0 +1,2 @@ +($ a ($symcat 5 2)) +(print a) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark new file mode 100644 index 000000000..0c4d06d7e --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark @@ -0,0 +1,2 @@ +($ a (tail 1 2)) +(print a) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_macros_max_depth.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_macros_max_depth.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark new file mode 100644 index 000000000..43c78c50e --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark @@ -0,0 +1,2 @@ +($ last ((last 1 5 6 7 8) 0 s "@" (@ a00s -9))) +(last 1 5 6 7 8) diff --git a/tests/fuzzing/corpus/tests_errors_macros_max_unification_depth.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark similarity index 96% rename from tests/fuzzing/corpus/tests_errors_macros_max_unification_depth.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark index ecad62b8e..10f94aaeb 100644 --- a/tests/fuzzing/corpus/tests_errors_macros_max_unification_depth.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark @@ -2,7 +2,7 @@ ($if (+ x 1) est_func ($ p (a b c) (* a b c))) - (symcat sym x)}) + ($symcat sym x)}) ($ partial (func ...defargs) { ($ bloc (suffix-dup a (len defargs))) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark new file mode 100644 index 000000000..cf41848d7 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark @@ -0,0 +1 @@ +(while 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark new file mode 100644 index 000000000..1bc9c9262 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark @@ -0,0 +1 @@ +(if) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark new file mode 100644 index 000000000..92900e7a2 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark @@ -0,0 +1 @@ +($if) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark new file mode 100644 index 000000000..b151c2fd3 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark @@ -0,0 +1 @@ +(while) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark new file mode 100644 index 000000000..0c42accde --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark @@ -0,0 +1 @@ +(fun ()) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark new file mode 100644 index 000000000..14aef1aaa --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark @@ -0,0 +1 @@ +(if 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark new file mode 100644 index 000000000..e9c905150 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark @@ -0,0 +1 @@ +($if true) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_operators_no_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_no_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_operators_no_args.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_no_args.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_operators_not_enough_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_operators_not_enough_args.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark new file mode 100644 index 000000000..203daf203 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark @@ -0,0 +1 @@ +(let bar 5) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_mutability_pop_in_place.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_pop_in_place.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_mutability_pop_in_place.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_pop_in_place.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark new file mode 100644 index 000000000..3c0711b8d --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark @@ -0,0 +1 @@ +($ foo (bar bar egg) ()) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_mutability_self_concat.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_self_concat.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_mutability_self_concat.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_self_concat.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_mutability_set_const.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_set_const.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_mutability_set_const.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_set_const.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_sub_import_too_long.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_sub_import_too_long.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_sub_import_too_long.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_sub_import_too_long.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_macros_too_many_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_macros_too_many_args.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_compiler_type_no_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_type_no_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_compiler_type_no_args.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_type_no_args.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_capture_unbound.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_capture_unbound.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark new file mode 100644 index 000000000..a8fb9bbf7 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark @@ -0,0 +1 @@ +(let a b) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark new file mode 100644 index 000000000..ca966b8d5 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark @@ -0,0 +1,2 @@ +(let bar 12) +(let a ber) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark new file mode 100644 index 000000000..cdff91fa0 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark @@ -0,0 +1 @@ +($undef 1) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_macros_unevaluated_spread.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unevaluated_spread.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_macros_unevaluated_spread.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unevaluated_spread.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark new file mode 100644 index 000000000..0b78bcd78 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark @@ -0,0 +1,5 @@ +($ defun (let name (fun args nil))) +(let foo 1) +(let a 2) +(let b 3) +(defun foo (a b) (+ a b)) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_callable_arity_error_async.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_arity_error_async.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_callable_arity_error_async.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_arity_error_async.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_index_at_out_of_range.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_index_at_out_of_range.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_out_of_range.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_index_at_str_out_of_range.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_str_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_index_at_str_out_of_range.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_str_out_of_range.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark new file mode 100644 index 000000000..a0a1d40de --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark @@ -0,0 +1,10 @@ +(let tests 0) +(let closure (fun (&tests) ())) + +(let a 1) +(let b 2) + +(let make (fun (a b) + (fun (&a &b) ()))) +(let foo (make "hello" 1)) +(let c [foo.a foo.b]) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_operators_db0.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_db0.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_operators_db0.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_db0.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_scope_del_unbound.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_del_unbound.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_scope_del_unbound.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_del_unbound.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark new file mode 100644 index 000000000..53938ca46 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark @@ -0,0 +1 @@ +(string:format "Hello {}, I'm {}" "World") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark new file mode 100644 index 000000000..2a99c795e --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark @@ -0,0 +1 @@ +(list:slice [1 2 3 4 5 6 7 8 9] 6 5 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark new file mode 100644 index 000000000..b88637a13 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark @@ -0,0 +1 @@ +(list:slice [1 2 3 4 5 6 7 8 9] 6 12 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark new file mode 100644 index 000000000..9d150c8a4 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark @@ -0,0 +1 @@ +(list:slice [1 2 3 4 5 6 7 8 9] -1 5 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark new file mode 100644 index 000000000..aa53b04c7 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark @@ -0,0 +1 @@ +(list:slice [1 2 3 4 5 6 7 8 9] 4 5 -1) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_type_not_a_closure.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_type_not_a_closure.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_callable_not_callable.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_callable_not_callable.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_callable_not_enough_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_not_enough_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_callable_not_enough_args.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_not_enough_args.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_index_pop_out_of_range.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_index_pop_out_of_range.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_callable_recursion_depth.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_recursion_depth.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_callable_recursion_depth.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_recursion_depth.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark new file mode 100644 index 000000000..b507a1ddb --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark @@ -0,0 +1 @@ +(string:removeAt "abc" 5) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_callable_too_many_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_too_many_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_callable_too_many_args.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_too_many_args.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_scope_unbound.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_unbound_var.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_scope_unbound.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_unbound_var.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_type_unknown_field.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_unknown_field.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_type_unknown_field.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_unknown_field.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark new file mode 100644 index 000000000..a72acb8a6 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark @@ -0,0 +1,3 @@ +{ + (print "hello") # comment +} diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comments_after_import.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comments_after_import.ark deleted file mode 100644 index 014e22008..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comments_after_import.ark +++ /dev/null @@ -1 +0,0 @@ -(import test) # test diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark new file mode 100644 index 000000000..423a8c59c --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark @@ -0,0 +1,8 @@ +(if server + { + # we can create multiple clients at the same time + (let cli2 (http:client:create "yahoo.com" 80)) + (set output (http:client:get cli2 "/")) + # the function returns a list: [code content] + (print (@ output 0)) # status: 301 + (let a 1)}) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_del.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_del.ark deleted file mode 100644 index ed7fda742..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_del.ark +++ /dev/null @@ -1,3 +0,0 @@ -(del a) -(del # comment -b) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_escape_seq.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_escape_seq.ark new file mode 100644 index 000000000..62c352648 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_escape_seq.ark @@ -0,0 +1,5 @@ +(let a "\r\n\v\t") +(let b "\\\"") +(let c "\a\b\f") +(let d "\u1234") +(let e "\U12345678") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_functions.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_functions.ark index 5ee5366c0..2a148fb95 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_functions.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_functions.ark @@ -17,3 +17,4 @@ a # capture &c) # body {}) +(let foo (fun () (if true false nil))) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_imports.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_imports.ark deleted file mode 100644 index 882a321ef..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_imports.ark +++ /dev/null @@ -1,13 +0,0 @@ -(import foo) -(import std.foo) -(import std.foo :a) -(import std.foo :a :b) -(import std.foo.bar:*) -(import # package -foo) -(import std.foo # item -:a) -(import std.foo # item -:a -# item -:b) diff --git a/tests/fuzzing/corpus-cmin/tests_arkscript_async-tests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_async-tests.ark similarity index 92% rename from tests/fuzzing/corpus-cmin/tests_arkscript_async-tests.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_async-tests.ark index 68ae39e1d..f80e2b9d7 100644 --- a/tests/fuzzing/corpus-cmin/tests_arkscript_async-tests.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_async-tests.ark @@ -37,5 +37,4 @@ (let time-async (- (time) start-async)) (test:eq 1000 res-async) - (test:eq 1000 res-non-async) - (test:expect (< time-async time-non-async))})}) + (test:eq 1000 res-non-async)})}) diff --git a/tests/fuzzing/corpus/tests_arkscript_builtins-tests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_builtins-tests.ark similarity index 64% rename from tests/fuzzing/corpus/tests_arkscript_builtins-tests.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_builtins-tests.ark index f4737e7c6..e1554c8c9 100644 --- a/tests/fuzzing/corpus/tests_arkscript_builtins-tests.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_builtins-tests.ark @@ -20,22 +20,23 @@ (test:eq (list:sort [5]) [5]) (test:eq (list:sort []) []) - # fixme - #(let short_list (list:fill 12 nil)) - #(test:eq (len short_list) 12) - #(mut i 0) - #(while (< i 12) { - # (test:eq (@ short_list i) nil) - # (set i (+ 1 i))}) - #(del i) -# - #(test:eq (@ (list:setAt short_list 5 "a") 5) "a") - #(del short_list) + (let short_list (list:fill 12 nil)) + (test:eq (len short_list) 12) + (mut i 0) + (while (< i 12) { + (test:eq (@ short_list i) nil) + (set i (+ 1 i))}) + (del i) + + (test:eq (@ (list:setAt short_list 5 "a") 5) "a") + (del short_list) (test:expect (not (io:fileExists? "test.txt"))) (io:writeFile "test.txt" "hello, world!") (test:expect (io:fileExists? "test.txt")) (test:eq (io:readFile "test.txt") "hello, world!") + (io:appendToFile "test.txt" "bis") + (test:eq (io:readFile "test.txt") "hello, world!bis") (test:expect (> (len (io:listFiles "./")) 0)) (test:expect (not (io:dir? "test.txt"))) (test:expect (not (io:fileExists? "temp"))) @@ -46,17 +47,14 @@ (sys:sleep 1) (test:expect (< old (time))) - # no need to test str:format, we are already using it for the assertions, - # and it's also heavily tested in the C++ String repository in the ArkScript-lang organization (github) - - (test:eq (str:find "abc" "d") -1) - (test:eq (str:find "abc" "a") 0) - (test:eq (str:find "abc" "bc") 1) - (test:eq (str:find "abcdefghijkl" "defijkl") -1) - (test:eq (str:find "abcdefghijkl" "defghijkl") 3) - (test:eq (str:removeAt "abcdefghijkl" 3) "abcefghijkl") - (test:eq (str:removeAt "abcdefghijkl" 0) "bcdefghijkl") - (test:eq (str:removeAt "abcdefghijkl" 11) "abcdefghijk") + (test:eq (string:find "abc" "d") -1) + (test:eq (string:find "abc" "a") 0) + (test:eq (string:find "abc" "bc") 1) + (test:eq (string:find "abcdefghijkl" "defijkl") -1) + (test:eq (string:find "abcdefghijkl" "defghijkl") 3) + (test:eq (string:removeAt "abcdefghijkl" 3) "abcefghijkl") + (test:eq (string:removeAt "abcdefghijkl" 0) "bcdefghijkl") + (test:eq (string:removeAt "abcdefghijkl" 11) "abcdefghijk") # no need to test the math functions since they're 1:1 binding of C++ functions and were carefully checked # before writing this comment, to ensure we aren't binding math:sin to the C++ tan function diff --git a/tests/fuzzing/corpus/tests_arkscript_list-tests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_list-tests.ark similarity index 91% rename from tests/fuzzing/corpus/tests_arkscript_list-tests.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_list-tests.ark index 0da2ea6ff..e22ff7b65 100644 --- a/tests/fuzzing/corpus/tests_arkscript_list-tests.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_list-tests.ark @@ -4,14 +4,14 @@ (let b [4 5 6]) (test:suite list { - (let make (fun (a b) - (fun (&a &b) ()))) + (let make (fun (c d) + (fun (&c &d) ()))) (let foo (make "hello" 1)) # if this is failing, this is most likely to be a compiler problem - (test:eq ["hello" 1] [foo.a foo.b]) - (test:eq 2 (len [foo.a foo.b])) - (test:eq ["hello"] (append [] foo.a)) + (test:eq ["hello" 1] [foo.c foo.d]) + (test:eq 2 (len [foo.c foo.d])) + (test:eq ["hello"] (append [] foo.c)) (test:case "append and return a new list" { (test:eq (append a 4) [1 2 3 4]) diff --git a/tests/fuzzing/corpus/tests_arkscript_macro-tests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_macro-tests.ark similarity index 77% rename from tests/fuzzing/corpus/tests_arkscript_macro-tests.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_macro-tests.ark index be7a0c3dd..faef3ddf5 100644 --- a/tests/fuzzing/corpus/tests_arkscript_macro-tests.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_macro-tests.ark @@ -3,11 +3,11 @@ ($ suffix-dup (sym x) { ($if (> x 1) (suffix-dup sym (- x 1))) - (symcat sym x)}) + ($symcat sym x)}) (let magic_func (fun ((suffix-dup a 3)) (- a1 a2 a3))) ($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) (fun (bloc) (func ...defargs bloc)) ($undef bloc)}) @@ -25,7 +25,25 @@ ($ add_two (a b) (+ a b)) (test:eq (add_two 1 2) 3) - (test:eq (add_two nice_value 2) 14) }) + (test:eq (add_two nice_value 2) 14) + + ($ c (a b) (* a b)) + (test:eq (c 4 10) 40) + + ($ d (a b) (/ a b)) + (test:eq (d 10 2) 5) }) + + (test:case "node manipulation" { + ($ node_tail () (tail (begin 1 2 3))) + ($ length () (len (fun () 5))) + ($ not_empty_node () (empty? (fun () ()))) + ($ empty_node () (empty? ())) + + (test:eq (length) 3) + (test:eq (not_empty_node) false) + (test:eq (empty_node) true) + # because it removes the "begin" + (test:eq (node_tail) [1 2 3]) }) (test:case "conditional macros" { (test:expect ($if (and true true) true false)) @@ -41,11 +59,14 @@ (test:expect ($if (>= nice_value 12) true false)) (test:expect ($if (@ [true false] 0) true false)) (test:expect ($if (@ [true false] -2) true false)) + (test:expect ($if 1 true false)) ($if true { ($ in_if_1 true) ($ in_if_2 true)}) + ($if true ($ new_value true)) (test:expect (and in_if_1 in_if_2) "a variable can be defined inside a conditional macro") + (test:expect new_value "variable can be defined inside a conditional macro") ($undef in_if_1) ($undef in_if_2) }) @@ -113,7 +134,7 @@ (test:case "define variable with a macro adding a suffix" { ($ nice_value 12) - ($ define (prefix suffix value) (let (symcat prefix suffix) value)) + ($ define (prefix suffix value) (let ($symcat prefix suffix) value)) (define a 1 2) (test:eq a1 2) @@ -126,11 +147,11 @@ (test:case "partial functions" { (test:eq (magic_func 1 2 3) (- 1 2 3)) - (test:eq (argcount test_func) 3) - (test:eq (argcount test_func1) 2) - (test:eq (argcount test_func1_2) 1) - (test:eq (argcount (fun () ())) 0) - (test:eq (argcount (fun (a) ())) 1) - (test:eq (argcount (fun (a b g h u t) ())) 6) + (test:eq ($argcount test_func) 3) + (test:eq ($argcount test_func1) 2) + (test:eq ($argcount test_func1_2) 1) + (test:eq ($argcount (fun () ())) 0) + (test:eq ($argcount (fun (a) ())) 1) + (test:eq ($argcount (fun (a b g h u t) ())) 6) (test:eq (test_func 1 2 3) (test_func1 2 3)) (test:eq (test_func 1 2 3) (test_func1_2 3)) })}) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_string-tests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_string-tests.ark new file mode 100644 index 000000000..4322afa25 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_string-tests.ark @@ -0,0 +1,18 @@ +(import std.Testing) + +(test:suite string { + (test:case "remove char in string at index" { + (test:eq "hllo world" (string:removeAt "hello world" 1)) + (test:eq "ello world" (string:removeAt "hello world" 0)) + (test:eq "hello worl" (string:removeAt "hello world" 10)) }) + + (test:case "find substring" { + (test:eq -1 (string:find "hello" "help")) + (test:eq 0 (string:find "hello" "hel")) + (test:eq 2 (string:find "hello" "llo")) + (test:eq -1 (string:find "" "1")) }) + + (test:case "format strings" { + (test:eq "nilfalsetrue" (string:format "{}{}{}" nil false true)) + (test:eq "CProcedure" (string:format "{}" print)) + })}) diff --git a/tests/fuzzing/corpus/tests_arkscript_utf8-tests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_utf8-tests.ark similarity index 82% rename from tests/fuzzing/corpus/tests_arkscript_utf8-tests.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_utf8-tests.ark index 5294d6adf..75e357724 100644 --- a/tests/fuzzing/corpus/tests_arkscript_utf8-tests.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_utf8-tests.ark @@ -26,7 +26,7 @@ (test:eq "\u1E0B" "ḋ") }) (test:case "testing emoji codepoints computing" { - (test:eq (str:ord "👺") 128122) - (test:eq (str:chr 128122) "👺") - (test:eq (str:ord "$") 36) - (test:eq (str:chr 36) "$") })}) + (test:eq (string:ord "👺") 128122) + (test:eq (string:chr 128122) "👺") + (test:eq (string:ord "$") 36) + (test:eq (string:chr 36) "$") })}) diff --git a/tests/fuzzing/corpus/tests_arkscript_vm-tests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_vm-tests.ark similarity index 91% rename from tests/fuzzing/corpus/tests_arkscript_vm-tests.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_vm-tests.ark index 6f0cdeeb7..12af3af6c 100644 --- a/tests/fuzzing/corpus/tests_arkscript_vm-tests.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_vm-tests.ark @@ -12,7 +12,7 @@ (let closure_3 (make 3 2 3)) (let closure_4 (make2 1 2 3)) -(let inner 0) +(mut inner 0) (let call (fun () { (set val 5) (set inner 12) })) @@ -30,6 +30,7 @@ (test:case "arithmetic operations" { (test:eq (+ 1 2) 3) (test:eq (+ 1.5 2.5) 4.0) + (test:eq (+ "a" "b") "ab") (test:eq (- 1 2) -1) (test:eq (- 1.5 2) -0.5) (test:eq (/ 1 2) 0.5) @@ -102,6 +103,13 @@ (test:eq (@ ["h" "e" "l" "l" "o"] -1) "o") (test:eq (@ ["h" "e" "l" "l" "o"] -4) "e") }) + (test:case "Short-circuiting" { + (let falsy (fun () { + (test:expect false) + false })) + (test:expect (or true (falsy))) + (test:expect (not (and false (falsy)))) }) + (test:case "De Morgan's law" { (test:expect (and true true true)) (test:expect (not (and true nil true))) @@ -118,11 +126,11 @@ (test:eq (type nil) "Nil") (test:eq (type true) "Bool") (test:eq (type false) "Bool") - (test:expect (hasField closure "tests")) + (test:expect (hasField closure "vm-tests:tests")) (test:expect (not (hasField closure "12"))) }) (test:case "closures" { - (test:eq (toString closure) "(.tests=0)") + (test:eq (toString closure) "(.vm-tests:tests=0)") (test:eq closure_1 closure_1_bis) (test:eq closure_1 closure_2) (test:neq closure_1 closure_4) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_basic_b.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_basic_b.ark new file mode 100644 index 000000000..37154aef8 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_basic_b.ark @@ -0,0 +1,7 @@ +(let foo (fun (arg arg2) + (bar arg arg2))) + +(let arg "b:arg") + +(let bar (fun (one two) + (+ one " " two))) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark new file mode 100644 index 000000000..8e2e0a08a --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark @@ -0,0 +1,8 @@ +(mut inner 0) +(let call (fun () { + (set val 5) + (set inner 12) })) +(let get (fun () [val inner])) +(let child (fun (&inner &call &get) ())) +(mut val 1) +(let parent (fun (&val &child) ())) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark new file mode 100644 index 000000000..175770420 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark @@ -0,0 +1,2 @@ +(let make_suite (fun (name) name)) +(let suite (make_suite "c:suite")) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark new file mode 100644 index 000000000..044b3dd33 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark @@ -0,0 +1,3 @@ +(let make (fun (a b c) + "b:make")) +(let result (make 1 2 3)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark new file mode 100644 index 000000000..d45198bbd --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark @@ -0,0 +1,7 @@ +(mut result nil) + +((fun () { + (let make (fun (a b) + "c:make")) + (set result (make "hello" 1)) + })) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_fun.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_fun.ark deleted file mode 100644 index f45c56655..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_fun.ark +++ /dev/null @@ -1 +0,0 @@ -(fun (a b &c)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_import_2.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_import_2.ark deleted file mode 100644 index 42e8c20f6..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_import_2.ark +++ /dev/null @@ -1 +0,0 @@ -(import a. ) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_import.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_import.ark deleted file mode 100644 index e7578bd1c..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_import.ark +++ /dev/null @@ -1,16 +0,0 @@ -(import a) -(import a.b) -( -import # keyword -# package -foo.bar.egg # end of line -# end of package -) -(import foo:*) -(import foo.bar:*) -(import foo.bar.egg:*) -(import foo :a) -(import foo.bar # cool package -:a # a nice symbol -:b# another symbol we need -) diff --git a/tests/fuzzing/corpus-cmin/text b/tests/fuzzing/corpus-cmin/text deleted file mode 100644 index 9dd561fdb..000000000 --- a/tests/fuzzing/corpus-cmin/text +++ /dev/null @@ -1 +0,0 @@ -hello, world0 diff --git a/tests/fuzzing/corpus/c.ark b/tests/fuzzing/corpus/c.ark new file mode 100644 index 000000000..83f8058f7 --- /dev/null +++ b/tests/fuzzing/corpus/c.ark @@ -0,0 +1,191 @@ +# @brief Return the absolute value of a number +# @param _x the number to get the absolute value of +# @author https://github.com/rstefanic +(let abs (fun (_x) + (if (< _x 0) + (* -1 _x) + _x))) + +# @brief Return true if the number is even, false otherwise +# @param _n the number +# @author https://github.com/rstefanic +(let even (fun (_n) (= 0 (mod _n 2)))) + +# @brief Return true if the number is odd, false otherwise +# @param _n the number +# @author https://github.com/rstefanic +(let odd (fun (_n) (= 1 (abs (mod _n 2))))) + +# @brief Get the minimum between two numbers +# @param _a the first number +# @param _b the second number +# @author https://github.com/rstefanic +(let min (fun (_a _b) + (if (< _a _b) + _a + _b))) + +# @brief Get the maximum between two numbers +# @param _a the first number +# @param _b the second number +# @author https://github.com/rstefanic +(let max (fun (_a _b) + (if (> _a _b) + _a + _b))) + +# @brief Get a number to a given power +# @details Note that it's defined as exp(a * ln(x)), thus won't work for negative numbers +# @param _x the number to pow +# @param _a the exponent +# @author https://github.com/SuperFola +(let pow (fun (_x _a) (math:exp (* _a (math:ln _x))))) + +# @brief Get the square root of a number +# @details Square roots can't be taken for negative numbers for obvious reasons. +# @param _x the number +# @author https://github.com/SuperFola +(let sqrt (fun (_x) (math:exp (* 0.5 (math:ln _x))))) + +# @brief Run the fibonacci function on a number +# @param n the number +# @author https://github.com/SuperFola +# =begin +# (fibo 45 0 1) +# =end +(let fibo (fun (n) { + (let impl (fun (n p c) + (if (<= n 0) + 0 + (if (= n 1) + c + (impl (- n 1) c (+ p c)))))) + (impl n 0 1) })) + +# @brief Returns the list of a number's divisors +# @param n the number +# @author https://github.com/Wafelack +# =begin +# (divs 6) # Returns [1 2 3 6] +# =end +(let divs (fun (n) { + (assert (>= n 2) "divs: n must be greater or equal to 2") + (mut i 2) + (mut divisors [1]) + (let top (math:ceil (/ n 2))) + + (while (and (<= i top) (!= top n)) { + (if (= (mod n i) 0) + (set divisors (append divisors i))) + (set i (+ i 1)) }) + (append divisors n) })) + +# @brief Returns the logarithm base n of a number +# @param x the number +# @param n the base +# @author https://github.com/Gryfenfer97 +# =begin +# (log 81 3) # Returns 4 +# =end +(let log (fun (x n) { + (assert (> x 0) "log: x must be greater than 0") + (assert (>= n 1) "log: n must be greater or equal to 1") + (math:round (/ (math:ln x) (math:ln n))) })) + +# @brief Returns the logarithm base 2 of a number +# @param x the number +# @author https://github.com/Gryfenfer97 +# =begin +# (log2 128) # Returns 7 +# =end +(let log2 (fun (x) (log x 2))) + +# @brief Returns the logarithm base 10 of a number +# @param x the number +# @author https://github.com/Gryfenfer97 +# =begin +# (log10 1000) # Returns 3 +# =end +(let log10 (fun (x) (log x 10))) + +# @brief Returns the quotient of the euclidian division of a and b +# @param a the dividend +# @param b the divisor +# @author https://github.com/fabien-zoccola +# =begin +# (floordiv 14 6) # Returns 2 +# =end +(let floordiv (fun (a b) (math:floor (/ a b)))) + +# @brief Create a complex number +# @param real the real part of the complex number +# @param imag the imaginary value +# =begin +# (let c (complex 1 2)) +# (print c.real " " c.imag) # 1 2 +# =end +# @author https://github.com/SuperFola +(let complex (fun (real imag) + (fun (&real &imag) ()))) + +# @brief Compute the addition of two complex number +# @param _c0 the first complex number +# @param _c1 the second complex number +# =begin +# (let c (complex-add (complex 1 2) (complex 3 4))) +# (print c.real " " c.imag) # 4 6 +# =end +# @author https://github.com/SuperFola +(let complex-add (fun (_c0 _c1) (complex (+ _c0.real _c1.real) (+ _c0.imag _c1.imag)))) + +# @brief Compute the subtraction of two complex number +# @param _c0 the first complex number +# @param _c1 the second complex number +# =begin +# (let c (complex-sub (complex 1 2) (complex 3 4))) +# (print c.real " " c.imag) # -2 -2 +# =end +# @author https://github.com/SuperFola +(let complex-sub (fun (_c0 _c1) (complex (- _c0.real _c1.real) (- _c0.imag _c1.imag)))) + +# @brief Compute the multiplication of two complex number +# @param _c0 the first complex number +# @param _c1 the second complex number +# =begin +# (let c (complex-mul (complex 1 2) (complex 3 4))) +# (print c.real " " c.imag) # -5 10 +# =end +# @author https://github.com/SuperFola +(let complex-mul (fun (_c0 _c1) (complex (+ (* _c0.real _c1.real) (- 0 (* _c0.imag _c1.imag))) (+ (* _c0.real _c1.imag) (* _c1.real _c0.imag))))) + +# @brief Compute the conjugate of a complex number +# @param _c the complex number +# =begin +# (let c (complex-conjugate (complex 1 2))) +# (print c.real " " c.imag) # 1 -2 +# =end +# @author https://github.com/SuperFola +(let complex-conjugate (fun (_c) (complex _c.real (- 0 _c.imag)))) + +# @brief Compute the module of a complex number +# @param _c the complex number +# =begin +# (let c (complex-module (complex 1 2))) +# (print c) # 2.2360679774997896964... +# =end +# @author https://github.com/SuperFola +(let complex-module (fun (_c) (sqrt (+ (* _c.real _c.real) (* _c.imag _c.imag))))) + +# @brief Compute the division of two complex number +# @param _c0 the first complex number +# @param _c1 the second complex number +# =begin +# (let c (complex-div (complex 1 2) (complex 3 4))) +# (print c.real " " c.imag) # 0.44 0.08 +# =end +# @author https://github.com/SuperFola +(let complex-div (fun (_c0 _c1) { + (let _conj (complex-conjugate _c1)) + (let _top (complex-mul _c0 _conj)) + (let _denom (+ (* _c1.real _c1.real) (* _c1.imag _c1.imag))) + (complex (/ _top.real _denom) (/ _top.imag _denom)) })) diff --git a/tests/fuzzing/corpus/examples_99bottles.ark b/tests/fuzzing/corpus/examples_99bottles.ark index a4482659b..5ddb82010 100644 --- a/tests/fuzzing/corpus/examples_99bottles.ark +++ b/tests/fuzzing/corpus/examples_99bottles.ark @@ -9,13 +9,17 @@ # 98 bottles of beer # Take one down, pass it around # 97 bottles of beer on the wall - - -(let arg (if (>= (len sys:args) 1) (toNumber (@ sys:args 0)) nil)) -(let i (if (nil? arg) 100 arg)) +(let arg + (if (>= (len sys:args) 1) + (toNumber (@ sys:args 0)) + nil)) +(let i + (if (nil? arg) + 100 + arg)) (mut n i) (while (> n 1) { - (print (string:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n)) - (set n (- n 1)) - (print (string:format "{} Bottles of beer on the wall." n))}) + (print (string:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n)) + (set n (- n 1)) + (print (string:format "{} Bottles of beer on the wall." n)) }) diff --git a/tests/fuzzing/corpus/examples_ackermann.ark b/tests/fuzzing/corpus/examples_ackermann.ark index 879145214..f652e592a 100644 --- a/tests/fuzzing/corpus/examples_ackermann.ark +++ b/tests/fuzzing/corpus/examples_ackermann.ark @@ -6,16 +6,15 @@ # Due to its definitions in terms of extremely deep recursion, it can be used as a # benchmark of a compiler's ability to optimize recursion, which is the reason why # we are using this function to benchmark the language. - (let ackermann (fun (m n) { - (if (> m 0) - # then - (if (= 0 n) - # then - (ackermann (- m 1) 1) - # else - (ackermann (- m 1) (ackermann m (- n 1)))) - # else - (+ 1 n))})) + (if (> m 0) + # then + (if (= 0 n) + # then + (ackermann (- m 1) 1) + # else + (ackermann (- m 1) (ackermann m (- n 1)))) + # else + (+ 1 n)) })) (print "Ackermann-Péter function, m=3, n=6: " (ackermann 3 6)) diff --git a/tests/fuzzing/corpus/examples_blockchain.ark b/tests/fuzzing/corpus/examples_blockchain.ark index 04af95fe5..e06bed22f 100644 --- a/tests/fuzzing/corpus/examples_blockchain.ark +++ b/tests/fuzzing/corpus/examples_blockchain.ark @@ -7,162 +7,161 @@ # define what an ArkCoin block is (let make:block (fun (index timestamp data previous_hash) { - (let hash (hash:sha256 (+ (toString index) (toString (math:floor timestamp)) (json:toString data) previous_hash))) - (print "made block " hash) - (fun (&index ×tamp &data &previous_hash &hash) ())})) + (let hash (hash:sha256 (+ (toString index) (toString (math:floor timestamp)) (json:toString data) previous_hash))) + (print "made block " hash) + (fun (&index ×tamp &data &previous_hash &hash) ()) })) -(let make:block:fromJSON (fun (data) - (make:block (json:get data "index") - (json:get data "timestamp") - (json:get data "data") - (json:get data "hash")))) +(let make:block:fromJSON (fun (data) (make:block (json:get data "index") (json:get data "timestamp") (json:get data "data") (json:get data "hash")))) # generate genesis block -(let make:genesis_block (fun () - (make:block 0 (time) (json:fromList [ - "type" "Genesis block" - "proof-of-work" 1 - ]) "deadbeef"))) +(let make:genesis_block (fun () (make:block 0 (time) (json:fromList ["type" "Genesis block" "proof-of-work" 1]) "deadbeef"))) # let the user add their miner address if we can't find it -(let miner_address (if (not (io:fileExists? "miner.address")) +(let miner_address + (if (not (io:fileExists? "miner.address")) (input "miner address> ") (io:readFile "miner.address"))) (io:writeFile "miner.address" miner_address) + # this node's blockchain copy -(mut blockchain (list (make:genesis_block))) +(mut blockchain [(make:genesis_block)]) + # storing the transactions that this node has (mut nodes_transactions []) + # storing the url data of every other node in the network so we can talk with them (mut peer_nodes []) + # magic number for the proof of work (let magic 12) (let find_new_chains (fun () { - (print "finding new chains") - - # get the blockchains of every other node - (mut other_chains []) - (list:forEach peer_nodes (fun (url) { - (let cli (http:client:create url 80)) - (let tmp (http:client:get cli "/")) - (if (not (nil? tmp)) - { - (let content (make:block:fromJSON (json:fromString (@ tmp 1)))) - (set other_chains (append other_chains content))}) - (del cli)})) - other_chains })) - -(let verify_proof_of_work (fun (proof last_proof) - (and (> proof last_proof) (= 0 (mod proof magic)) (= 0 (mod proof last_proof))))) + (print "finding new chains") + + # get the blockchains of every other node + (mut other_chains []) + + (list:forEach + peer_nodes + (fun (url) { + (let cli (http:client:create url 80)) + (let tmp (http:client:get cli "/")) + + (if (not (nil? tmp)) { + (let content (make:block:fromJSON (json:fromString (@ tmp 1)))) + (set other_chains (append other_chains content)) }) + (del cli) })) + other_chains })) + +(let verify_proof_of_work (fun (proof last_proof) (and (> proof last_proof) (= 0 (mod proof magic)) (= 0 (mod proof last_proof))))) (let verify_chain (fun (chain) { - (print "verifying chain") + (print "verifying chain") - (mut previous nil) - (mut ok? true) - (list:forEach chain (fun (block) { - # no need to continue checking the blocks if a block wasn't ok - (if (and ok? (not (nil? previous))) - (set ok? (verify_proof_of_work (json:get block.data "proof-of-work") (json:get previous.data "proof-of-work")))) - (set previous block)})) - ok? })) + (mut previous nil) + (mut ok? true) + + (list:forEach + chain + (fun (block) { + # no need to continue checking the blocks if a block wasn't ok + (if (and ok? (not (nil? previous))) + (set ok? (verify_proof_of_work (json:get block.data "proof-of-work") (json:get previous.data "proof-of-work")))) + (set previous block) })) + ok? })) (let consensus (fun () { - (print "consensus running") + (print "consensus running") + + (let other_chains (find_new_chains)) - (let other_chains (find_new_chains)) - # if our chain isn't longest, then we store the longest - (list:forEach other_chains (fun (chain) { - (if (and (< (len blockchain) (len chain)) (verify_chain chain)) - (set blockchain chain))}))})) + # if our chain isn't longest, then we store the longest + (list:forEach + other_chains + (fun (chain) { + (if (and (< (len blockchain) (len chain)) (verify_chain chain)) + (set blockchain chain)) })) })) (let proof_of_work (fun (last_proof) { - (print "proof of work being generated") + (print "proof of work being generated") - (mut inc (+ 1 last_proof)) - # keep incrementing until it's equal to a number divisible by 12 and - # the proof of work of the previous block in the chain - (while (not (and (= 0 (mod inc magic))) (= 0 (mod inc last_proof))) - (set inc (+ 1 inc))) - inc })) + (mut inc (+ 1 last_proof)) + + # keep incrementing until it's equal to a number divisible by 12 and + # the proof of work of the previous block in the chain + (while (not (and (= 0 (mod inc magic))) (= 0 (mod inc last_proof))) + (set inc (+ 1 inc))) + inc })) (let srv (http:server:create)) -(http:server:post srv "/transaction" (fun (request) { +(http:server:post + srv + "/transaction" + (fun (request) { (print "posting block " request) # on each post request, extract transaction data (let new (json:fromString request)) (set nodes_transactions (append nodes_transactions new)) (print "New transaction") - (print (str:format "FROM: {}" (json:get new "from"))) - (print (str:format "TO: {}" (json:get new "to"))) - (print (str:format "AMOUNT: {}" (json:get new "amount"))) + (print (string:format "FROM: {}" (json:get new "from"))) + (print (string:format "TO: {}" (json:get new "to"))) + (print (string:format "AMOUNT: {}" (json:get new "amount"))) # return value - [200 "transaction submission successful" "text/plain"]})) + [200 "transaction submission successful" "text/plain"] })) -(http:server:get srv "/blocks" (fun (_) { +(http:server:get + srv + "/blocks" + (fun (_) { (print "fetching blocks") (consensus) (mut to_send []) - (list:forEach blockchain (fun (data) { - (set to_send (append to_send (json:fromList [ - "index" data.index - "timestamp" data.timestamp - "data" data.data - "hash" data.hash])))})) + + (list:forEach + blockchain + (fun (data) { + (set to_send (append to_send (json:fromList ["index" data.index "timestamp" data.timestamp "data" data.data "hash" data.hash]))) })) (mut str (toString (@ to_send 0))) - (list:forEach (tail to_send) (fun (e) - (set str (+ str ", " (toString e))))) - [200 (+ "{\"chain\": [" str "]}") "application/json"]})) + (list:forEach + (tail to_send) + (fun (e) + (set str (+ str ", " (toString e))))) + [200 (+ "{\"chain\": [" str "]}") "application/json"] })) -(http:server:get srv "/mine" (fun (data) { +(http:server:get + srv + "/mine" + (fun (data) { (print "mining block") (print (type data)) - (if (not (nil? data)) - (print (http:params:toList data))) + + (if (not (nil? data)) (print (http:params:toList data))) (set data "") (let last_block (@ blockchain -1)) (let last_proof (json:get last_block.data "proof-of-work")) + # find the proof of work for the current block being mined # the program will hang here until a new proof of work is found (let proof (proof_of_work last_proof)) + # once we have the proof of work, we can mine a block so we reward the miner by adding a transaction - (set nodes_transactions (append nodes_transactions (json:fromList - [ - "from" "network" - "to" miner_address - "amount" 1]))) + (set nodes_transactions (append nodes_transactions (json:fromList ["from" "network" "to" miner_address "amount" 1]))) (print "make block") + # gather the data needed to create a new block - (mut new_block (make:block - (+ 1 last_block.index) - (time) - (json:fromList - [ - "proof-of-work" proof - "transactions" nodes_transactions - "content" data ]) - last_block.hash)) + (mut new_block (make:block (+ 1 last_block.index) (time) (json:fromList ["proof-of-work" proof "transactions" nodes_transactions "content" data]) last_block.hash)) (set blockchain (append blockchain new_block)) + # empty transactions list (set nodes_transactions []) - - [ - 200 - (+ "{" - "\"index\": " (toString new_block.index) "," - "\"timestamp\": " (toString new_block.timestamp) "," - "\"data\": " (toString new_block.data) "," - "\"hash\": \"" (toString new_block.hash) "\"" - "}") - "application/json"]})) + [200 (+ "{" "\"index\": " (toString new_block.index) "," "\"timestamp\": " (toString new_block.timestamp) "," "\"data\": " (toString new_block.data) "," "\"hash\": \"" (toString new_block.hash) "\"" "}") "application/json"] })) (print "Listening on localhost:80 for miner " miner_address) (http:server:listen srv "localhost" 80) diff --git a/tests/fuzzing/corpus/examples_callbacks.ark b/tests/fuzzing/corpus/examples_callbacks.ark index e6ee543b0..b76b738c8 100644 --- a/tests/fuzzing/corpus/examples_callbacks.ark +++ b/tests/fuzzing/corpus/examples_callbacks.ark @@ -1,28 +1,34 @@ # a function which just prints its argument (let egg (fun (bar) (print bar))) + # the data we're going to give to this function (let data ["Iron Man" "is" "Tony Stark"]) + # a list of function call which should be executed later on (mut callbacks []) (print "Data: " data) (print "Generating callbacks") (mut acc 0) + # here we are filling the list callbacks (while (!= acc (len data)) { - (mut d (@ data acc)) - # by putting in it closures that captured d, an element of `data` - # and call the function egg on it - (set callbacks (append callbacks (fun (&d) (egg d)))) - (set acc (+ 1 acc))}) + (mut d (@ data acc)) + + # by putting in it closures that captured d, an element of `data` + # and call the function egg on it + (set callbacks (append callbacks (fun (&d) (egg d)))) + (set acc (+ 1 acc)) }) # then we reset the accumulator (set acc 0) (while (!= acc (len callbacks)) { - # we print what was stored in the closure using dot notation - (print "stored: " (@ callbacks acc) .d) - # and then we call the closure itself (be careful: (@ callbacks acc) only returns the callback, - # thus we need to put it in another pair of parens to call the callback) - (puts "Calling callback number " acc ": ") - ((@ callbacks acc)) - (set acc (+ 1 acc))}) + # we print what was stored in the closure using dot notation + (mut stored (@ callbacks acc)) + (print "stored: " stored.d) + + # and then we call the closure itself (be careful: (@ callbacks acc) only returns the callback, + # thus we need to put it in another pair of parens to call the callback) + (puts "Calling callback number " acc ": ") + ((@ callbacks acc)) + (set acc (+ 1 acc)) }) diff --git a/tests/fuzzing/corpus/examples_closures.ark b/tests/fuzzing/corpus/examples_closures.ark index f818e5632..cd9d23e9d 100644 --- a/tests/fuzzing/corpus/examples_closures.ark +++ b/tests/fuzzing/corpus/examples_closures.ark @@ -1,15 +1,15 @@ # Inspired by # Closures and object are equivalent: http://wiki.c2.com/?ClosuresAndObjectsAreEquivalent - # this will construct a closure capturing the 3 arguments, plus a function to set the age (let create-human (fun (name age weight) { - # functions can be invoked in the closure scope - (let set-age (fun (new-age) (set age new-age))) + # functions can be invoked in the closure scope + (let set-age (fun (new-age) + (set age new-age))) - # the return value, our closure - # the &name notation is used in the argument list to explicitly capture - # a variable (using deep copy) - (fun (&set-age &name &age &weight) ())})) + # the return value, our closure + # the &name notation is used in the argument list to explicitly capture + # a variable (using deep copy) + (fun (&set-age &name &age &weight) ()) })) # we create 2 humans using such construction, just a nice function call (let bob (create-human "Bob" 0 144)) @@ -17,30 +17,29 @@ # using the dot notation on a closure object, we can have a **read only** access to its fields (print "Bob's age: " bob.age) + # and even call the captured functions, which will enter the closure, and be given a **read write** access # meaning that, even if the fields are read only (eg, we can not do (set bob.age 14)), the "object" can be modified (print "Setting Bob's age to 10") (bob.set-age 10) + # the age changed (print "New age: " bob.age) # but john age didn't change, because we created 2 separated closures (print "John's age, didn't change: " john.age) - - # Another example to simulate a python range(x, y) - # this function will return a closure capturing the number given # and modifying its value each time we'll call the closure, returning # the new number (let countdown-from (fun (number) - (fun (&number) { - (set number (- number 1)) - number }))) + (fun (&number) { + (set number (- number 1)) + number }))) (let countdown-from-3 (countdown-from 3)) -(print "Countdown " (countdown-from-3)) # 2 -(print "Countdown " (countdown-from-3)) # 1 -(print "Countdown " (countdown-from-3)) # 0 +(print "Countdown " (countdown-from-3)) # 2 +(print "Countdown " (countdown-from-3)) # 1 +(print "Countdown " (countdown-from-3)) # 0 diff --git a/tests/fuzzing/corpus/examples_collatz.ark b/tests/fuzzing/corpus/examples_collatz.ark index 2828e7ab1..917a223ac 100644 --- a/tests/fuzzing/corpus/examples_collatz.ark +++ b/tests/fuzzing/corpus/examples_collatz.ark @@ -1,23 +1,22 @@ # If the number is even, divide it by two. # If the number is odd, triple it and add one. - (let get? (fun (seq idx default) - (if (> (len seq) idx) - (@ seq idx) - default))) + (if (> (len seq) idx) + (@ seq idx) + default))) (let n (toNumber (get? sys:args 0 "10"))) (let collatz (fun (num) - (if (= 0 (mod num 2)) - (math:floor (/ num 2)) - (math:floor (+ 1 (* 3 num)))))) + (if (= 0 (mod num 2)) + (math:floor (/ num 2)) + (math:floor (+ 1 (* 3 num)))))) (mut a_i n) (mut iterations 0) (while (!= 1 a_i) { - (print a_i) - (set a_i (collatz a_i)) - (set iterations (+ 1 iterations))}) + (print a_i) + (set a_i (collatz a_i)) + (set iterations (+ 1 iterations)) }) (print "Reached 1 in " iterations " iteration(s)") diff --git a/tests/fuzzing/corpus/examples_counter.ark b/tests/fuzzing/corpus/examples_counter.ark index 351c3f4d6..1fb4cb244 100644 --- a/tests/fuzzing/corpus/examples_counter.ark +++ b/tests/fuzzing/corpus/examples_counter.ark @@ -1,8 +1,8 @@ (puts "\t\tHello world\nHere is a counter: ") (mut i 0) (while (<= i 100) { - # puts doesn't put a \n at the end of the string - (puts "\rHere is a counter: " i "/100") - (set i (+ 1 i)) - # sleep for 50ms - (sys:sleep 50)}) + # puts doesn't put a \n at the end of the string + (puts "\rHere is a counter: " i "/100") + (set i (+ 1 i)) + # sleep for 50ms + (sys:sleep 50) }) diff --git a/tests/fuzzing/corpus/examples_error.ark b/tests/fuzzing/corpus/examples_error.ark index c166f9397..1e34b97cd 100644 --- a/tests/fuzzing/corpus/examples_error.ark +++ b/tests/fuzzing/corpus/examples_error.ark @@ -6,17 +6,16 @@ # the function which should do a "safe number inversion" (let invert (fun (x) { - (if (= x 0) - # then - (throw "cannot divide by zero") # the value we should return in case of an error - # else - (return (/ 1 x)))})) # the value returned if everything is ok (if (!= x 0)) + (if (= x 0) + # then + (throw "cannot divide by zero") + # the value we should return in case of an error + # else + (return (/ 1 x))) })) # the value returned if everything is ok (if (!= x 0)) # this function (try) is implemented in Exceptions.ark (in lib/std/) # and will check the return value of (invert 0) # if it's an error (seen by the use of throw), it will call the second function, # if it's a result, it will call the first # it works the same way as a try: { function then } catch { do_something } -(try (invert 0) - (fun (inverted) (print inverted)) - (fun (err) (print err))) +(try (invert 0) (fun (inverted) (print inverted)) (fun (err) (print err))) diff --git a/tests/fuzzing/corpus/examples_factorial.ark b/tests/fuzzing/corpus/examples_factorial.ark index 160e2b808..2831de7db 100644 --- a/tests/fuzzing/corpus/examples_factorial.ark +++ b/tests/fuzzing/corpus/examples_factorial.ark @@ -2,15 +2,16 @@ # we create a constant named fact, and put a function in it # taking a single argument, n (let fact (fun (n) { - (mut a 1) - (mut acc 2) - # then we use a loop (for loops doesn't exist in ArkScript) - (while (<= acc n) { - (set a (* a acc)) - # thus we need to increment the accumulator ourselves - (set acc (+ 1 acc))}) - # the return value - a })) + (mut a 1) + (mut acc 2) + + # then we use a loop (for loops doesn't exist in ArkScript) + (while (<= acc n) { + (set a (* a acc)) + # thus we need to increment the accumulator ourselves + (set acc (+ 1 acc)) }) + # the return value + a })) # then we call the function we just created (print "Factorial 6 (with loop and acc): " (fact 6)) diff --git a/tests/fuzzing/corpus/examples_fibo.ark b/tests/fuzzing/corpus/examples_fibo.ark index ed3dbd708..7d44e58b8 100644 --- a/tests/fuzzing/corpus/examples_fibo.ark +++ b/tests/fuzzing/corpus/examples_fibo.ark @@ -1,9 +1,9 @@ # an example of a classic recursive function (let fibo (fun (n) - (if (< n 2) - # then, its the last value evaluated in this case, thus it's the return value - n - # else, the last value evaluated in this branch as well - (+ (fibo (- n 1)) (fibo (- n 2)))))) + (if (< n 2) + # then, its the last value evaluated in this case, thus it's the return value + n + # else, the last value evaluated in this branch as well + (+ (fibo (- n 1)) (fibo (- n 2)))))) (print "Fibonacci 28: " (fibo 28)) diff --git a/tests/fuzzing/corpus/examples_games_game_of_life.ark b/tests/fuzzing/corpus/examples_games_game_of_life.ark index c623b8750..b70f12dda 100644 --- a/tests/fuzzing/corpus/examples_games_game_of_life.ark +++ b/tests/fuzzing/corpus/examples_games_game_of_life.ark @@ -1,67 +1,73 @@ -(let board [ - 0 0 0 0 - 0 1 1 1 - 1 1 1 0 - 0 0 0 0]) +(let board [0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0]) (let width 4) (let height 4) (let dead 0) (let alive 1) (let get (fun (board_ i width height) - (if (and (>= i 0) (< i (* width height))) - (@ board_ i) - dead ))) + (if (and (>= i 0) (< i (* width height))) + (@ board_ i) + dead))) (let neigh (fun (board_ index width height) { - (let x (math:floor (mod index width))) - (let y (math:floor (/ index width))) - (mut count 0) - - (if (>= (- y 1) 0) - (set count (+ count (get board_ (- index width) width height)))) - (if (< (+ y 1) height) - (set count (+ count (get board_ (+ index width) width height)))) - (if (>= (- x 1) 0) - (set count (+ count (get board_ (- index 1) width height)))) - (if (< (+ x 1) width) - (set count (+ count (get board_ (+ index 1) width height)))) - - (if (and (>= (- x 1) 0) (>= (- y 1) 0)) - (set count (+ count (get board_ (- index 1 width) width height)))) - (if (and (< (+ x 1) width) (< (+ y 1) height)) - (set count (+ count (get board_ (+ index width 1) width height)))) - (if (and (>= (- x 1) 0) (< (+ y 1) height)) - (set count (+ count (get board_ (+ index width -1) width height)))) - (if (and (< (+ x 1) width) (>= (- y 1) 0)) - (set count (+ count (get board_ (- index width -1) width height)))) - - count })) + (let x (math:floor (mod index width))) + (let y (math:floor (/ index width))) + (mut count 0) + + (if (>= (- y 1) 0) + (set count (+ count (get board_ (- index width) width height)))) + + (if (< (+ y 1) height) + (set count (+ count (get board_ (+ index width) width height)))) + + (if (>= (- x 1) 0) + (set count (+ count (get board_ (- index 1) width height)))) + + (if (< (+ x 1) width) + (set count (+ count (get board_ (+ index 1) width height)))) + + (if (and (>= (- x 1) 0) (>= (- y 1) 0)) + (set count (+ count (get board_ (- index 1 width) width height)))) + + (if (and (< (+ x 1) width) (< (+ y 1) height)) + (set count (+ count (get board_ (+ index width 1) width height)))) + + (if (and (>= (- x 1) 0) (< (+ y 1) height)) + (set count (+ count (get board_ (+ index width -1) width height)))) + + (if (and (< (+ x 1) width) (>= (- y 1) 0)) + (set count (+ count (get board_ (- index width -1) width height)))) + count })) (mut copy (list:fill (* height width) dead)) (mut i 0) (while (< i (* width height)) { - (mut neighs (neigh board i width height)) - (if (= 3 neighs) - (set copy (list:setAt copy i alive))) - (if (= 2 neighs) - (set copy (list:setAt copy i (@ board i)))) - (if (or (< neighs 2) (> neighs 3)) - (set copy (list:setAt copy i dead))) + (mut neighs (neigh board i width height)) - (set i (+ 1 i)) }) + (if (= 3 neighs) + (set copy (list:setAt copy i alive))) + + (if (= 2 neighs) + (set copy (list:setAt copy i (@ board i)))) + + (if (or (< neighs 2) (> neighs 3)) + (set copy (list:setAt copy i dead))) + (set i (+ 1 i)) }) (let display (fun (board width height) { - (mut i 0) - (while (< i (* width height)) { - (mut y (math:floor (/ i width))) - (mut x (math:floor (mod i width))) + (mut i 0) + + (while (< i (* width height)) { + (mut y (math:floor (/ i width))) + (mut x (math:floor (mod i width))) - (if (= 0 x) (puts "\n")) - (if (= alive (@ board i)) (puts "x") (puts " ")) + (if (= 0 x) (puts "\n")) - (set i (+ 1 i)) }) - (puts "\n") })) + (if (= alive (@ board i)) + (puts "x") + (puts " ")) + (set i (+ 1 i)) }) + (puts "\n") })) (print "initial board:") (display board width height) diff --git a/tests/fuzzing/corpus/examples_games_more-or-less.ark b/tests/fuzzing/corpus/examples_games_more-or-less.ark new file mode 100644 index 000000000..c06f792bc --- /dev/null +++ b/tests/fuzzing/corpus/examples_games_more-or-less.ark @@ -0,0 +1,25 @@ +(import random) +(import std.Math) + +(let number (mod (math:abs (random)) 10000)) + +(let game (fun () { + (let impl (fun (tries) { + (mut guess (toNumber (input "Input a numeric value: "))) + + (if (< guess number) + { + (print "It's more than " guess) + (impl (+ tries 1)) } + (if (= guess number) + { + (print "You found it!") + tries } + { + (print "It's less than " guess) + (impl (+ tries 1)) })) })) + + (let tries (impl 0)) + (print "You won in " tries " tries.") })) + +(game) diff --git a/tests/fuzzing/corpus/examples_games_snake_snake.ark b/tests/fuzzing/corpus/examples_games_snake_snake.ark index 44c593ac7..f3adbbbcb 100644 --- a/tests/fuzzing/corpus/examples_games_snake_snake.ark +++ b/tests/fuzzing/corpus/examples_games_snake_snake.ark @@ -1,4 +1,4 @@ -(import std.sf") +(import std.sf) (import std.Exceptions) (import std.Switch) @@ -13,196 +13,205 @@ # the board object # 0 => empty, 1 => apple (let create-board-object (fun () { - # sprites used for the game - (let apple_texture (sf:load:texture "apple.png")) - (let apple_sprite (sf:load:sprite apple_texture)) - - (mut data []) - { - (mut _y 0) - - (while (!= _y 20) { - (mut _x 0) - (mut line []) - - (while (!= _x 20) { - (mut t 0) # empty - (if (or (and (= _y 10) (= _x 5)) (or (and (= _y 5) (= _x 2)) (and (= _y 12) (= _x 12)))) - (set t 1) - (set t 0)) - (set line (append line t)) - (set _x (+ 1 _x)) - }) - - (set data (append data line)) - (set _y (+ 1 _y)) - }) - } - - (let draw_board (fun () { - (mut y 0) - (while (!= y 20) { - (mut x 0) - (while (!= x 20) { - (mut case (@ (@ data y) x)) - (if (= case 1) - { - (sf:set:pos apple_sprite (* 20 x) (* 20 y)) - (sf:draw apple_sprite) - }) - (set x (+ x 1)) - }) - (set y (+ 1 y)) - }) - - # ret - nil - })) - - (let has_apple_left? (fun () { - (mut apple_left 0) - (mut y 0) - (while (!= y 20) { - (mut x 0) - (while (!= x 20) { - (mut case (@ (@ data y) x)) - (if (= case 1) - (set apple_left (+ 1 apple_left))) - (set x (+ x 1)) - }) - (set y (+ 1 y)) - }) - - # ret - apple_left - })) - - (let eat_apple_at (fun (x y) - (if (and (and (>= x 0) (>= y 0)) (and (< y 20) (< x 20))) - { - (let test (= 1 (@ (@ data y) x))) - (if test - # remove apple - { - (mut _y 0) - (mut _data []) - - (while (!= _y 20) { - (mut _x 0) - (mut line []) - - (if (= _y y) - (while (!= _x 20) { - (mut case (@ (@ data _y) _x)) - (if (= _x x) (set case 0) ()) - (set line (append line case)) - (set _x (+ 1 _x)) - }) - (set line (@ data _y))) - - (set _data (append _data line)) - (set _y (+ 1 _y)) - }) - - (set data _data) - } + # sprites used for the game + (let apple_texture (sf:load:texture "apple.png")) + (let apple_sprite (sf:load:sprite apple_texture)) + + (mut data []) + + { + (mut _y 0) + + (while (!= _y 20) { + (mut _x 0) + (mut line []) + + (while (!= _x 20) { + (mut t 0) # empty + + (if (or (and (= _y 10) (= _x 5)) (or (and (= _y 5) (= _x 2)) (and (= _y 12) (= _x 12)))) + (set t 1) + (set t 0)) + (set line (append line t)) + (set _x (+ 1 _x)) }) + + (set data (append data line)) + (set _y (+ 1 _y)) }) } + + (let draw_board (fun () { + (mut y 0) + + (while (!= y 20) { + (mut x 0) + + (while (!= x 20) { + (mut case (@ (@ data y) x)) + + (if (= case 1) { + (sf:set:pos apple_sprite (* 20 x) (* 20 y)) + (sf:draw apple_sprite) }) + (set x (+ x 1)) }) + (set y (+ 1 y)) }) + + # ret + nil })) + + (let has_apple_left? (fun () { + (mut apple_left 0) + (mut y 0) + + (while (!= y 20) { + (mut x 0) + + (while (!= x 20) { + (mut case (@ (@ data y) x)) + + (if (= case 1) + (set apple_left (+ 1 apple_left))) + (set x (+ x 1)) }) + (set y (+ 1 y)) }) + + # ret + apple_left })) + + (let eat_apple_at (fun (x y) + (if (and (and (>= x 0) (>= y 0)) (and (< y 20) (< x 20))) + { + (let test (= 1 (@ (@ data y) x))) + + (if test + # remove apple + { + (mut _y 0) + (mut _data []) + + (while (!= _y 20) { + (mut _x 0) + (mut line []) + + (if (= _y y) + (while (!= _x 20) { + (mut case (@ (@ data _y) _x)) + + (if (= _x x) + (set case 0) ()) - (return test) - } - (throw "Out of bounds")) - )) + (set line (append line case)) + (set _x (+ 1 _x)) }) + (set line (@ data _y))) + + (set _data (append _data line)) + (set _y (+ 1 _y)) }) + + (set data _data) } + ()) - (fun (&data &apple_sprite &draw_board &has_apple_left? &eat_apple_at) ()) -})) + (return test) } + (throw "Out of bounds")))) + (fun (&data &apple_sprite &draw_board &has_apple_left? &eat_apple_at) ()) })) # instanciating (let board (create-board-object)) # the snake (let create-snake-object (fun () { - (mut pos [[0 0]]) - (mut should_move true) - (mut last_direction [1 0]) # right - (let snake_texture (sf:load:texture "snake.png")) - (let snake_sprite (sf:load:sprite snake_texture)) - - (let move (fun (mx my board) { - # we don't need to move since this function was called explicitly - (set should_move false) - (set last_direction [mx my]) - - (let p (@ pos (- (len pos) 1))) - - (try (board.eat_apple_at (+ mx (@ p 0)) (+ my (@ p 1))) - (fun (result) { - # if result == false, move the tail to the head - # otherwise, add a new head - (set pos (append pos [(+ mx (@ p 0)) (+ my (@ p 1))])) - (if (not result) - (if (!= 0 (len pos)) - # then - (set pos (tail pos)))) - }) - (fun (err) ())) - })) - - (let reset_auto_move (fun () (set should_move true))) - - (let auto_move (fun (board) { - (move (@ last_direction 0) (@ last_direction 1) board)})) - - (let draw (fun () { - (mut acc 0) - (while (!= acc (len pos)) { - (mut current (@ pos acc)) - (sf:set:pos snake_sprite (* 20 (@ current 0)) (* 20 (@ current 1))) - (sf:draw snake_sprite) - (set acc (+ 1 acc)) - }) - })) - - (fun (&move &reset_auto_move &auto_move &draw &pos &should_move &last_direction &snake_sprite) ()) -})) + (mut pos [[0 0]]) + (mut should_move true) + (mut last_direction [1 0]) # right + (let snake_texture (sf:load:texture "snake.png")) + (let snake_sprite (sf:load:sprite snake_texture)) + + (let move (fun (mx my board) { + # we don't need to move since this function was called explicitly + (set should_move false) + (set last_direction [mx my]) + + (let p (@ pos (- (len pos) 1))) + + (try + (board.eat_apple_at (+ mx (@ p 0)) (+ my (@ p 1))) + (fun (result) { + # if result == false, move the tail to the head + # otherwise, add a new head + (set pos (append pos [(+ mx (@ p 0)) (+ my (@ p 1))])) + + (if (not result) + (if (!= 0 (len pos)) + # then + (set pos (tail pos)))) }) + (fun (err) ())) })) + + (let reset_auto_move (fun () + (set should_move true))) + + (let auto_move (fun (board) { + (move (@ last_direction 0) (@ last_direction 1) board) })) + + (let draw (fun () { + (mut acc 0) + + (while (!= acc (len pos)) { + (mut current (@ pos acc)) + (sf:set:pos snake_sprite (* 20 (@ current 0)) (* 20 (@ current 1))) + (sf:draw snake_sprite) + (set acc (+ 1 acc)) }) })) + (fun (&move &reset_auto_move &auto_move &draw &pos &should_move &last_direction &snake_sprite) ()) })) # instanciating (let snake (create-snake-object)) (mut frame 0) (while (sf:window:open?) { - (mut frame_start (time)) - - # event handling - (snake.reset_auto_move) - (mut event (sf:pollEvent)) - - (switch event [ - [(sf:event "quit") (fun () (sf:window:close))] - [(sf:event "keyup" "up") (fun () (snake.move 0 -1 board))] - [(sf:event "keyup" "down") (fun () (snake.move 0 1 board))] - [(sf:event "keyup" "right") (fun () (snake.move 1 0 board))] - [(sf:event "keyup" "left") (fun () (snake.move -1 0 board))] - ]) - - # update - (if (= 0 (board.has_apple_left?)) - { - (print "you win!") - (sf:window:close) - }) - - (if (= 0 (mod frame 20)) - (snake.auto_move board)) - (set frame (+ 1 frame)) - - # rendering - (sf:window:clear 0 0 0) - (board.draw_board) # draw board first - (snake.draw) # then snake - (sf:draw fps_text) - (sf:window:display) # double buffering - - (mut diff (- (time) frame_start)) - (if (!= diff 0) - (sf:text:set fps_text (+ "FPS: " (toString (/ 1 diff)))) - (sf:text:set fps_text "FPS: NaN")) -}) + (mut frame_start (time)) + + # event handling + (snake.reset_auto_move) + (mut event (sf:pollEvent)) + + (switch + event + [ + [(sf:event "quit") (fun () (sf:window:close))] + [ + (sf:event "keyup" "up") + (fun () + (snake.move 0 -1 board))] + [ + (sf:event "keyup" "down") + (fun () + (snake.move 0 1 board))] + [ + (sf:event "keyup" "right") + (fun () + (snake.move 1 0 board))] + [ + (sf:event "keyup" "left") + (fun () + (snake.move -1 0 board))]]) + + # update + (if (= 0 (board.has_apple_left?)) { + (print "you win!") + (sf:window:close) }) + + (if (= 0 (mod frame 20)) + (snake.auto_move board)) + (set frame (+ 1 frame)) + + # rendering + (sf:window:clear 0 0 0) + (board.draw_board) + + # draw board first + (snake.draw) + + # then snake + (sf:draw fps_text) + (sf:window:display) + + # double buffering + (mut diff (- (time) frame_start)) + + (if (!= diff 0) + (sf:text:set fps_text (+ "FPS: " (toString (/ 1 diff)))) + (sf:text:set fps_text "FPS: NaN")) }) diff --git a/tests/fuzzing/corpus/examples_http.ark b/tests/fuzzing/corpus/examples_http.ark index 93051300c..f8c3394ad 100644 --- a/tests/fuzzing/corpus/examples_http.ark +++ b/tests/fuzzing/corpus/examples_http.ark @@ -5,48 +5,55 @@ (let server false) (if server - # then, server - { - # we can have only 1 server at a time - (let srv (http:server:create)) - # the handler answering requests on a given route, here /hi - (let f (fun (data) { - [ - 200 - (if (nil? data) - "hello world" - (+ "hello, " (toString (http:params:toList data)))) - "text/plain" - ]})) - # configure the route and the handler, we can also give a string instead of a function - (http:server:get srv "/hi" f) - (print "starting on localhost:80") - # make the server listen forever on the port 80 - (http:server:listen srv "localhost" 80)} - # else, client - { - # we give the website and the port - (let cli (http:client:create "monip.org" 80)) - - # we get a route on a given client - (mut output (http:client:get cli "/")) - # if we got nil, then we couldn't reach the destination - (if (nil? output) - (print "couldn't reach the server") - (print output)) - - # we can create multiple clients at the same time - (let cli2 (http:client:create "yahoo.com" 80)) - - (set output (http:client:get cli2 "/")) - # the function returns a list: [code content] - (print (@ output 0)) # status: 301 - - # follow redirections - (http:client:setFollowLocation cli2 true) - # and retry - (set output (http:client:get cli2 "/")) - # it should work now - (if (nil? output) - (print "error") - (print (@ output 0)))}) # status: 200 + # then, server + { + # we can have only 1 server at a time + (let srv (http:server:create)) + + # the handler answering requests on a given route, here /hi + (let f (fun (data) { + [ + 200 + (if (nil? data) + "hello world" + (+ "hello, " (toString (http:params:toList data)))) + "text/plain"] })) + + # configure the route and the handler, we can also give a string instead of a function + (http:server:get srv "/hi" f) + (print "starting on localhost:80") + + # make the server listen forever on the port 80 + (http:server:listen srv "localhost" 80) } + # else, client + { + # we give the website and the port + (let cli (http:client:create "monip.org" 80)) + + # we get a route on a given client + (mut output (http:client:get cli "/")) + + # if we got nil, then we couldn't reach the destination + (if (nil? output) + (print "couldn't reach the server") + (print output)) + + # we can create multiple clients at the same time + (let cli2 (http:client:create "yahoo.com" 80)) + + (set output (http:client:get cli2 "/")) + + # the function returns a list: [code content] + (print (@ output 0)) + + # status: 301 + # follow redirections + (http:client:setFollowLocation cli2 true) + + # and retry + (set output (http:client:get cli2 "/")) + + # it should work now + (if (nil? output) + (print "error") + (print (@ output 0))) }) # status: 200 diff --git a/tests/fuzzing/corpus/examples_macros.ark b/tests/fuzzing/corpus/examples_macros.ark index 25e9cb3d4..8e1695145 100644 --- a/tests/fuzzing/corpus/examples_macros.ark +++ b/tests/fuzzing/corpus/examples_macros.ark @@ -1,19 +1,18 @@ ($ suffix-dup (sym x) { - ($if (> x 1) - (suffix-dup sym (- x 1))) - (symcat sym x)}) + ($if (> x 1) (suffix-dup sym (- x 1))) + ($symcat sym x) }) ($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) - (fun (bloc) (func ...defargs bloc)) - ($undef bloc)}) + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) + (fun (bloc) (func ...defargs bloc)) + ($undef bloc) }) (let test_func (fun (a b c) (* a b c))) (let test_func1 (partial test_func 1)) (print "Generated partial functions for test_func (a b c) => (* a b c)") -(print "Expected arguments for test_func: " (argcount test_func) ", expected " 3) -(print "Expected arguments for test_func1: " (argcount test_func1) ", expected " 2) +(print "Expected arguments for test_func: " ($argcount test_func) ", expected " 3) +(print "Expected arguments for test_func1: " ($argcount test_func1) ", expected " 2) (print "Calling them: " (test_func 1 2 3) " " (test_func1 2 3)) ($ foo (a b) (+ a b)) @@ -23,12 +22,12 @@ (print "Using macro constant var=12: " var) ($if (= var 12) - (print "This was executed in a if macro, testing var == 12") - (print "You shouldn't see this")) + (print "This was executed in a if macro, testing var == 12") + (print "You shouldn't see this")) ($if (and true true) - (print "This was executed in a if macro, testing (and true true)") - (print "You shouldn't see this (bis)")) + (print "This was executed in a if macro, testing (and true true)") + (print "You shouldn't see this (bis)")) ($ defun (name args body) (let name (fun args body))) (defun a_func (a b) (+ a b)) @@ -46,48 +45,47 @@ (last 1 5 6 7 8) { - (print "Testing macros in scopes and macro shadowing") +(print "Testing macros in scopes and macro shadowing") - ($ test (+ 1 2 3)) - (print "(global) Reading macro 'test', expected 6, " test) +($ test (+ 1 2 3)) +(print "(global) Reading macro 'test', expected 6, " test) - ((fun () { - ($ test (- 1 2 3)) - (print "(sub scope) Reading macro 'test', expected -4, " test)})) +((fun () { + ($ test (- 1 2 3)) + (print "(sub scope) Reading macro 'test', expected -4, " test) })) - (print "(global) Reading macro 'test', expected 6, " test) - - { - ($ test 555) - (print "(subscope) Reading macro 'test', expected 555, " test) - ($ undef test) - (print "(subscope, undef test) Reading macro 'test', expected 6, " test) - ($ undef a)}} +(print "(global) Reading macro 'test', expected 6, " test) +{ + ($ test 555) + (print "(subscope) Reading macro 'test', expected 555, " test) + ($ undef test) + (print "(subscope, undef test) Reading macro 'test', expected 6, " test) + ($ undef a) } } (print "Demonstrating a threading macro") ($ -> (arg fn1 ...fn) { - ($if (> (len fn) 0) - (-> (fn1 arg) ...fn) - (fn1 arg))}) + ($if (> (len fn) 0) + (-> (fn1 arg) ...fn) + (fn1 arg)) }) (let filename "hello.json") (let f1 (fun (data) { - (print ">>f1 " data) - (+ data "-f1")})) + (print ">>f1 " data) + (+ data "-f1") })) (let f2 (fun (data) { - (print ">>f2 " data) - (+ data "-f2")})) + (print ">>f2 " data) + (+ data "-f2") })) (let f3 (fun (data) { - (print ">>f3 " data) - (+ data "-f3")})) + (print ">>f3 " data) + (+ data "-f3") })) (let f4 (fun (data) { - (print ">>f4 " data) - (+ data "-f4")})) + (print ">>f4 " data) + (+ data "-f4") })) (print "We expected calls to go like this: f1, f2, f3, f4") -(print (-> filename f1 f2 f3 f4)) # (f4 (f3 (f2 (f1 filename)))) +(print (-> filename f1 f2 f3 f4)) # (f4 (f3 (f2 (f1 filename)))) diff --git a/tests/fuzzing/corpus/examples_more-or-less.ark b/tests/fuzzing/corpus/examples_more-or-less.ark deleted file mode 100644 index 465c238df..000000000 --- a/tests/fuzzing/corpus/examples_more-or-less.ark +++ /dev/null @@ -1,25 +0,0 @@ -(import std.random) -(import std.Math) - -(let number (mod (math:abs (random)) 10000)) - -(let game (fun () { - (let impl (fun (tries) { - (let guess (toNumber (input "Input a numeric value: "))) - - (if (< guess number) - { - (print "It's more than " guess) - (impl (+ tries 1))} - (if (= guess number) - { - (print "You found it!") - tries } - { - (print "It's less than " guess) - (impl (+ tries 1))}))})) - - (let tries (impl 0)) - (print "You won in " tries " tries.")})) - -(game) diff --git a/tests/fuzzing/corpus/examples_quicksort.ark b/tests/fuzzing/corpus/examples_quicksort.ark index 9eedab708..f9ff9ca9a 100644 --- a/tests/fuzzing/corpus/examples_quicksort.ark +++ b/tests/fuzzing/corpus/examples_quicksort.ark @@ -1,52 +1,60 @@ (import std.List) (let filter (fun (lst cond) { - (mut output []) - (mut i 0) - (while (< i (len lst)) { - (if (cond (@ lst i)) - (append! output (@ lst i))) - (set i (+ 1 i))}) - output })) + (mut output []) + (mut i 0) + + (while (< i (len lst)) { + (if (cond (@ lst i)) (append! output (@ lst i))) + (set i (+ 1 i)) }) + output })) # a quicksort function in ArkScript, a lot smaller than its C++ version! # and according to me, a lot simpler to understand (let quicksort (fun (array) { - (if (empty? array) - # if the given list is empty, return it - [] - # otherwise, sort it - { - # the pivot will be the first element - (let pivot (head array)) - # call quicksort on a smaller array containing all the elements less than the pivot - (mut less (quicksort (filter (tail array) (fun (e) (< e pivot))))) - # and after that, call quicksort on a smaller array containing all the elements greater or equal to the pivot - (let more (quicksort (filter (tail array) (fun (e) (>= e pivot))))) - - (concat! less [pivot] more) - # return a concatenation of arrays - less })})) + (if (empty? array) + # if the given list is empty, return it + [] + # otherwise, sort it + { + # the pivot will be the first element + (let pivot (head array)) + + # call quicksort on a smaller array containing all the elements less than the pivot + (mut less (quicksort (filter (tail array) (fun (e) (< e pivot))))) + + # and after that, call quicksort on a smaller array containing all the elements greater or equal to the pivot + (let more (quicksort (filter (tail array) (fun (e) (>= e pivot))))) + + (concat! less [pivot] more) + # return a concatenation of arrays + less }) })) # an unsorted list to sort (let a [3 6 1 5 1 65 324 765 1 6 3 0 6 9 6 5 3 2 5 6 7 64 645 7 345 432 432 4 324 23]) +(let rep + (if (>= (len sys:args) 1) + (toNumber (@ sys:args 0)) + 1)) + # a benchmarking function, to see the difference between C++ sort and ArkScript quicksort # obviously ArkScript will be a bit slower (let bench (fun (name code) { - (mut start (time)) - (let rep 1) + (mut start (time)) + + (mut i 0) - (mut i 0) - (while (< i rep) { - (code) - (set i (+ 1 i))}) + (while (< i rep) { + (code) + (set i (+ 1 i)) }) - (let t (/ (* 1000 (- (time) start)) rep)) - (print name " average: " t "ms") - t })) + (let t (/ (* 1000 (- (time) start)) rep)) + (print name " average: " t "ms") + t })) (print a) + # use a quoted argument to defer evaluation and be able to call it multiple times in a fresh context (let ark (bench "ark" (fun () (quicksort a)))) (let cpp (bench "cpp" (fun () (list:sort a)))) diff --git a/tests/fuzzing/corpus/examples_sum_digits.ark b/tests/fuzzing/corpus/examples_sum_digits.ark index 643a660b5..64b8c2339 100644 --- a/tests/fuzzing/corpus/examples_sum_digits.ark +++ b/tests/fuzzing/corpus/examples_sum_digits.ark @@ -2,23 +2,26 @@ (import std.String) (let to-base (fun (n base) { - (let o (str:ord n)) - (let v (if (and (>= o 48) (<= o 57)) - (- o 48) - (if (and (>= o 97) (<= o 122)) - (- o 87) - (if (and (>= o 65) (<= 90)) - (- o 55) - o )))) - (mod v base)})) + (let o (string:ord n)) + + (let v + (if (and (>= o 48) (<= o 57)) + (- o 48) + (if (and (>= o 97) (<= o 122)) + (- o 87) + (if (and (>= o 65) (<= o 90)) + (- o 55) + o)))) + (mod v base) })) (let sum-digits (fun (n base) { - (let number (if (not (= "String" (type n))) (toString n) n)) - (list:reduce - (list:map number (fun (e) (to-base e base))) - (fun (a b) (+ a b)))})) + (let number + (if (not (= "String" (type n))) + (toString n) + n)) + (list:reduce (list:map number (fun (e) (to-base e base))) (fun (a b) (+ a b))) })) -(print (sum-digits 1 10)) # 1 -(print (sum-digits 1234 10)) # 10 -(print (sum-digits "fe" 16)) # 29 -(print (sum-digits "f0e" 16)) # 29 +(print (sum-digits 1 10)) # 1 +(print (sum-digits 1234 10)) # 10 +(print (sum-digits "fe" 16)) # 29 +(print (sum-digits "f0e" 16)) # 29 diff --git a/tests/fuzzing/corpus/tests_arkscript_string-tests.ark b/tests/fuzzing/corpus/tests_arkscript_string-tests.ark deleted file mode 100644 index 178f0f768..000000000 --- a/tests/fuzzing/corpus/tests_arkscript_string-tests.ark +++ /dev/null @@ -1,14 +0,0 @@ -(import std.Testing) -(import std.String) - -(test:suite string { - (test:case "remove char in string at index" { - (test:eq "hllo world" (str:removeAt "hello world" 1)) - (test:eq "ello world" (str:removeAt "hello world" 0)) - (test:eq "hello worl" (str:removeAt "hello world" 10)) }) - - (test:case "find substring" { - (test:eq -1 (str:find "hello" "help")) - (test:eq 0 (str:find "hello" "hel")) - (test:eq 2 (str:find "hello" "llo")) - (test:eq -1 (str:find "" "1")) })}) diff --git a/tests/fuzzing/corpus/tests_arkscript_unittests.ark b/tests/fuzzing/corpus/tests_arkscript_unittests.ark deleted file mode 100644 index d8bb99d3b..000000000 --- a/tests/fuzzing/corpus/tests_arkscript_unittests.ark +++ /dev/null @@ -1,7 +0,0 @@ -(import vm-tests) -(import builtins-tests) -(import utf8-tests) -(import macro-tests) -(import list-tests) -(import string-tests) -(import async-tests) diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_parser_big.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_parser_big.ark index 2d9cee185..1addbb6b1 100644 --- a/tests/fuzzing/corpus/tests_benchmarks_resources_parser_big.ark +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_parser_big.ark @@ -51,7 +51,7 @@ (set _index (+ 1 _index))}) _output })) -(import lib.math :min :max) # needed for math:min, math:max +(import std.Math :min :max) # needed for math:min, math:max # @brief Drop the first n elements of a list # @param _L the list to work on @@ -68,7 +68,7 @@ (list:drop (tail _L) (- _n 1)) _L) { - (mut _index (max 0 _n)) + (mut _index (math:max 0 _n)) (mut _output []) (while (< _index (len _L)) { (set _output (append _output (@ _L _index))) @@ -197,7 +197,7 @@ (let list:take (fun (_L _n) { (mut _index 0) (mut _output []) - (set _n (min _n (len _L))) + (set _n (math:min _n (len _L))) (while (< _index _n) { (set _output (append _output (@ _L _index))) @@ -255,7 +255,7 @@ # =end # @author https://github.com/FrenchMasterSword (let list:zip (fun (_a _b) { - (let _m (min (len _a) (len _b))) + (let _m (math:min (len _a) (len _b))) (mut _c []) (mut _index 0) (while (< _index _m) { diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_parser_medium.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_parser_medium.ark index 62d05c3e1..2df0da04c 100644 --- a/tests/fuzzing/corpus/tests_benchmarks_resources_parser_medium.ark +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_parser_medium.ark @@ -9,17 +9,17 @@ (print "Generating callbacks") (mut acc 0) # here we are filling the list callbacks -(while (notEq acc (len data)) { - (mut d (at data acc)) +(while (!= acc (len data)) { + (mut d (@ data acc)) (set callbacks (append callbacks (fun (&d) (egg d)))) - (set acc (add 1 acc))}) + (set acc (+ 1 acc))}) # then we reset the accumulator (set acc 0) -(while (notEq acc (len callbacks)) { - (mut var (at callback acc)) +(while (!= acc (len callbacks)) { + (mut var (@ callbacks acc)) (print "stored: " var.d) (puts "Calling callback number " acc ": ") - (mut stored (at callbacks acc)) + (mut stored (@ callbacks acc)) (stored) - (set acc (add 1 acc))}) + (set acc (+ 1 acc))}) diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_parser_simple.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_parser_simple.ark index 89acfc1a6..72164f345 100644 --- a/tests/fuzzing/corpus/tests_benchmarks_resources_parser_simple.ark +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_parser_simple.ark @@ -1,12 +1,13 @@ (import some.important :code :base) -(let a (if (equal b c) 1 "4")) +(let a (if (= 5 code) 1 "4")) + +(mut foo (fun (bar egg &a) { + (let yes egg) + (+ 1 bar)})) + (if (foo a) (print a " is a very interesting variable")) -(mut foo (fun (bar egg &captured) { - (let yes indeed) - (add 1 yes)})) - (while true { (foo true nil false)}) diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_parser_some_important.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_parser_some_important.ark new file mode 100644 index 000000000..c27e09cc3 --- /dev/null +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_parser_some_important.ark @@ -0,0 +1,2 @@ +(let code 12) +(let base (fun () 14)) diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_builtins.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_builtins.ark new file mode 100644 index 000000000..df0e0b98a --- /dev/null +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_builtins.ark @@ -0,0 +1,10 @@ +(let in (list 1 2 3 4 5)) + +(mut i 0) +(while (< i 1000) { + (list:slice in 1 4 2) + (math:exp 5) + (math:ln 6) + (list:sort in) + + (set i (+ i 1)) }) diff --git a/tests/fuzzing/corpus/tests_errors_callable_fmt_arg_not_found.ark b/tests/fuzzing/corpus/tests_errors_callable_fmt_arg_not_found.ark deleted file mode 100644 index 6beb8dbf6..000000000 --- a/tests/fuzzing/corpus/tests_errors_callable_fmt_arg_not_found.ark +++ /dev/null @@ -1 +0,0 @@ -(str:format "Hello {}, I'm {}" "World") diff --git a/tests/fuzzing/corpus/tests_errors_capture_unbound.ark b/tests/fuzzing/corpus/tests_errors_capture_unbound.ark deleted file mode 100644 index 165f289b0..000000000 --- a/tests/fuzzing/corpus/tests_errors_capture_unbound.ark +++ /dev/null @@ -1 +0,0 @@ -(mut d (fun (&d) (print d))) diff --git a/tests/fuzzing/corpus/tests_errors_compiler_invalid_while.ark b/tests/fuzzing/corpus/tests_errors_compiler_invalid_while.ark deleted file mode 100644 index 021d422aa..000000000 --- a/tests/fuzzing/corpus/tests_errors_compiler_invalid_while.ark +++ /dev/null @@ -1,3 +0,0 @@ -(while ($ a b) { - (set acc (+ acc (@ src a))) - (set a (+ 1 a))}) diff --git a/tests/fuzzing/corpus/tests_errors_compiler_well_formed_args.ark b/tests/fuzzing/corpus/tests_errors_compiler_well_formed_args.ark deleted file mode 100644 index 5ce688e10..000000000 --- a/tests/fuzzing/corpus/tests_errors_compiler_well_formed_args.ark +++ /dev/null @@ -1,2 +0,0 @@ -($ defun (let name (fun args body))) -(defun foo (a b) (+ a b)) diff --git a/tests/fuzzing/corpus/tests_errors_macros_not_enough_args.ark b/tests/fuzzing/corpus/tests_errors_macros_not_enough_args.ark deleted file mode 100644 index 49430d0c1..000000000 --- a/tests/fuzzing/corpus/tests_errors_macros_not_enough_args.ark +++ /dev/null @@ -1,4 +0,0 @@ -($ foo (a b c) - (+ a b c)) - -(foo 1 2) diff --git a/tests/fuzzing/corpus/tests_errors_mutability_append_in_place.ark b/tests/fuzzing/corpus/tests_errors_mutability_append_in_place.ark deleted file mode 100644 index b7835a075..000000000 --- a/tests/fuzzing/corpus/tests_errors_mutability_append_in_place.ark +++ /dev/null @@ -1,2 +0,0 @@ -(let a []) -(append! a 5) diff --git a/tests/fuzzing/corpus/tests_errors_mutability_concat_in_place.ark b/tests/fuzzing/corpus/tests_errors_mutability_concat_in_place.ark deleted file mode 100644 index 4d6861b6a..000000000 --- a/tests/fuzzing/corpus/tests_errors_mutability_concat_in_place.ark +++ /dev/null @@ -1,2 +0,0 @@ -(let a []) -(concat! a [5]) diff --git a/tests/fuzzing/corpus/tests_errors_mutability_redefine.ark b/tests/fuzzing/corpus/tests_errors_mutability_redefine.ark deleted file mode 100644 index 53b9c8c32..000000000 --- a/tests/fuzzing/corpus/tests_errors_mutability_redefine.ark +++ /dev/null @@ -1,2 +0,0 @@ -(mut a 5) -(let a 6) diff --git a/tests/fuzzing/corpus/tests_errors_scope_set_unbound.ark b/tests/fuzzing/corpus/tests_errors_scope_set_unbound.ark deleted file mode 100644 index 646e315e1..000000000 --- a/tests/fuzzing/corpus/tests_errors_scope_set_unbound.ark +++ /dev/null @@ -1,2 +0,0 @@ -(set a 5) -(let a 0) diff --git a/tests/fuzzing/corpus/tests_errors_type_nil_not_a_function.ark b/tests/fuzzing/corpus/tests_errors_type_nil_not_a_function.ark deleted file mode 100644 index 316b65de8..000000000 --- a/tests/fuzzing/corpus/tests_errors_type_nil_not_a_function.ark +++ /dev/null @@ -1,2 +0,0 @@ -(()) -(fun (a b) (if 1 2 3)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_astsuite_99bottles.ark b/tests/fuzzing/corpus/tests_unittests_resources_astsuite_99bottles.ark index d96a216af..a4482659b 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_astsuite_99bottles.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_astsuite_99bottles.ark @@ -16,6 +16,6 @@ (mut n i) (while (> n 1) { - (print (str:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n)) + (print (string:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n)) (set n (- n 1)) - (print (str:format "{} Bottles of beer on the wall." n))}) + (print (string:format "{} Bottles of beer on the wall." n))}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_astsuite_del.ark b/tests/fuzzing/corpus/tests_unittests_resources_astsuite_del.ark new file mode 100644 index 000000000..1d5142edf --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_astsuite_del.ark @@ -0,0 +1,2 @@ +(let a 1) +(del a) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_astsuite_imports.ark b/tests/fuzzing/corpus/tests_unittests_resources_astsuite_imports.ark new file mode 100644 index 000000000..f71c85ee1 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_astsuite_imports.ark @@ -0,0 +1,3 @@ +(import foo.bar) +(import foo.bar :egg :lettuce) +(import foo.bar:*) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_astsuite_macros.ark b/tests/fuzzing/corpus/tests_unittests_resources_astsuite_macros.ark index 25e9cb3d4..4a6dc1c9f 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_astsuite_macros.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_astsuite_macros.ark @@ -1,10 +1,10 @@ ($ suffix-dup (sym x) { ($if (> x 1) (suffix-dup sym (- x 1))) - (symcat sym x)}) + ($symcat sym x)}) ($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) (fun (bloc) (func ...defargs bloc)) ($undef bloc)}) @@ -12,8 +12,8 @@ (let test_func1 (partial test_func 1)) (print "Generated partial functions for test_func (a b c) => (* a b c)") -(print "Expected arguments for test_func: " (argcount test_func) ", expected " 3) -(print "Expected arguments for test_func1: " (argcount test_func1) ", expected " 2) +(print "Expected arguments for test_func: " ($argcount test_func) ", expected " 3) +(print "Expected arguments for test_func1: " ($argcount test_func1) ", expected " 2) (print "Calling them: " (test_func 1 2 3) " " (test_func1 2 3)) ($ foo (a b) (+ a b)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_99bottles.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_99bottles.ark new file mode 100644 index 000000000..a4482659b --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_99bottles.ark @@ -0,0 +1,21 @@ +# Lyrics from the song: +# +# 99 bottles of beer on the wall +# 99 bottles of beer +# Take one down, pass it around +# 98 bottles of beer on the wall +# +# 98 bottles of beer on the wall +# 98 bottles of beer +# Take one down, pass it around +# 97 bottles of beer on the wall + + +(let arg (if (>= (len sys:args) 1) (toNumber (@ sys:args 0)) nil)) +(let i (if (nil? arg) 100 arg)) + +(mut n i) +(while (> n 1) { + (print (string:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n)) + (set n (- n 1)) + (print (string:format "{} Bottles of beer on the wall." n))}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_ackermann.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_ackermann.ark new file mode 100644 index 000000000..f652e592a --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_ackermann.ark @@ -0,0 +1,20 @@ +# the Ackermann Peter function (see https://en.wikipedia.org/wiki/Ackermann_function) +# One of the simplest and earliest-discovered examples of a total computable function, +# that is not primitive. All primitive recursive functions are total and computable, +# but the Ackermann function illustrates that not all total computable functions +# are primitive recursive. +# Due to its definitions in terms of extremely deep recursion, it can be used as a +# benchmark of a compiler's ability to optimize recursion, which is the reason why +# we are using this function to benchmark the language. +(let ackermann (fun (m n) { + (if (> m 0) + # then + (if (= 0 n) + # then + (ackermann (- m 1) 1) + # else + (ackermann (- m 1) (ackermann m (- n 1)))) + # else + (+ 1 n)) })) + +(print "Ackermann-Péter function, m=3, n=6: " (ackermann 3 6)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_closures.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_closures.ark new file mode 100644 index 000000000..f818e5632 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_closures.ark @@ -0,0 +1,46 @@ +# Inspired by +# Closures and object are equivalent: http://wiki.c2.com/?ClosuresAndObjectsAreEquivalent + +# this will construct a closure capturing the 3 arguments, plus a function to set the age +(let create-human (fun (name age weight) { + # functions can be invoked in the closure scope + (let set-age (fun (new-age) (set age new-age))) + + # the return value, our closure + # the &name notation is used in the argument list to explicitly capture + # a variable (using deep copy) + (fun (&set-age &name &age &weight) ())})) + +# we create 2 humans using such construction, just a nice function call +(let bob (create-human "Bob" 0 144)) +(let john (create-human "John" 12 15)) + +# using the dot notation on a closure object, we can have a **read only** access to its fields +(print "Bob's age: " bob.age) +# and even call the captured functions, which will enter the closure, and be given a **read write** access +# meaning that, even if the fields are read only (eg, we can not do (set bob.age 14)), the "object" can be modified +(print "Setting Bob's age to 10") +(bob.set-age 10) +# the age changed +(print "New age: " bob.age) + +# but john age didn't change, because we created 2 separated closures +(print "John's age, didn't change: " john.age) + + + +# Another example to simulate a python range(x, y) + +# this function will return a closure capturing the number given +# and modifying its value each time we'll call the closure, returning +# the new number +(let countdown-from (fun (number) + (fun (&number) { + (set number (- number 1)) + number }))) + +(let countdown-from-3 (countdown-from 3)) + +(print "Countdown " (countdown-from-3)) # 2 +(print "Countdown " (countdown-from-3)) # 1 +(print "Countdown " (countdown-from-3)) # 0 diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_factorial.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_factorial.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_unittests_resources_astsuite_factorial.ark rename to tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_factorial.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark new file mode 100644 index 000000000..a4482659b --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark @@ -0,0 +1,21 @@ +# Lyrics from the song: +# +# 99 bottles of beer on the wall +# 99 bottles of beer +# Take one down, pass it around +# 98 bottles of beer on the wall +# +# 98 bottles of beer on the wall +# 98 bottles of beer +# Take one down, pass it around +# 97 bottles of beer on the wall + + +(let arg (if (>= (len sys:args) 1) (toNumber (@ sys:args 0)) nil)) +(let i (if (nil? arg) 100 arg)) + +(mut n i) +(while (> n 1) { + (print (string:format "{} Bottles of beer on the wall\n{} bottles of beer\nTake one down, pass it around" n n)) + (set n (- n 1)) + (print (string:format "{} Bottles of beer on the wall." n))}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark new file mode 100644 index 000000000..f652e592a --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark @@ -0,0 +1,20 @@ +# the Ackermann Peter function (see https://en.wikipedia.org/wiki/Ackermann_function) +# One of the simplest and earliest-discovered examples of a total computable function, +# that is not primitive. All primitive recursive functions are total and computable, +# but the Ackermann function illustrates that not all total computable functions +# are primitive recursive. +# Due to its definitions in terms of extremely deep recursion, it can be used as a +# benchmark of a compiler's ability to optimize recursion, which is the reason why +# we are using this function to benchmark the language. +(let ackermann (fun (m n) { + (if (> m 0) + # then + (if (= 0 n) + # then + (ackermann (- m 1) 1) + # else + (ackermann (- m 1) (ackermann m (- n 1)))) + # else + (+ 1 n)) })) + +(print "Ackermann-Péter function, m=3, n=6: " (ackermann 3 6)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_closures.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_closures.ark new file mode 100644 index 000000000..f818e5632 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_closures.ark @@ -0,0 +1,46 @@ +# Inspired by +# Closures and object are equivalent: http://wiki.c2.com/?ClosuresAndObjectsAreEquivalent + +# this will construct a closure capturing the 3 arguments, plus a function to set the age +(let create-human (fun (name age weight) { + # functions can be invoked in the closure scope + (let set-age (fun (new-age) (set age new-age))) + + # the return value, our closure + # the &name notation is used in the argument list to explicitly capture + # a variable (using deep copy) + (fun (&set-age &name &age &weight) ())})) + +# we create 2 humans using such construction, just a nice function call +(let bob (create-human "Bob" 0 144)) +(let john (create-human "John" 12 15)) + +# using the dot notation on a closure object, we can have a **read only** access to its fields +(print "Bob's age: " bob.age) +# and even call the captured functions, which will enter the closure, and be given a **read write** access +# meaning that, even if the fields are read only (eg, we can not do (set bob.age 14)), the "object" can be modified +(print "Setting Bob's age to 10") +(bob.set-age 10) +# the age changed +(print "New age: " bob.age) + +# but john age didn't change, because we created 2 separated closures +(print "John's age, didn't change: " john.age) + + + +# Another example to simulate a python range(x, y) + +# this function will return a closure capturing the number given +# and modifying its value each time we'll call the closure, returning +# the new number +(let countdown-from (fun (number) + (fun (&number) { + (set number (- number 1)) + number }))) + +(let countdown-from-3 (countdown-from 3)) + +(print "Countdown " (countdown-from-3)) # 2 +(print "Countdown " (countdown-from-3)) # 1 +(print "Countdown " (countdown-from-3)) # 0 diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_factorial.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_factorial.ark new file mode 100644 index 000000000..160e2b808 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_factorial.ark @@ -0,0 +1,16 @@ +# demonstration of the creation of a function +# we create a constant named fact, and put a function in it +# taking a single argument, n +(let fact (fun (n) { + (mut a 1) + (mut acc 2) + # then we use a loop (for loops doesn't exist in ArkScript) + (while (<= acc n) { + (set a (* a acc)) + # thus we need to increment the accumulator ourselves + (set acc (+ 1 acc))}) + # the return value + a })) + +# then we call the function we just created +(print "Factorial 6 (with loop and acc): " (fact 6)) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_mutability_append_in_place.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_append_in_place.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_mutability_append_in_place.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_append_in_place.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_macros_argcount_unknown_arg.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark similarity index 77% rename from tests/fuzzing/corpus-cmin/tests_errors_macros_argcount_unknown_arg.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark index 5d174463e..3e5b91265 100644 --- a/tests/fuzzing/corpus-cmin/tests_errors_macros_argcount_unknown_arg.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark @@ -1,10 +1,10 @@ ($ suffix-dup (sym x) { ($if (> x 1) (suffix-dup sym (- x 1))) - (symcat sym x)}) + ($symcat sym x)}) ($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) (fun (bloc) (func ...defargs bloc)) ($undef bloc)}) diff --git a/tests/fuzzing/corpus/tests_errors_macros_at_out_of_range.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_macros_at_out_of_range.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark new file mode 100644 index 000000000..55e1a4b0f --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_glob_import.ark @@ -0,0 +1 @@ +(import a :*) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark new file mode 100644 index 000000000..9c93a9ae2 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro_arg_list.ark @@ -0,0 +1,2 @@ +($ b ($symcat c)) +(print b) diff --git a/tests/fuzzing/corpus/tests_errors_capture_can_not_call.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_can_not_call.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_capture_can_not_call.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_can_not_call.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark new file mode 100644 index 000000000..5fe57292f --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_capture_out_of_scope.ark @@ -0,0 +1,3 @@ +(let bar (fun () (let cap 0))) +(let foo (fun (&cap) ())) +(print foo bar) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_mutability_concat_in_place.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_concat_in_place.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_mutability_concat_in_place.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_concat_in_place.ark diff --git a/tests/fuzzing/corpus/tests_errors_macros_duplicated_arg.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_macros_duplicated_arg.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark new file mode 100644 index 000000000..12413f26c --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark @@ -0,0 +1 @@ +(let print 5) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark new file mode 100644 index 000000000..ec5939a67 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name_bis.ark @@ -0,0 +1 @@ +(mut print 5) diff --git a/tests/fuzzing/corpus/tests_errors_operators_freestanding.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_freestanding.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_operators_freestanding.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_freestanding.ark diff --git a/tests/fuzzing/corpus/tests_errors_compiler_import_too_long.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_import_too_long.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_import_too_long.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_import_too_long.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark new file mode 100644 index 000000000..ec2576e62 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_incomplete_macro.ark @@ -0,0 +1 @@ +($ foo) diff --git a/tests/fuzzing/corpus/tests_errors_compiler_invalid_codepoint.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_codepoint.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_invalid_codepoint.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_codepoint.ark diff --git a/tests/fuzzing/corpus/tests_errors_compiler_invalid_escape_seq.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_invalid_escape_seq.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark diff --git a/tests/fuzzing/corpus/tests_errors_compiler_invalid_func.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_func.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_invalid_func.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_func.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark new file mode 100644 index 000000000..2167bdc01 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_import_symbol.ark @@ -0,0 +1 @@ +(import a :123) diff --git a/tests/fuzzing/corpus/tests_errors_compiler_invalid_let.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark similarity index 66% rename from tests/fuzzing/corpus/tests_errors_compiler_invalid_let.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark index 427dae0e2..f4d8906bc 100644 --- a/tests/fuzzing/corpus/tests_errors_compiler_invalid_let.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let.ark @@ -1,5 +1,5 @@ ($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) }) (let test_func (fun (a b c) (* a b c))) diff --git a/tests/fuzzing/corpus/tests_errors_macros_invalid_let_in_macro.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let_in_macro.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_macros_invalid_let_in_macro.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_let_in_macro.ark diff --git a/tests/fuzzing/corpus/tests_errors_compiler_invalid_node_in_call.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_call.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_invalid_node_in_call.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_call.ark diff --git a/tests/fuzzing/corpus/tests_errors_compiler_invalid_node_in_list.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_list.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_invalid_node_in_list.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_list.ark diff --git a/tests/fuzzing/corpus/tests_errors_compiler_invalid_node_in_ope.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_invalid_node_in_ope.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark diff --git a/tests/fuzzing/corpus/tests_errors_compiler_invalid_node_in_tail_call.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_tail_call.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_invalid_node_in_tail_call.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_tail_call.ark diff --git a/tests/fuzzing/corpus/tests_errors_macros_invalid_sym_func_def.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_macros_invalid_sym_func_def.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark new file mode 100644 index 000000000..b7ee31073 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_while.ark @@ -0,0 +1,2 @@ +(while ($ a 1) { + (mut acc (+ acc (@ [] a)))}) diff --git a/tests/fuzzing/corpus/tests_errors_compiler_let_no_sym.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_let_no_sym.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_let_no_sym.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_let_no_sym.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark new file mode 100644 index 000000000..5619a01df --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_and_chain_short.ark @@ -0,0 +1 @@ +($if (and true) {}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark new file mode 100644 index 000000000..b934b651c --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_empty_arity_error.ark @@ -0,0 +1,2 @@ +($ a (empty? 1 2)) +(print a) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark new file mode 100644 index 000000000..ae9e1d050 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_head_arity_error.ark @@ -0,0 +1,2 @@ +($ a (head 1 2)) +(print a) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark new file mode 100644 index 000000000..3a8d53292 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_len_arity_error.ark @@ -0,0 +1,2 @@ +($ a (len 1 2)) +(print a) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark new file mode 100644 index 000000000..9d53f4983 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_or_chain_short.ark @@ -0,0 +1 @@ +($if (or true) {}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark new file mode 100644 index 000000000..0a312cc03 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_paste_arity_error.ark @@ -0,0 +1,2 @@ +($ a ($paste b [])) +(print a) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark new file mode 100644 index 000000000..6fcf3f1e6 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_spread_not_enough_args.ark @@ -0,0 +1,4 @@ +($ foo (a b c ...d) + (+ a b c ...d)) + +(foo 1 2) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark new file mode 100644 index 000000000..90a7a5151 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arg_type_error.ark @@ -0,0 +1,2 @@ +($ a ($symcat b [])) +(print a) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark new file mode 100644 index 000000000..714be5ad9 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_arity_error.ark @@ -0,0 +1,2 @@ +($ a { ($symcat b) }) +(print a) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark new file mode 100644 index 000000000..4e89e75a3 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_symcat_type_error.ark @@ -0,0 +1,2 @@ +($ a ($symcat 5 2)) +(print a) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark new file mode 100644 index 000000000..0c4d06d7e --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_macro_tail_arity_error.ark @@ -0,0 +1,2 @@ +($ a (tail 1 2)) +(print a) diff --git a/tests/fuzzing/corpus/tests_errors_macros_max_depth.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_macros_max_depth.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark new file mode 100644 index 000000000..43c78c50e --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_max_depth_eval.ark @@ -0,0 +1,2 @@ +($ last ((last 1 5 6 7 8) 0 s "@" (@ a00s -9))) +(last 1 5 6 7 8) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_macros_max_unification_depth.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark similarity index 96% rename from tests/fuzzing/corpus-cmin/tests_errors_macros_max_unification_depth.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark index ecad62b8e..10f94aaeb 100644 --- a/tests/fuzzing/corpus-cmin/tests_errors_macros_max_unification_depth.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_max_unification_depth.ark @@ -2,7 +2,7 @@ ($if (+ x 1) est_func ($ p (a b c) (* a b c))) - (symcat sym x)}) + ($symcat sym x)}) ($ partial (func ...defargs) { ($ bloc (suffix-dup a (len defargs))) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark new file mode 100644 index 000000000..cf41848d7 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_body_while.ark @@ -0,0 +1 @@ +(while 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark new file mode 100644 index 000000000..1bc9c9262 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if.ark @@ -0,0 +1 @@ +(if) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark new file mode 100644 index 000000000..92900e7a2 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_if_macro.ark @@ -0,0 +1 @@ +($if) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark new file mode 100644 index 000000000..b151c2fd3 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_cond_while.ark @@ -0,0 +1 @@ +(while) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark new file mode 100644 index 000000000..0c42accde --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_function_body.ark @@ -0,0 +1 @@ +(fun ()) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark new file mode 100644 index 000000000..14aef1aaa --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if.ark @@ -0,0 +1 @@ +(if 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark new file mode 100644 index 000000000..e9c905150 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_missing_then_if_macro.ark @@ -0,0 +1 @@ +($if true) diff --git a/tests/fuzzing/corpus/tests_errors_operators_no_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_no_args.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_operators_no_args.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_no_args.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_macros_not_enough_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_not_enough_args.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_macros_not_enough_args.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_not_enough_args.ark diff --git a/tests/fuzzing/corpus/tests_errors_operators_not_enough_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_operators_not_enough_args.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark new file mode 100644 index 000000000..203daf203 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_package_b.ark @@ -0,0 +1 @@ +(let bar 5) diff --git a/tests/fuzzing/corpus/tests_errors_mutability_pop_in_place.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_pop_in_place.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_mutability_pop_in_place.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_pop_in_place.ark diff --git a/tests/fuzzing/corpus-cmin/tests_errors_mutability_redefine.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_redefine.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_mutability_redefine.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_redefine.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark new file mode 100644 index 000000000..3c0711b8d --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_reused_macro_arg.ark @@ -0,0 +1 @@ +($ foo (bar bar egg) ()) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_self_append_in_place.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_self_append_in_place.ark new file mode 100644 index 000000000..b7ab0724f --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_self_append_in_place.ark @@ -0,0 +1,2 @@ +(mut d [4 5 6]) +(append! d d) diff --git a/tests/fuzzing/corpus/tests_errors_mutability_self_concat.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_self_concat.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_mutability_self_concat.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_self_concat.ark diff --git a/tests/fuzzing/corpus/tests_errors_mutability_set_const.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_set_const.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_mutability_set_const.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_set_const.ark diff --git a/tests/fuzzing/corpus/tests_errors_compiler_sub_import_too_long.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_sub_import_too_long.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_sub_import_too_long.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_sub_import_too_long.ark diff --git a/tests/fuzzing/corpus/tests_errors_macros_too_many_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_macros_too_many_args.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark diff --git a/tests/fuzzing/corpus/tests_errors_compiler_type_no_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_type_no_args.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_compiler_type_no_args.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_type_no_args.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_but_namespace.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_but_namespace.ark new file mode 100644 index 000000000..a36bed090 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_but_namespace.ark @@ -0,0 +1,3 @@ +(import package.b) + +(print bar) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_capture_unbound.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_capture_unbound.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark new file mode 100644 index 000000000..a8fb9bbf7 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var.ark @@ -0,0 +1 @@ +(let a b) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark new file mode 100644 index 000000000..ca966b8d5 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unbound_var_suggestion.ark @@ -0,0 +1,2 @@ +(let bar 12) +(let a ber) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark new file mode 100644 index 000000000..cdff91fa0 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_undef_macro_number.ark @@ -0,0 +1 @@ +($undef 1) diff --git a/tests/fuzzing/corpus/tests_errors_macros_unevaluated_spread.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unevaluated_spread.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_macros_unevaluated_spread.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_unevaluated_spread.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark new file mode 100644 index 000000000..0b78bcd78 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_well_formed_args.ark @@ -0,0 +1,5 @@ +($ defun (let name (fun args nil))) +(let foo 1) +(let a 2) +(let b 3) +(defun foo (a b) (+ a b)) diff --git a/tests/fuzzing/corpus/tests_errors_callable_arity_error_async.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_arity_error_async.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_callable_arity_error_async.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_arity_error_async.ark diff --git a/tests/fuzzing/corpus/tests_errors_index_at_out_of_range.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_index_at_out_of_range.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_out_of_range.ark diff --git a/tests/fuzzing/corpus/tests_errors_index_at_str_out_of_range.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_str_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_index_at_str_out_of_range.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_str_out_of_range.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark new file mode 100644 index 000000000..2de7cb2bb --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark @@ -0,0 +1 @@ +(import closure_field_wrong_fqn.b) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark new file mode 100644 index 000000000..a0a1d40de --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn_b.ark @@ -0,0 +1,10 @@ +(let tests 0) +(let closure (fun (&tests) ())) + +(let a 1) +(let b 2) + +(let make (fun (a b) + (fun (&a &b) ()))) +(let foo (make "hello" 1)) +(let c [foo.a foo.b]) diff --git a/tests/fuzzing/corpus/tests_errors_operators_db0.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_db0.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_operators_db0.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_db0.ark diff --git a/tests/fuzzing/corpus/tests_errors_scope_del_unbound.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_del_unbound.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_scope_del_unbound.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_del_unbound.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark new file mode 100644 index 000000000..53938ca46 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_fmt_arg_not_found.ark @@ -0,0 +1 @@ +(string:format "Hello {}, I'm {}" "World") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark new file mode 100644 index 000000000..2a99c795e --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_end_start.ark @@ -0,0 +1 @@ +(list:slice [1 2 3 4 5 6 7 8 9] 6 5 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark new file mode 100644 index 000000000..b88637a13 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_past_end.ark @@ -0,0 +1 @@ +(list:slice [1 2 3 4 5 6 7 8 9] 6 12 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark new file mode 100644 index 000000000..9d150c8a4 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_start_less_0.ark @@ -0,0 +1 @@ +(list:slice [1 2 3 4 5 6 7 8 9] -1 5 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark new file mode 100644 index 000000000..aa53b04c7 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_slice_step_null.ark @@ -0,0 +1 @@ +(list:slice [1 2 3 4 5 6 7 8 9] 4 5 -1) diff --git a/tests/fuzzing/corpus-cmin/tests_errors_type_nil_not_a_function.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_nil_not_a_function.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_errors_type_nil_not_a_function.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_nil_not_a_function.ark diff --git a/tests/fuzzing/corpus/tests_errors_type_not_a_closure.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_type_not_a_closure.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark diff --git a/tests/fuzzing/corpus/tests_errors_callable_not_callable.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_callable_not_callable.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark diff --git a/tests/fuzzing/corpus/tests_errors_callable_not_enough_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_not_enough_args.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_callable_not_enough_args.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_not_enough_args.ark diff --git a/tests/fuzzing/corpus/tests_errors_index_pop_out_of_range.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_index_pop_out_of_range.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark diff --git a/tests/fuzzing/corpus/tests_errors_callable_recursion_depth.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_recursion_depth.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_callable_recursion_depth.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_recursion_depth.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_errors_scope_set_unbound.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_set_unbound.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_errors_scope_set_unbound.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_set_unbound.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark new file mode 100644 index 000000000..b507a1ddb --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_str_remove_out_of_bound.ark @@ -0,0 +1 @@ +(string:removeAt "abc" 5) diff --git a/tests/fuzzing/corpus/tests_errors_callable_too_many_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_too_many_args.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_callable_too_many_args.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_too_many_args.ark diff --git a/tests/fuzzing/corpus/tests_errors_scope_unbound.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_unbound_var.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_scope_unbound.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_unbound_var.ark diff --git a/tests/fuzzing/corpus/tests_errors_type_unknown_field.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_unknown_field.ark similarity index 100% rename from tests/fuzzing/corpus/tests_errors_type_unknown_field.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_unknown_field.ark diff --git a/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark b/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark new file mode 100644 index 000000000..034519004 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark @@ -0,0 +1,3 @@ +(import a.b.c +:d # we need this one +) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark b/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark new file mode 100644 index 000000000..a72acb8a6 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark @@ -0,0 +1,3 @@ +{ + (print "hello") # comment +} diff --git a/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark b/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark new file mode 100644 index 000000000..423a8c59c --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark @@ -0,0 +1,8 @@ +(if server + { + # we can create multiple clients at the same time + (let cli2 (http:client:create "yahoo.com" 80)) + (set output (http:client:get cli2 "/")) + # the function returns a list: [code content] + (print (@ output 0)) # status: 301 + (let a 1)}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_escape_seq.ark b/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_escape_seq.ark new file mode 100644 index 000000000..62c352648 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_escape_seq.ark @@ -0,0 +1,5 @@ +(let a "\r\n\v\t") +(let b "\\\"") +(let c "\a\b\f") +(let d "\u1234") +(let e "\U12345678") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_functions.ark b/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_functions.ark index 5ee5366c0..2a148fb95 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_functions.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_formattersuite_functions.ark @@ -17,3 +17,4 @@ a # capture &c) # body {}) +(let foo (fun () (if true false nil))) diff --git a/tests/fuzzing/corpus/tests_arkscript_async-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_async-tests.ark similarity index 92% rename from tests/fuzzing/corpus/tests_arkscript_async-tests.ark rename to tests/fuzzing/corpus/tests_unittests_resources_langsuite_async-tests.ark index 68ae39e1d..f80e2b9d7 100644 --- a/tests/fuzzing/corpus/tests_arkscript_async-tests.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_async-tests.ark @@ -37,5 +37,4 @@ (let time-async (- (time) start-async)) (test:eq 1000 res-async) - (test:eq 1000 res-non-async) - (test:expect (< time-async time-non-async))})}) + (test:eq 1000 res-non-async)})}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_builtins-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_builtins-tests.ark new file mode 100644 index 000000000..e1554c8c9 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_builtins-tests.ark @@ -0,0 +1,63 @@ +(import std.Testing) + +(let base-list [1 2 3]) +(let base-list-enhanced (concat base-list [4 5])) + +(test:suite builtin { + (test:eq (append (append base-list 4) 5) base-list-enhanced) + (test:eq (concat base-list [4 5]) base-list-enhanced) + (test:eq (type []) "List") + (test:eq (list:reverse base-list) [3 2 1]) + (test:eq (list:reverse []) []) + (test:eq (list:find [] nil) -1) + (test:eq (list:find [12] 12) 0) + (test:eq (list:find [1 2 3] 2) 1) + (test:eq (list:find [12] nil) -1) + (test:eq (list:slice base-list-enhanced 0 3 1) base-list) + (test:eq (list:slice base-list-enhanced 0 1 1) [1]) + (test:eq (list:slice base-list-enhanced 0 3 2) [1 3]) + (test:eq (list:sort [5 4 3 2 1]) [1 2 3 4 5]) + (test:eq (list:sort [5]) [5]) + (test:eq (list:sort []) []) + + (let short_list (list:fill 12 nil)) + (test:eq (len short_list) 12) + (mut i 0) + (while (< i 12) { + (test:eq (@ short_list i) nil) + (set i (+ 1 i))}) + (del i) + + (test:eq (@ (list:setAt short_list 5 "a") 5) "a") + (del short_list) + + (test:expect (not (io:fileExists? "test.txt"))) + (io:writeFile "test.txt" "hello, world!") + (test:expect (io:fileExists? "test.txt")) + (test:eq (io:readFile "test.txt") "hello, world!") + (io:appendToFile "test.txt" "bis") + (test:eq (io:readFile "test.txt") "hello, world!bis") + (test:expect (> (len (io:listFiles "./")) 0)) + (test:expect (not (io:dir? "test.txt"))) + (test:expect (not (io:fileExists? "temp"))) + (io:makeDir "temp") + (test:expect (io:fileExists? "temp")) + (test:expect (io:dir? "temp")) + (let old (time)) + (sys:sleep 1) + (test:expect (< old (time))) + + (test:eq (string:find "abc" "d") -1) + (test:eq (string:find "abc" "a") 0) + (test:eq (string:find "abc" "bc") 1) + (test:eq (string:find "abcdefghijkl" "defijkl") -1) + (test:eq (string:find "abcdefghijkl" "defghijkl") 3) + (test:eq (string:removeAt "abcdefghijkl" 3) "abcefghijkl") + (test:eq (string:removeAt "abcdefghijkl" 0) "bcdefghijkl") + (test:eq (string:removeAt "abcdefghijkl" 11) "abcdefghijk") + + # no need to test the math functions since they're 1:1 binding of C++ functions and were carefully checked + # before writing this comment, to ensure we aren't binding math:sin to the C++ tan function + + # clean up + (io:removeFiles "test.txt" "temp/") }) diff --git a/tests/fuzzing/corpus-cmin/tests_arkscript_list-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_list-tests.ark similarity index 91% rename from tests/fuzzing/corpus-cmin/tests_arkscript_list-tests.ark rename to tests/fuzzing/corpus/tests_unittests_resources_langsuite_list-tests.ark index 0da2ea6ff..e22ff7b65 100644 --- a/tests/fuzzing/corpus-cmin/tests_arkscript_list-tests.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_list-tests.ark @@ -4,14 +4,14 @@ (let b [4 5 6]) (test:suite list { - (let make (fun (a b) - (fun (&a &b) ()))) + (let make (fun (c d) + (fun (&c &d) ()))) (let foo (make "hello" 1)) # if this is failing, this is most likely to be a compiler problem - (test:eq ["hello" 1] [foo.a foo.b]) - (test:eq 2 (len [foo.a foo.b])) - (test:eq ["hello"] (append [] foo.a)) + (test:eq ["hello" 1] [foo.c foo.d]) + (test:eq 2 (len [foo.c foo.d])) + (test:eq ["hello"] (append [] foo.c)) (test:case "append and return a new list" { (test:eq (append a 4) [1 2 3 4]) diff --git a/tests/fuzzing/corpus-cmin/tests_arkscript_macro-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_macro-tests.ark similarity index 77% rename from tests/fuzzing/corpus-cmin/tests_arkscript_macro-tests.ark rename to tests/fuzzing/corpus/tests_unittests_resources_langsuite_macro-tests.ark index be7a0c3dd..faef3ddf5 100644 --- a/tests/fuzzing/corpus-cmin/tests_arkscript_macro-tests.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_macro-tests.ark @@ -3,11 +3,11 @@ ($ suffix-dup (sym x) { ($if (> x 1) (suffix-dup sym (- x 1))) - (symcat sym x)}) + ($symcat sym x)}) (let magic_func (fun ((suffix-dup a 3)) (- a1 a2 a3))) ($ partial (func ...defargs) { - ($ bloc (suffix-dup a (- (argcount func) (len defargs)))) + ($ bloc (suffix-dup a (- ($argcount func) (len defargs)))) (fun (bloc) (func ...defargs bloc)) ($undef bloc)}) @@ -25,7 +25,25 @@ ($ add_two (a b) (+ a b)) (test:eq (add_two 1 2) 3) - (test:eq (add_two nice_value 2) 14) }) + (test:eq (add_two nice_value 2) 14) + + ($ c (a b) (* a b)) + (test:eq (c 4 10) 40) + + ($ d (a b) (/ a b)) + (test:eq (d 10 2) 5) }) + + (test:case "node manipulation" { + ($ node_tail () (tail (begin 1 2 3))) + ($ length () (len (fun () 5))) + ($ not_empty_node () (empty? (fun () ()))) + ($ empty_node () (empty? ())) + + (test:eq (length) 3) + (test:eq (not_empty_node) false) + (test:eq (empty_node) true) + # because it removes the "begin" + (test:eq (node_tail) [1 2 3]) }) (test:case "conditional macros" { (test:expect ($if (and true true) true false)) @@ -41,11 +59,14 @@ (test:expect ($if (>= nice_value 12) true false)) (test:expect ($if (@ [true false] 0) true false)) (test:expect ($if (@ [true false] -2) true false)) + (test:expect ($if 1 true false)) ($if true { ($ in_if_1 true) ($ in_if_2 true)}) + ($if true ($ new_value true)) (test:expect (and in_if_1 in_if_2) "a variable can be defined inside a conditional macro") + (test:expect new_value "variable can be defined inside a conditional macro") ($undef in_if_1) ($undef in_if_2) }) @@ -113,7 +134,7 @@ (test:case "define variable with a macro adding a suffix" { ($ nice_value 12) - ($ define (prefix suffix value) (let (symcat prefix suffix) value)) + ($ define (prefix suffix value) (let ($symcat prefix suffix) value)) (define a 1 2) (test:eq a1 2) @@ -126,11 +147,11 @@ (test:case "partial functions" { (test:eq (magic_func 1 2 3) (- 1 2 3)) - (test:eq (argcount test_func) 3) - (test:eq (argcount test_func1) 2) - (test:eq (argcount test_func1_2) 1) - (test:eq (argcount (fun () ())) 0) - (test:eq (argcount (fun (a) ())) 1) - (test:eq (argcount (fun (a b g h u t) ())) 6) + (test:eq ($argcount test_func) 3) + (test:eq ($argcount test_func1) 2) + (test:eq ($argcount test_func1_2) 1) + (test:eq ($argcount (fun () ())) 0) + (test:eq ($argcount (fun (a) ())) 1) + (test:eq ($argcount (fun (a b g h u t) ())) 6) (test:eq (test_func 1 2 3) (test_func1 2 3)) (test:eq (test_func 1 2 3) (test_func1_2 3)) })}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_string-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_string-tests.ark new file mode 100644 index 000000000..4322afa25 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_string-tests.ark @@ -0,0 +1,18 @@ +(import std.Testing) + +(test:suite string { + (test:case "remove char in string at index" { + (test:eq "hllo world" (string:removeAt "hello world" 1)) + (test:eq "ello world" (string:removeAt "hello world" 0)) + (test:eq "hello worl" (string:removeAt "hello world" 10)) }) + + (test:case "find substring" { + (test:eq -1 (string:find "hello" "help")) + (test:eq 0 (string:find "hello" "hel")) + (test:eq 2 (string:find "hello" "llo")) + (test:eq -1 (string:find "" "1")) }) + + (test:case "format strings" { + (test:eq "nilfalsetrue" (string:format "{}{}{}" nil false true)) + (test:eq "CProcedure" (string:format "{}" print)) + })}) diff --git a/tests/fuzzing/corpus-cmin/tests_arkscript_unittests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_unittests.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_arkscript_unittests.ark rename to tests/fuzzing/corpus/tests_unittests_resources_langsuite_unittests.ark diff --git a/tests/fuzzing/corpus-cmin/tests_arkscript_utf8-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_utf8-tests.ark similarity index 82% rename from tests/fuzzing/corpus-cmin/tests_arkscript_utf8-tests.ark rename to tests/fuzzing/corpus/tests_unittests_resources_langsuite_utf8-tests.ark index 5294d6adf..75e357724 100644 --- a/tests/fuzzing/corpus-cmin/tests_arkscript_utf8-tests.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_utf8-tests.ark @@ -26,7 +26,7 @@ (test:eq "\u1E0B" "ḋ") }) (test:case "testing emoji codepoints computing" { - (test:eq (str:ord "👺") 128122) - (test:eq (str:chr 128122) "👺") - (test:eq (str:ord "$") 36) - (test:eq (str:chr 36) "$") })}) + (test:eq (string:ord "👺") 128122) + (test:eq (string:chr 128122) "👺") + (test:eq (string:ord "$") 36) + (test:eq (string:chr 36) "$") })}) diff --git a/tests/fuzzing/corpus-cmin/tests_arkscript_vm-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_vm-tests.ark similarity index 91% rename from tests/fuzzing/corpus-cmin/tests_arkscript_vm-tests.ark rename to tests/fuzzing/corpus/tests_unittests_resources_langsuite_vm-tests.ark index 6f0cdeeb7..12af3af6c 100644 --- a/tests/fuzzing/corpus-cmin/tests_arkscript_vm-tests.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_vm-tests.ark @@ -12,7 +12,7 @@ (let closure_3 (make 3 2 3)) (let closure_4 (make2 1 2 3)) -(let inner 0) +(mut inner 0) (let call (fun () { (set val 5) (set inner 12) })) @@ -30,6 +30,7 @@ (test:case "arithmetic operations" { (test:eq (+ 1 2) 3) (test:eq (+ 1.5 2.5) 4.0) + (test:eq (+ "a" "b") "ab") (test:eq (- 1 2) -1) (test:eq (- 1.5 2) -0.5) (test:eq (/ 1 2) 0.5) @@ -102,6 +103,13 @@ (test:eq (@ ["h" "e" "l" "l" "o"] -1) "o") (test:eq (@ ["h" "e" "l" "l" "o"] -4) "e") }) + (test:case "Short-circuiting" { + (let falsy (fun () { + (test:expect false) + false })) + (test:expect (or true (falsy))) + (test:expect (not (and false (falsy)))) }) + (test:case "De Morgan's law" { (test:expect (and true true true)) (test:expect (not (and true nil true))) @@ -118,11 +126,11 @@ (test:eq (type nil) "Nil") (test:eq (type true) "Bool") (test:eq (type false) "Bool") - (test:expect (hasField closure "tests")) + (test:expect (hasField closure "vm-tests:tests")) (test:expect (not (hasField closure "12"))) }) (test:case "closures" { - (test:eq (toString closure) "(.tests=0)") + (test:eq (toString closure) "(.vm-tests:tests=0)") (test:eq closure_1 closure_1_bis) (test:eq closure_1 closure_2) (test:neq closure_1 closure_4) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_a.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_a.ark new file mode 100644 index 000000000..cf2784cad --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_a.ark @@ -0,0 +1,14 @@ +(import b) +(import c:*) +(import d :lamp) + +(let b_ok (= "b:arg" b:arg)) + +(let arg "a:arg") +(let a_ok (= "a:arg" arg)) + +(let b_foo_ok (= "aa aaa" (b:foo "aa" "aaa"))) + +(let c_ok (and (= "c:egg" c:egg) (= "c:bacon" c:bacon))) + +(let d_ok (= "d:lamp" d:lamp)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_b.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_b.ark new file mode 100644 index 000000000..37154aef8 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_b.ark @@ -0,0 +1,7 @@ +(let foo (fun (arg arg2) + (bar arg arg2))) + +(let arg "b:arg") + +(let bar (fun (one two) + (+ one " " two))) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_c.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_c.ark new file mode 100644 index 000000000..e91bf206c --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_c.ark @@ -0,0 +1,2 @@ +(let egg "c:egg") +(let bacon "c:bacon") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_d.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_d.ark new file mode 100644 index 000000000..f71bcab13 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_basic_d.ark @@ -0,0 +1,2 @@ +(let lamp "d:lamp") +(let nope "d:nope") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark new file mode 100644 index 000000000..445c6b8d6 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark @@ -0,0 +1,5 @@ +(import b) + +(let start (= [1 0] (b:parent.child.get))) +(b:parent.child.call) +(let end (= [5 12] (b:parent.child.get))) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark new file mode 100644 index 000000000..8e2e0a08a --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_forward_reference_b.ark @@ -0,0 +1,8 @@ +(mut inner 0) +(let call (fun () { + (set val 5) + (set inner 12) })) +(let get (fun () [val inner])) +(let child (fun (&inner &call &get) ())) +(mut val 1) +(let parent (fun (&val &child) ())) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_a.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_a.ark new file mode 100644 index 000000000..cc048c24d --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_a.ark @@ -0,0 +1,4 @@ +(import b) + +(let b_ok (= b:test "b:test")) +(let c_ok (= c:suite "c:suite")) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_b.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_b.ark new file mode 100644 index 000000000..dee14732a --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_b.ark @@ -0,0 +1,3 @@ +(import c) + +(let test (c:make_suite "b:test")) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark new file mode 100644 index 000000000..175770420 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_namespace_stacking_c.ark @@ -0,0 +1,2 @@ +(let make_suite (fun (name) name)) +(let suite (make_suite "c:suite")) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark new file mode 100644 index 000000000..5605abbcd --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark @@ -0,0 +1,5 @@ +(import b) +(import c) + +(let b_ok (= b:result "b:make")) +(let c_ok (= c:result "c:make")) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark new file mode 100644 index 000000000..044b3dd33 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark @@ -0,0 +1,3 @@ +(let make (fun (a b c) + "b:make")) +(let result (make 1 2 3)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark new file mode 100644 index 000000000..d45198bbd --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_shadowing_c.ark @@ -0,0 +1,7 @@ +(mut result nil) + +((fun () { + (let make (fun (a b) + "c:make")) + (set result (make "hello" 1)) + })) diff --git a/tests/fuzzing/docker/1-prepare-corpus.sh b/tests/fuzzing/docker/1-prepare-corpus.sh index 4fc049408..f2f54f8f8 100755 --- a/tests/fuzzing/docker/1-prepare-corpus.sh +++ b/tests/fuzzing/docker/1-prepare-corpus.sh @@ -14,6 +14,8 @@ export AFL_MAP_SIZE=223723 rm -rf tests/fuzzing/corpus-cmin/* rm -rf tests/fuzzing/corpus-cmin-tmin/* +mkdir -p tests/fuzzing/corpus-cmin +mkdir -p tests/fuzzing/corpus-cmin-tmin afl-cmin -i tests/fuzzing/corpus -o tests/fuzzing/corpus-cmin -T all -- "$exe" @@ -L "$ark_lib" cd tests/fuzzing/corpus-cmin || exit 1 diff --git a/tests/fuzzing/glob_all_ark_files.py b/tests/fuzzing/glob_all_ark_files.py index 7b01049f7..e2092a4f3 100644 --- a/tests/fuzzing/glob_all_ark_files.py +++ b/tests/fuzzing/glob_all_ark_files.py @@ -20,3 +20,4 @@ def exclude(file: str): with open(f"tests/fuzzing/corpus/{new_filename}", "w") as f: with open(file) as source: f.write(source.read()) +print("Copied all *.ark files to tests/fuzzing/corpus/")