From cf43ce02bb2d4b6678191012d6fc0adce6bb90f9 Mon Sep 17 00:00:00 2001 From: Alexandre Plateau Date: Tue, 27 May 2025 17:26:39 +0200 Subject: [PATCH 1/2] refactor(builtins): moving the builtins under a 'builtin__' prefix, to make proxy for them in the standard library to be able to scope them properly --- CHANGELOG.md | 4 + examples/collatz.ark | 3 + examples/games/game_of_life.ark | 1 + examples/show_ascii_table.ark | 6 +- include/Ark/Builtins/Builtins.hpp | 85 +++++----- include/Ark/Compiler/Common.hpp | 3 +- include/Ark/Compiler/Instructions.hpp | 43 ++--- include/Ark/VM/VM.hpp | 3 +- include/Ark/VM/VM.inl | 13 +- lib/modules | 2 +- lib/std | 2 +- src/arkreactor/Builtins/Builtins.cpp | 97 +++++------ src/arkreactor/Builtins/IO.cpp | 95 +---------- src/arkreactor/Builtins/List.cpp | 67 -------- src/arkreactor/Builtins/Mathematics.cpp | 159 ------------------ src/arkreactor/Builtins/String.cpp | 67 +------- src/arkreactor/Builtins/System.cpp | 30 ---- .../IROptimizer.cpp | 25 ++- src/arkreactor/VM/State.cpp | 11 +- src/arkreactor/VM/VM.cpp | 18 ++ .../benchmarks/resources/runtime/builtins.ark | 8 +- tests/fuzzing/arkscript.dict | 74 ++++---- tests/unittests/Suites/CompilerSuite.cpp | 4 +- tests/unittests/Suites/EmbeddingSuite.cpp | 46 +++++ .../resources/ASTSuite/99bottles.ark | 5 +- .../resources/ASTSuite/99bottles.json | 4 +- .../resources/CompilerSuite/ir/99bottles.ark | 5 +- .../CompilerSuite/ir/99bottles.expected | 26 +-- .../CompilerSuite/optimized_ir/99bottles.ark | 5 +- .../optimized_ir/99bottles.expected | 97 +++++++---- .../CompilerSuite/optimized_ir/builtins.ark | 3 + .../optimized_ir/builtins.expected | 23 +++ .../name_collision_with_builtin.ark | 4 +- .../name_collision_with_builtin.expected | 10 +- .../compileTime/package/list.ark | 2 +- .../runtime/builtin_proxy_not_enough_args.ark | 2 + .../builtin_proxy_not_enough_args.expected | 7 + .../runtime/builtin_proxy_too_many_args.ark | 2 + .../builtin_proxy_too_many_args.expected | 7 + .../runtime/fmt_arg_not_found.ark | 2 +- .../runtime/fmt_arg_not_found.expected | 6 +- .../DiagnosticsSuite/runtime/list_set_at.ark | 2 +- .../runtime/list_set_at.expected | 4 +- .../runtime/list_slice_end_start.ark | 2 +- .../runtime/list_slice_end_start.expected | 4 +- .../runtime/list_slice_past_end.ark | 2 +- .../runtime/list_slice_past_end.expected | 4 +- .../runtime/list_slice_start_less_0.ark | 2 +- .../runtime/list_slice_start_less_0.expected | 4 +- .../runtime/list_slice_step_null.ark | 2 +- .../runtime/list_slice_step_null.expected | 4 +- .../runtime/mathln_out_of_range.ark | 2 +- .../runtime/mathln_out_of_range.expected | 4 +- .../runtime/str_remove_out_of_bound.ark | 2 +- .../runtime/str_remove_out_of_bound.expected | 4 +- .../runtime/string_set_at.ark | 2 +- .../runtime/string_set_at.expected | 4 +- .../typeChecking/ioappendtofile_num_num.ark | 2 +- .../ioappendtofile_num_num.expected | 4 +- .../typeChecking/iodir_num.ark | 2 +- .../typeChecking/iodir_num.expected | 4 +- .../typeChecking/iofileexists_num.ark | 2 +- .../typeChecking/iofileexists_num.expected | 4 +- .../typeChecking/iolistfiles_num.ark | 2 +- .../typeChecking/iolistfiles_num.expected | 4 +- .../typeChecking/iomakedir_num.ark | 2 +- .../typeChecking/iomakedir_num.expected | 4 +- .../typeChecking/ioreadfile_inexistent.ark | 2 +- .../ioreadfile_inexistent.expected | 4 +- .../typeChecking/ioreadfile_num.ark | 2 +- .../typeChecking/ioreadfile_num.expected | 4 +- .../typeChecking/ioremovefile_num.ark | 1 + .../typeChecking/ioremovefile_num.expected | 7 + .../typeChecking/ioremovefiles_num.ark | 1 - .../typeChecking/ioremovefiles_num.expected | 7 - .../typeChecking/ioremovefiles_str_num.ark | 2 - .../ioremovefiles_str_num.expected | 9 - .../typeChecking/iowritefile_num_num.ark | 2 +- .../typeChecking/iowritefile_num_num.expected | 4 +- .../typeChecking/listfill_str.ark | 2 +- .../typeChecking/listfill_str.expected | 4 +- .../typeChecking/listfind_str_num.ark | 2 +- .../typeChecking/listfind_str_num.expected | 4 +- .../typeChecking/listreverse_str.ark | 2 +- .../typeChecking/listreverse_str.expected | 4 +- .../typeChecking/listsetat_str.ark | 2 +- .../typeChecking/listsetat_str.expected | 4 +- .../listslice_str_num_bool_nil.ark | 2 +- .../listslice_str_num_bool_nil.expected | 4 +- .../typeChecking/listsort_str.ark | 2 +- .../typeChecking/listsort_str.expected | 4 +- .../typeChecking/mathacosh_str.ark | 2 +- .../typeChecking/mathacosh_str.expected | 4 +- .../typeChecking/matharccos_str.ark | 2 +- .../typeChecking/matharccos_str.expected | 4 +- .../typeChecking/matharcsin_str.ark | 2 +- .../typeChecking/matharcsin_str.expected | 4 +- .../typeChecking/matharctan_str.ark | 2 +- .../typeChecking/matharctan_str.expected | 4 +- .../typeChecking/mathasinh_str.ark | 2 +- .../typeChecking/mathasinh_str.expected | 4 +- .../typeChecking/mathatanh_str.ark | 2 +- .../typeChecking/mathatanh_str.expected | 4 +- .../typeChecking/mathceil_str.ark | 2 +- .../typeChecking/mathceil_str.expected | 4 +- .../typeChecking/mathcos_str.ark | 2 +- .../typeChecking/mathcos_str.expected | 4 +- .../typeChecking/mathcosh_str.ark | 2 +- .../typeChecking/mathcosh_str.expected | 4 +- .../typeChecking/mathexp_str.ark | 2 +- .../typeChecking/mathexp_str.expected | 4 +- .../typeChecking/mathfloor_str.ark | 2 +- .../typeChecking/mathfloor_str.expected | 4 +- .../typeChecking/mathln_str.ark | 2 +- .../typeChecking/mathln_str.expected | 4 +- .../typeChecking/mathround_str.ark | 2 +- .../typeChecking/mathround_str.expected | 4 +- .../typeChecking/mathsin_str.ark | 2 +- .../typeChecking/mathsin_str.expected | 4 +- .../typeChecking/mathsinh_str.ark | 2 +- .../typeChecking/mathsinh_str.expected | 4 +- .../typeChecking/mathtan_str.ark | 2 +- .../typeChecking/mathtan_str.expected | 4 +- .../typeChecking/mathtanh_str.ark | 2 +- .../typeChecking/mathtanh_str.expected | 4 +- .../typeChecking/stringchr_str.ark | 2 +- .../typeChecking/stringchr_str.expected | 4 +- .../typeChecking/stringfind_num.ark | 2 +- .../typeChecking/stringfind_num.expected | 4 +- .../typeChecking/stringformat_num.ark | 2 +- .../typeChecking/stringformat_num.expected | 6 +- .../typeChecking/stringord_num.ark | 2 +- .../typeChecking/stringord_num.expected | 4 +- .../typeChecking/stringremoveat_num.ark | 2 +- .../typeChecking/stringremoveat_num.expected | 4 +- .../typeChecking/stringsetat_str.ark | 2 +- .../typeChecking/stringsetat_str.expected | 4 +- .../typeChecking/syssleep_str.ark | 2 +- .../typeChecking/syssleep_str.expected | 4 +- .../resources/LangSuite/builtins-tests.ark | 27 +-- .../resources/LangSuite/list-tests.ark | 42 ++--- .../resources/LangSuite/string-tests.ark | 42 ++--- .../resources/LangSuite/unittests.ark | 2 +- .../resources/LangSuite/utf8-tests.ark | 8 +- .../RosettaSuite/abc_correlation.ark | 1 + .../RosettaSuite/ascending_prime.ark | 8 +- .../RosettaSuite/calculating_value_of_e.ark | 1 + .../resources/RosettaSuite/infinity.ark | 2 + .../resources/RosettaSuite/munchausen.ark | 1 + .../RosettaSuite/string_matching.ark | 4 +- 150 files changed, 643 insertions(+), 876 deletions(-) create mode 100644 tests/unittests/resources/CompilerSuite/optimized_ir/builtins.ark create mode 100644 tests/unittests/resources/CompilerSuite/optimized_ir/builtins.expected create mode 100644 tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_not_enough_args.ark create mode 100644 tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_not_enough_args.expected create mode 100644 tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_too_many_args.ark create mode 100644 tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_too_many_args.expected create mode 100644 tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefile_num.ark create mode 100644 tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefile_num.expected delete mode 100644 tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_num.ark delete mode 100644 tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_num.expected delete mode 100644 tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_str_num.ark delete mode 100644 tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_str_num.expected diff --git a/CHANGELOG.md b/CHANGELOG.md index 429c6e68b..bea0a49b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -136,6 +136,10 @@ - this works inside normal scopes (introduced by while loops) and functions scopes, but not for closures - VM stack size is now 4096 instead of 8192 - `Ark::CodeError` now takes a `CodeErrorContext` to store the source (filename, line, column, expression) of an error +- renamed `string:format` to `format` +- `io:removeFiles` is now `io:removeFile` and works on a single file/path +- renamed almost all builtins to prefix them with `builtin__`, to have them proxied in the standard library (to be able to import and scope them properly) +- new super instruction `CALL_BUILTIN_WITHOUT_RETURN_ADDRESS` to optimize the proxied builtins, skipping the return address deletion ### Removed - removed unused `NodeType::Closure` diff --git a/examples/collatz.ark b/examples/collatz.ark index 917a223ac..7bcd07c4f 100644 --- a/examples/collatz.ark +++ b/examples/collatz.ark @@ -1,3 +1,6 @@ +(import std.Sys) +(import std.Math) + # 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) diff --git a/examples/games/game_of_life.ark b/examples/games/game_of_life.ark index dd320fb21..04fb3f739 100644 --- a/examples/games/game_of_life.ark +++ b/examples/games/game_of_life.ark @@ -1,6 +1,7 @@ (import std.List) (import std.String) (import std.Switch) +(import std.Math) (let board [0 0 0 1 1 1 0 0 0]) (let width 3) diff --git a/examples/show_ascii_table.ark b/examples/show_ascii_table.ark index a730a55e6..efb2bc89b 100644 --- a/examples/show_ascii_table.ark +++ b/examples/show_ascii_table.ark @@ -1,3 +1,5 @@ +(import std.String :chr) + (mut i 0) (while (< i 16) { (mut j (+ 32 i)) @@ -7,8 +9,8 @@ "Spc" (if (= 127 j) "Del" - (string:chr j)))) - (puts (string:format "{:3} : {:<3}" j k)) + (chr j)))) + (puts (format "{:3} : {:<3}" j k)) (set j (+ 16 j)) }) (print "") diff --git a/include/Ark/Builtins/Builtins.hpp b/include/Ark/Builtins/Builtins.hpp index daa934c65..db43b9a16 100644 --- a/include/Ark/Builtins/Builtins.hpp +++ b/include/Ark/Builtins/Builtins.hpp @@ -26,6 +26,7 @@ namespace Ark::internal::Builtins extern const Value falseSym; extern const Value trueSym; extern const Value nil; + extern const Value platform; ARK_API extern const std::vector> builtins; @@ -34,12 +35,12 @@ namespace Ark::internal::Builtins // ------------------------------ namespace List { - Value reverseList(std::vector& n, VM* vm); // list:reverse, single arg - Value findInList(std::vector& n, VM* vm); // list:find, 2 arguments - Value sliceList(std::vector& n, VM* vm); // list:slice, 4 arguments - Value sort_(std::vector& n, VM* vm); // list:sort, 1 argument - Value fill(std::vector& n, VM* vm); // list:fill, 2 arguments - Value setListAt(std::vector& n, VM* vm); // list:setAt, 3 arguments + Value reverseList(std::vector& n, VM* vm); // builtin__list:reverse, single arg + Value findInList(std::vector& n, VM* vm); // builtin__list:find, 2 arguments + Value sliceList(std::vector& n, VM* vm); // builtin__list:slice, 4 arguments + Value sort_(std::vector& n, VM* vm); // builtin__list:sort, 1 argument + Value fill(std::vector& n, VM* vm); // builtin__list:fill, 2 arguments + Value setListAt(std::vector& n, VM* vm); // builtin__list:setAt, 3 arguments } namespace IO @@ -47,14 +48,14 @@ namespace Ark::internal::Builtins Value print(std::vector& n, VM* vm); // print, multiple arguments Value puts_(std::vector& n, VM* vm); // puts, multiple arguments Value input(std::vector& n, VM* vm); // input, 0 or 1 argument - Value writeFile(std::vector& n, VM* vm); // io:writeFile, 2 arguments - Value appendToFile(std::vector& n, VM* vm); // io:appendToFile, 2 arguments - Value readFile(std::vector& n, VM* vm); // io:readFile, 1 argument - Value fileExists(std::vector& n, VM* vm); // io:fileExists?, 1 argument - Value listFiles(std::vector& n, VM* vm); // io:listFiles, 1 argument - Value isDirectory(std::vector& n, VM* vm); // io:isDir?, 1 argument - Value makeDir(std::vector& n, VM* vm); // io:makeDir, 1 argument - Value removeFiles(std::vector& n, VM* vm); // io:removeFiles, multiple arguments + Value writeFile(std::vector& n, VM* vm); // builtin__io:writeFile, 2 arguments + Value appendToFile(std::vector& n, VM* vm); // builtin__io:appendToFile, 2 arguments + Value readFile(std::vector& n, VM* vm); // builtin__io:readFile, 1 argument + Value fileExists(std::vector& n, VM* vm); // builtin__io:fileExists?, 1 argument + Value listFiles(std::vector& n, VM* vm); // builtin__io:listFiles, 1 argument + Value isDirectory(std::vector& n, VM* vm); // builtin__io:isDir?, 1 argument + Value makeDir(std::vector& n, VM* vm); // builtin__io:makeDir, 1 argument + Value removeFile(std::vector& n, VM* vm); // builtin__io:removeFile, multiple arguments } namespace Time @@ -64,30 +65,30 @@ namespace Ark::internal::Builtins namespace System { - Value system_(std::vector& n, VM* vm); // sys:exec, 1 argument - Value sleep(std::vector& n, VM* vm); // sleep, 1 argument - Value exit_(std::vector& n, VM* vm); // sys:exit, 1 argument + Value system_(std::vector& n, VM* vm); // builtin__sys:exec, 1 argument + Value sleep(std::vector& n, VM* vm); // builtin__sys:sleep, 1 argument + Value exit_(std::vector& n, VM* vm); // builtin__sys:exit, 1 argument } namespace String { - Value format(std::vector& n, VM* vm); // string:format, multiple arguments - Value findSubStr(std::vector& n, VM* vm); // string:find, 2 arguments - Value removeAtStr(std::vector& n, VM* vm); // string:removeAt, 2 arguments - Value ord(std::vector& n, VM* vm); // string:ord, 1 arguments - Value chr(std::vector& n, VM* vm); // string:chr, 1 arguments - Value setStringAt(std::vector& n, VM* vm); // string::setAt, 3 arguments + Value format(std::vector& n, VM* vm); // format, multiple arguments + Value findSubStr(std::vector& n, VM* vm); // builtin__string:find, 2 arguments + Value removeAtStr(std::vector& n, VM* vm); // builtin__string:removeAt, 2 arguments + Value ord(std::vector& n, VM* vm); // builtin__string:ord, 1 arguments + Value chr(std::vector& n, VM* vm); // builtin__string:chr, 1 arguments + Value setStringAt(std::vector& n, VM* vm); // builtin__string::setAt, 3 arguments } namespace Mathematics { - Value exponential(std::vector& n, VM* vm); // math:exp, 1 argument - Value logarithm(std::vector& n, VM* vm); // math:ln, 1 argument - Value ceil_(std::vector& n, VM* vm); // math:ceil, 1 argument - Value floor_(std::vector& n, VM* vm); // math:floor, 1 argument - Value round_(std::vector& n, VM* vm); // math:round, 1 argument - Value isnan_(std::vector& n, VM* vm); // math:NaN?, 1 argument - Value isinf_(std::vector& n, VM* vm); // math:Inf?, 1 argument + Value exponential(std::vector& n, VM* vm); // builtin__math:exp, 1 argument + Value logarithm(std::vector& n, VM* vm); // builtin__math:ln, 1 argument + Value ceil_(std::vector& n, VM* vm); // builtin__math:ceil, 1 argument + Value floor_(std::vector& n, VM* vm); // builtin__math:floor, 1 argument + Value round_(std::vector& n, VM* vm); // builtin__math:round, 1 argument + Value isnan_(std::vector& n, VM* vm); // builtin__math:NaN?, 1 argument + Value isinf_(std::vector& n, VM* vm); // builtin__math:Inf?, 1 argument extern const Value pi_; extern const Value e_; @@ -95,18 +96,18 @@ namespace Ark::internal::Builtins extern const Value inf_; extern const Value nan_; - Value cos_(std::vector& n, VM* vm); // math:cos, 1 argument - Value sin_(std::vector& n, VM* vm); // math:sin, 1 argument - Value tan_(std::vector& n, VM* vm); // math:tan, 1 argument - Value acos_(std::vector& n, VM* vm); // math:arccos, 1 argument - Value asin_(std::vector& n, VM* vm); // math:arcsin, 1 argument - Value atan_(std::vector& n, VM* vm); // math:arctan, 1 argument - Value cosh_(std::vector& n, VM* vm); // math:cosh, 1 argument - Value sinh_(std::vector& n, VM* vm); // math:sinh, 1 argument - Value tanh_(std::vector& n, VM* vm); // math:tanh, 1 argument - Value acosh_(std::vector& n, VM* vm); // math:acosh, 1 argument - Value asinh_(std::vector& n, VM* vm); // math:asinh, 1 argument - Value atanh_(std::vector& n, VM* vm); // math:atanh, 1 argument + Value cos_(std::vector& n, VM* vm); // builtin__math:cos, 1 argument + Value sin_(std::vector& n, VM* vm); // builtin__math:sin, 1 argument + Value tan_(std::vector& n, VM* vm); // builtin__math:tan, 1 argument + Value acos_(std::vector& n, VM* vm); // builtin__math:arccos, 1 argument + Value asin_(std::vector& n, VM* vm); // builtin__math:arcsin, 1 argument + Value atan_(std::vector& n, VM* vm); // builtin__math:arctan, 1 argument + Value cosh_(std::vector& n, VM* vm); // builtin__math:cosh, 1 argument + Value sinh_(std::vector& n, VM* vm); // builtin__math:sinh, 1 argument + Value tanh_(std::vector& n, VM* vm); // builtin__math:tanh, 1 argument + Value acosh_(std::vector& n, VM* vm); // builtin__math:acosh, 1 argument + Value asinh_(std::vector& n, VM* vm); // builtin__math:asinh, 1 argument + Value atanh_(std::vector& n, VM* vm); // builtin__math:atanh, 1 argument Value random(std::vector& n, VM* vm); // random, 0-2 args } diff --git a/include/Ark/Compiler/Common.hpp b/include/Ark/Compiler/Common.hpp index 6c54d9462..7dfae238a 100644 --- a/include/Ark/Compiler/Common.hpp +++ b/include/Ark/Compiler/Common.hpp @@ -124,8 +124,7 @@ namespace Ark::internal SetAt2InPlace }; - constexpr std::string_view SysArgs = "sys:args"; - constexpr std::string_view SysPlatform = "sys:platform"; + constexpr std::string_view SysArgs = "builtin__sys:args"; constexpr std::string_view And = "and"; constexpr std::string_view Or = "or"; diff --git a/include/Ark/Compiler/Instructions.hpp b/include/Ark/Compiler/Instructions.hpp index 976858e77..98b8decf2 100644 --- a/include/Ark/Compiler/Instructions.hpp +++ b/include/Ark/Compiler/Instructions.hpp @@ -321,81 +321,85 @@ namespace Ark::internal // @role Call a builtin by its id in #[code primary], with #[code secondary] arguments. Bypass the stack size check because we do not push IP/PP since builtins calls do not alter the stack CALL_BUILTIN = 0x50, + // @args builtin id, argument count + // @role Call a builtin by its id in #[code primary], with #[code secondary] arguments. Bypass the stack size check because we do not push IP/PP since builtins calls do not alter the stack, as well as the return address removal + CALL_BUILTIN_WITHOUT_RETURN_ADDRESS = 0x51, + // @args constant id, absolute address to jump to // @role Compare #[code TS < constant], if the comparison fails, jump to the given address. Otherwise, does nothing - LT_CONST_JUMP_IF_FALSE = 0x51, + LT_CONST_JUMP_IF_FALSE = 0x52, // @args constant id, absolute address to jump to // @role Compare #[code TS < constant], if the comparison succeeds, jump to the given address. Otherwise, does nothing - LT_CONST_JUMP_IF_TRUE = 0x52, + LT_CONST_JUMP_IF_TRUE = 0x53, // @args symbol id, absolute address to jump to // @role Compare #[code TS < symbol], if the comparison fails, jump to the given address. Otherwise, does nothing - LT_SYM_JUMP_IF_FALSE = 0x53, + LT_SYM_JUMP_IF_FALSE = 0x54, // @args constant id, absolute address to jump to // @role Compare #[code TS > constant], if the comparison succeeds, jump to the given address. Otherwise, does nothing - GT_CONST_JUMP_IF_TRUE = 0x54, + GT_CONST_JUMP_IF_TRUE = 0x55, // @args constant id, absolute address to jump to // @role Compare #[code TS > constant], if the comparison fails, jump to the given address. Otherwise, does nothing - GT_CONST_JUMP_IF_FALSE = 0x55, + GT_CONST_JUMP_IF_FALSE = 0x56, // @args symbol id, absolute address to jump to // @role Compare #[code TS > symbol], if the comparison fails, jump to the given address. Otherwise, does nothing - GT_SYM_JUMP_IF_FALSE = 0x56, + GT_SYM_JUMP_IF_FALSE = 0x57, // @args constant id, absolute address to jump to // @role Compare #[code TS == constant], if the comparison succeeds, jump to the given address. Otherwise, does nothing - EQ_CONST_JUMP_IF_TRUE = 0x57, + EQ_CONST_JUMP_IF_TRUE = 0x58, // @args symbol index, absolute address to jump to // @role Compare #[code TS == symbol], if the comparison succeeds, jump to the given address. Otherwise, does nothing - EQ_SYM_INDEX_JUMP_IF_TRUE = 0x58, + EQ_SYM_INDEX_JUMP_IF_TRUE = 0x59, // @args constant id, absolute address to jump to // @role Compare #[code TS != constant], if the comparison succeeds, jump to the given address. Otherwise, does nothing - NEQ_CONST_JUMP_IF_TRUE = 0x59, + NEQ_CONST_JUMP_IF_TRUE = 0x5a, // @args symbol id, absolute address to jump to // @role Compare #[code TS != symbol], if the comparison fails, jump to the given address. Otherwise, does nothing - NEQ_SYM_JUMP_IF_FALSE = 0x5a, + NEQ_SYM_JUMP_IF_FALSE = 0x5b, // @args symbol id, argument count // @role Call a symbol by its id in #[code primary], with #[code secondary] arguments - CALL_SYMBOL = 0x5b, + CALL_SYMBOL = 0x5c, // @args symbol id, field id in symbols table // @role Push the field of a given symbol (which has to be a closure) on the stack - GET_FIELD_FROM_SYMBOL = 0x5c, + GET_FIELD_FROM_SYMBOL = 0x5d, // @args symbol index, field id in symbols table // @role Push the field of a given symbol (which has to be a closure) on the stack - GET_FIELD_FROM_SYMBOL_INDEX = 0x5d, + GET_FIELD_FROM_SYMBOL_INDEX = 0x5e, // @args symbol id, symbol id2 // @role Push symbol[symbol2] - AT_SYM_SYM = 0x5e, + AT_SYM_SYM = 0x5f, // @args symbol index, symbol index2 // @role Push symbol[symbol2] - AT_SYM_INDEX_SYM_INDEX = 0x5f, + AT_SYM_INDEX_SYM_INDEX = 0x60, // @args symbol id, constant id // @role Check that the type of symbol is the given constant, push true if so, false otherwise - CHECK_TYPE_OF = 0x60, + CHECK_TYPE_OF = 0x61, // @args symbol index, constant id // @role Check that the type of symbol is the given constant, push true if so, false otherwise - CHECK_TYPE_OF_BY_INDEX = 0x61, + CHECK_TYPE_OF_BY_INDEX = 0x62, // @args symbol id, number of elements // @role Append N elements to a reference to a list (symbol id), the list is being mutated in-place, no new object created. Elements are stored in TS(1)..TS(N). Follows the function calling convention - APPEND_IN_PLACE_SYM = 0x62, + APPEND_IN_PLACE_SYM = 0x63, // @args symbol index, number of elements // @role Append N elements to a reference to a list (symbol index), the list is being mutated in-place, no new object created. Elements are stored in TS(1)..TS(N). Follows the function calling convention - APPEND_IN_PLACE_SYM_INDEX = 0x63, + APPEND_IN_PLACE_SYM_INDEX = 0x64, InstructionsCount }; @@ -484,6 +488,7 @@ namespace Ark::internal "SET_VAL_HEAD", "SET_VAL_HEAD_BY_INDEX", "CALL_BUILTIN", + "CALL_BUILTIN_WITHOUT_RETURN_ADDRESS", "LT_CONST_JUMP_IF_FALSE", "LT_CONST_JUMP_IF_TRUE", "LT_SYM_JUMP_IF_FALSE", diff --git a/include/Ark/VM/VM.hpp b/include/Ark/VM/VM.hpp index 5f6d79d8b..3d4c586dd 100644 --- a/include/Ark/VM/VM.hpp +++ b/include/Ark/VM/VM.hpp @@ -381,8 +381,9 @@ namespace Ark * @param context * @param builtin the builtin to call * @param argc number of arguments already sent + * @param remove_return_address remove the return address pushed by the compiler */ - inline void callBuiltin(internal::ExecutionContext& context, const Value& builtin, uint16_t argc); + inline void callBuiltin(internal::ExecutionContext& context, const Value& builtin, uint16_t argc, bool remove_return_address = true); }; #include "VM.inl" diff --git a/include/Ark/VM/VM.inl b/include/Ark/VM/VM.inl index a39fb744b..b447e7772 100644 --- a/include/Ark/VM/VM.inl +++ b/include/Ark/VM/VM.inl @@ -309,11 +309,20 @@ inline void VM::call(internal::ExecutionContext& context, const uint16_t argc, V index += 4; // instructions are on 4 bytes } + // no store? check for CALL_BUILTIN_WITHOUT_RETURN_ADDRESS + if (index == 0 && m_state.m_pages[context.pp][0] == CALL_BUILTIN_WITHOUT_RETURN_ADDRESS) + { + const uint8_t padding = m_state.m_pages[context.pp][context.ip + 1]; + const uint16_t arg = static_cast((m_state.m_pages[context.pp][context.ip + 2] << 8) + + m_state.m_pages[context.pp][context.ip + 3]); + needed_argc = static_cast((padding << 4) | (arg & 0xf000) >> 12); + } + if (std::cmp_not_equal(needed_argc, argc)) [[unlikely]] throwArityError(argc, needed_argc, context); } -inline void VM::callBuiltin(internal::ExecutionContext& context, const Value& builtin, const uint16_t argc) +inline void VM::callBuiltin(internal::ExecutionContext& context, const Value& builtin, const uint16_t argc, const bool remove_return_address) { // drop arguments from the stack std::vector args; @@ -330,7 +339,7 @@ inline void VM::callBuiltin(internal::ExecutionContext& context, const Value& bu args.emplace_back(*val); } // +2 to skip PP/IP that were pushed by PUSH_RETURN_ADDRESS - context.sp -= argc + 2; + context.sp -= argc + (remove_return_address ? 2 : 0); // call proc push(builtin.proc()(args, this), context); } diff --git a/lib/modules b/lib/modules index da40133fa..530a7f976 160000 --- a/lib/modules +++ b/lib/modules @@ -1 +1 @@ -Subproject commit da40133fa3fe8f3bfd6951751a9c03c842dad753 +Subproject commit 530a7f97646a6fe851e9a41bf26944a520ed7348 diff --git a/lib/std b/lib/std index 999e6c529..ce6b59189 160000 --- a/lib/std +++ b/lib/std @@ -1 +1 @@ -Subproject commit 999e6c52950e5aab51fa75746a654090438f7f51 +Subproject commit ce6b591895bab4ab811f803c7126f57e9f76df1a diff --git a/src/arkreactor/Builtins/Builtins.cpp b/src/arkreactor/Builtins/Builtins.cpp index 82541b446..ede239fef 100644 --- a/src/arkreactor/Builtins/Builtins.cpp +++ b/src/arkreactor/Builtins/Builtins.cpp @@ -2,6 +2,7 @@ #include #include +#include #include namespace Ark::internal::Builtins @@ -9,6 +10,7 @@ namespace Ark::internal::Builtins extern const Value falseSym = Value(ValueType::False); extern const Value trueSym = Value(ValueType::True); extern const Value nil = Value(ValueType::Nil); + extern const Value platform = Value(ARK_PLATFORM_NAME); namespace Mathematics { @@ -26,67 +28,68 @@ namespace Ark::internal::Builtins { "nil", nil }, // List - { "list:reverse", Value(List::reverseList) }, - { "list:find", Value(List::findInList) }, - { "list:slice", Value(List::sliceList) }, - { "list:sort", Value(List::sort_) }, - { "list:fill", Value(List::fill) }, - { "list:setAt", Value(List::setListAt) }, + { "builtin__list:reverse", Value(List::reverseList) }, + { "builtin__list:find", Value(List::findInList) }, + { "builtin__list:slice", Value(List::sliceList) }, + { "builtin__list:sort", Value(List::sort_) }, + { "builtin__list:fill", Value(List::fill) }, + { "builtin__list:setAt", Value(List::setListAt) }, // IO { "print", Value(IO::print) }, { "puts", Value(IO::puts_) }, { "input", Value(IO::input) }, - { "io:writeFile", Value(IO::writeFile) }, - { "io:appendToFile", Value(IO::appendToFile) }, - { "io:readFile", Value(IO::readFile) }, - { "io:fileExists?", Value(IO::fileExists) }, - { "io:listFiles", Value(IO::listFiles) }, - { "io:dir?", Value(IO::isDirectory) }, - { "io:makeDir", Value(IO::makeDir) }, - { "io:removeFiles", Value(IO::removeFiles) }, + { "builtin__io:writeFile", Value(IO::writeFile) }, + { "builtin__io:appendToFile", Value(IO::appendToFile) }, + { "builtin__io:readFile", Value(IO::readFile) }, + { "builtin__io:fileExists?", Value(IO::fileExists) }, + { "builtin__io:listFiles", Value(IO::listFiles) }, + { "builtin__io:dir?", Value(IO::isDirectory) }, + { "builtin__io:makeDir", Value(IO::makeDir) }, + { "builtin__io:removeFile", Value(IO::removeFile) }, // Time { "time", Value(Time::timeSinceEpoch) }, // System - { "sys:exec", Value(System::system_) }, - { "sys:sleep", Value(System::sleep) }, - { "sys:exit", Value(System::exit_) }, + { "builtin__sys:platform", platform }, + { "builtin__sys:exec", Value(System::system_) }, + { "builtin__sys:sleep", Value(System::sleep) }, + { "builtin__sys:exit", Value(System::exit_) }, // String - { "string:format", Value(String::format) }, - { "string:find", Value(String::findSubStr) }, - { "string:removeAt", Value(String::removeAtStr) }, - { "string:ord", Value(String::ord) }, - { "string:chr", Value(String::chr) }, - { "string:setAt", Value(String::setStringAt) }, + { "format", Value(String::format) }, + { "builtin__string:find", Value(String::findSubStr) }, + { "builtin__string:removeAt", Value(String::removeAtStr) }, + { "builtin__string:ord", Value(String::ord) }, + { "builtin__string:chr", Value(String::chr) }, + { "builtin__string:setAt", Value(String::setStringAt) }, // Mathematics - { "math:exp", Value(Mathematics::exponential) }, - { "math:ln", Value(Mathematics::logarithm) }, - { "math:ceil", Value(Mathematics::ceil_) }, - { "math:floor", Value(Mathematics::floor_) }, - { "math:round", Value(Mathematics::round_) }, - { "math:NaN?", Value(Mathematics::isnan_) }, - { "math:Inf?", Value(Mathematics::isinf_) }, - { "math:pi", Mathematics::pi_ }, - { "math:e", Mathematics::e_ }, - { "math:tau", Mathematics::tau_ }, - { "math:Inf", Mathematics::inf_ }, - { "math:NaN", Mathematics::nan_ }, - { "math:cos", Value(Mathematics::cos_) }, - { "math:sin", Value(Mathematics::sin_) }, - { "math:tan", Value(Mathematics::tan_) }, - { "math:arccos", Value(Mathematics::acos_) }, - { "math:arcsin", Value(Mathematics::asin_) }, - { "math:arctan", Value(Mathematics::atan_) }, - { "math:cosh", Value(Mathematics::cosh_) }, - { "math:sinh", Value(Mathematics::sinh_) }, - { "math:tanh", Value(Mathematics::tanh_) }, - { "math:acosh", Value(Mathematics::acosh_) }, - { "math:asinh", Value(Mathematics::asinh_) }, - { "math:atanh", Value(Mathematics::atanh_) }, + { "builtin__math:exp", Value(Mathematics::exponential) }, + { "builtin__math:ln", Value(Mathematics::logarithm) }, + { "builtin__math:ceil", Value(Mathematics::ceil_) }, + { "builtin__math:floor", Value(Mathematics::floor_) }, + { "builtin__math:round", Value(Mathematics::round_) }, + { "builtin__math:NaN?", Value(Mathematics::isnan_) }, + { "builtin__math:Inf?", Value(Mathematics::isinf_) }, + { "builtin__math:pi", Mathematics::pi_ }, + { "builtin__math:e", Mathematics::e_ }, + { "builtin__math:tau", Mathematics::tau_ }, + { "builtin__math:Inf", Mathematics::inf_ }, + { "builtin__math:NaN", Mathematics::nan_ }, + { "builtin__math:cos", Value(Mathematics::cos_) }, + { "builtin__math:sin", Value(Mathematics::sin_) }, + { "builtin__math:tan", Value(Mathematics::tan_) }, + { "builtin__math:arccos", Value(Mathematics::acos_) }, + { "builtin__math:arcsin", Value(Mathematics::asin_) }, + { "builtin__math:arctan", Value(Mathematics::atan_) }, + { "builtin__math:cosh", Value(Mathematics::cosh_) }, + { "builtin__math:sinh", Value(Mathematics::sinh_) }, + { "builtin__math:tanh", Value(Mathematics::tanh_) }, + { "builtin__math:acosh", Value(Mathematics::acosh_) }, + { "builtin__math:asinh", Value(Mathematics::asinh_) }, + { "builtin__math:atanh", Value(Mathematics::atanh_) }, { "random", Value(Mathematics::random) }, // Async diff --git a/src/arkreactor/Builtins/IO.cpp b/src/arkreactor/Builtins/IO.cpp index 4469cfc04..ebd664291 100644 --- a/src/arkreactor/Builtins/IO.cpp +++ b/src/arkreactor/Builtins/IO.cpp @@ -74,16 +74,6 @@ namespace Ark::internal::Builtins::IO return Value(line); } - /** - * @name io:writeFile - * @brief Write content to a file. Return nil - * @param filename path to the file to write to (will be overwritten if it exists) - * @param content can be any valid ArkScript value - * =begin - * (io:writeFile "hello.json" "{\"key\": 12}") - * =end - * @author https://github.com/SuperFola - */ Value writeFile(std::vector& n, VM* vm) { if (types::check(n, ValueType::String, ValueType::Any)) @@ -106,16 +96,6 @@ namespace Ark::internal::Builtins::IO return nil; } - /** - * @name io:appendToFile - * @brief Append content to a file. Return nil - * @param filename path to the file to append to - * @param content can be any valid ArkScript value - * =begin - * (io:writeFile "hello.json" "{\"key\": 12}") - * =end - * @author https://github.com/SuperFola - */ Value appendToFile(std::vector& n, VM* vm) { if (types::check(n, ValueType::String, ValueType::Any)) @@ -138,15 +118,6 @@ namespace Ark::internal::Builtins::IO return nil; } - /** - * @name io:readFile - * @brief Read the content from a file as a String - * @param filename the path of the file to read - * =begin - * (io:readFile "hello.json") - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value readFile(std::vector& n, VM* vm [[maybe_unused]]) { @@ -164,15 +135,6 @@ namespace Ark::internal::Builtins::IO return Value(Utils::readFile(filename)); } - /** - * @name io:fileExists? - * @brief Check if a file exists, return True or False - * @param filename the path of the file - * =begin - * (io:fileExists? "hello.json") - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value fileExists(std::vector& n, VM* vm [[maybe_unused]]) { @@ -185,15 +147,6 @@ namespace Ark::internal::Builtins::IO return Utils::fileExists(n[0].string()) ? trueSym : falseSym; } - /** - * @name io:listFiles - * @brief List files in a folder, as a List of String - * @param path A directory - * =begin - * (io:listFiles "/tmp/hello") - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value listFiles(std::vector& n, VM* vm [[maybe_unused]]) { @@ -212,15 +165,6 @@ namespace Ark::internal::Builtins::IO return Value(std::move(r)); } - /** - * @name io:dir? - * @brief Check if a path represents a directory - * @param path A directory - * =begin - * (io:dir? "/tmp/hello") - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value isDirectory(std::vector& n, VM* vm [[maybe_unused]]) { @@ -233,15 +177,6 @@ namespace Ark::internal::Builtins::IO return (std::filesystem::is_directory(std::filesystem::path(n[0].string()))) ? trueSym : falseSym; } - /** - * @name io:makeDir - * @brief Create a directory - * @param path A directory - * =begin - * (io:makeDir "/tmp/myDir") - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value makeDir(std::vector& n, VM* vm [[maybe_unused]]) { @@ -255,36 +190,16 @@ namespace Ark::internal::Builtins::IO return nil; } - /** - * @name io:removeFiles - * @brief Delete files - * @details Take multiple arguments, all String, each one representing a path to a file - * @param filenames path to file - * =begin - * (io:removeFiles "/tmp/test.ark" "hello.json") - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference - Value removeFiles(std::vector& n, VM* vm [[maybe_unused]]) + Value removeFile(std::vector& n, VM* vm [[maybe_unused]]) { - if (n.empty() || n[0].valueType() != ValueType::String) + if (!types::check(n, ValueType::String)) throw types::TypeCheckingError( - "io:removeFiles", - { { types::Contract { { types::Typedef("filename", ValueType::String, /* is_variadic= */ true) } } } }, + "io:removeFile", + { { types::Contract { { types::Typedef("filename", ValueType::String) } } } }, n); - for (auto it = n.begin(), it_end = n.end(); it != it_end; ++it) - { - if (it->valueType() != ValueType::String) - throw types::TypeCheckingError( - "io:removeFiles", - { { types::Contract { { types::Typedef("filename", ValueType::String), types::Typedef("filenames", ValueType::String, /* variadic */ true) } } } }, - n); - - std::filesystem::remove_all(std::filesystem::path(it->string())); - } - + std::filesystem::remove_all(std::filesystem::path(n[0].string())); return nil; } } diff --git a/src/arkreactor/Builtins/List.cpp b/src/arkreactor/Builtins/List.cpp index 2c2ddc032..36e232af0 100644 --- a/src/arkreactor/Builtins/List.cpp +++ b/src/arkreactor/Builtins/List.cpp @@ -9,16 +9,6 @@ namespace Ark::internal::Builtins::List { - /** - * @name list:reverse - * @brief Reverse a given list and return a new one - * @details The original list is not modified - * @param list the list to reverse - * =begin - * (list:reverse [1 2 3]) # [3 2 1] - * =end - * @author https://github.com/SuperFola - */ Value reverseList(std::vector& n, VM* vm [[maybe_unused]]) { if (!types::check(n, ValueType::List)) @@ -31,18 +21,6 @@ namespace Ark::internal::Builtins::List return n[0]; } - /** - * @name list:find - * @brief Search an element in a List - * @details The original list is not modified - * @param list the List to search in - * @param value the element to search - * =begin - * (list:find [1 2 3] 1) # 0 - * (list:find [1 2 3] 0) # -1 - * =end - * @author https://github.com/SuperFola - */ Value findInList(std::vector& n, VM* vm [[maybe_unused]]) { if (!types::check(n, ValueType::List, ValueType::Any)) @@ -56,19 +34,6 @@ namespace Ark::internal::Builtins::List return Value(-1); } - /** - * @name list:slice - * @brief Get a slice from a List - * @details The original list is not modified - * @param list the list to reverse - * @param start included, must be positive - * @param end not included, must be positive and smaller than the list - * @param step must be greater than 0 - * =begin - * (list:slice [1 2 3 4 5] 1 4 2) # [2 4] - * =end - * @author https://github.com/SuperFola - */ Value sliceList(std::vector& n, VM* vm [[maybe_unused]]) { if (!types::check(n, ValueType::List, ValueType::Number, ValueType::Number, ValueType::Number)) @@ -101,16 +66,6 @@ namespace Ark::internal::Builtins::List return Value(std::move(list)); } - /** - * @name list:sort - * @brief Sort a List and return a new one - * @details The original list is not modified - * @param list the list to sort - * =begin - * (list:sort [4 2 3]) # [1 2 4] - * =end - * @author https://github.com/SuperFola - */ Value sort_(std::vector& n, VM* vm [[maybe_unused]]) { if (!types::check(n, ValueType::List)) @@ -123,16 +78,6 @@ namespace Ark::internal::Builtins::List return n[0]; } - /** - * @name list:fill - * @brief Generate a List of n copies of an element - * @param count the number of copies - * @param value the element to copy - * =begin - * (list:fill 4 nil) # [nil nil nil nil] - * =end - * @author https://github.com/SuperFola - */ Value fill(std::vector& n, VM* vm [[maybe_unused]]) { if (!types::check(n, ValueType::Number, ValueType::Any)) @@ -150,18 +95,6 @@ namespace Ark::internal::Builtins::List return Value(std::move(l)); } - /** - * @name list:setAt - * @brief Modify a given list and return a new one - * @details The original list is not modified - * @param list the list to modify - * @param index the index of the element to modify - * @param value the new element - * =begin - * (list:setAt [1 2 3] 0 5) # [5 2 3] - * =end - * @author https://github.com/SuperFola - */ Value setListAt(std::vector& n, VM* vm [[maybe_unused]]) { if (!types::check(n, ValueType::List, ValueType::Number, ValueType::Any)) diff --git a/src/arkreactor/Builtins/Mathematics.cpp b/src/arkreactor/Builtins/Mathematics.cpp index ca291d05c..0d752843f 100644 --- a/src/arkreactor/Builtins/Mathematics.cpp +++ b/src/arkreactor/Builtins/Mathematics.cpp @@ -10,15 +10,6 @@ namespace Ark::internal::Builtins::Mathematics { - /** - * @name math:exp - * @brief Calculate e^number - * @param value the Number - * =begin - * (math:exp 1) # 2.7182... - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value exponential(std::vector& n, VM* vm [[maybe_unused]]) { @@ -31,15 +22,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::exp(n[0].number())); } - /** - * @name math:ln - * @brief Calculate the logarithm of a number - * @param value the Number - * =begin - * (math:ln 1) # 0 - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value logarithm(std::vector& n, VM* vm [[maybe_unused]]) { @@ -55,15 +37,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::log(n[0].number())); } - /** - * @name math:ceil - * @brief Get the smallest possible integer greater than the number - * @param value the Number - * =begin - * (math:ceil 0.2) # 1 - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value ceil_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -76,15 +49,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::ceil(n[0].number())); } - /** - * @name math:floor - * @brief Get the smallest possible integer equal to the given number - * @param value the Number - * =begin - * (math:floor 1.7) # 1 - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value floor_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -97,16 +61,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::floor(n[0].number())); } - /** - * @name math:round - * @brief Get the smallest possible integer equal to or greater than the given number - * @param value the Number - * =begin - * (math:round 0.2) # 0 - * (math:round 0.6) # 1 - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value round_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -119,16 +73,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::round(n[0].number())); } - /** - * @name math:NaN? - * @brief Check if a Number is NaN - * @param value the Number - * =begin - * (math:NaN? 2) # false - * (math:NaN? nan) # true - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value isnan_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -138,16 +82,6 @@ namespace Ark::internal::Builtins::Mathematics return std::isnan(n[0].number()) ? trueSym : falseSym; } - /** - * @name math:Inf? - * @brief Check if a Number if Inf - * @param value the Number - * =begin - * (math:Inf? 1) # false - * (math:Inf? nan) # false - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value isinf_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -157,16 +91,6 @@ namespace Ark::internal::Builtins::Mathematics return std::isinf(n[0].number()) ? trueSym : falseSym; } - /** - * @name math:cos - * @brief Calculate the cosinus of a number - * @param value the Number (radians) - * =begin - * (math:cos 0) # 1 - * (math:cos math:pi) # -1 - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value cos_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -179,16 +103,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::cos(n[0].number())); } - /** - * @name math:sin - * @brief Calculate the sinus of a number - * @param value the Number (radians) - * =begin - * (math:sin 0) # 0 - * (math:cos (/ math:pi 2)) # 1 - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value sin_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -201,16 +115,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::sin(n[0].number())); } - /** - * @name math:tan - * @brief Calculate the tangent of a number - * @param value the Number (radians) - * =begin - * (math:tan 0) # 0 - * (math:cos (/ math:pi 4)) # 1 - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value tan_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -223,15 +127,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::tan(n[0].number())); } - /** - * @name math:arccos - * @brief Calculate the arc cosinus of a number - * @param value the Number - * =begin - * (math:arccos 1) # 0 - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value acos_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -244,15 +139,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::acos(n[0].number())); } - /** - * @name math:arcsin - * @brief Calculate the arc sinus of a number - * @param value the Number - * =begin - * (math:arcsin 1) # 1.570796326794897 (/ math:pi 2) - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value asin_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -265,15 +151,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::asin(n[0].number())); } - /** - * @name math:arctan - * @brief Calculate the arc tangent of a number - * @param value the Number - * =begin - * (math:arctan 0) # 0 - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value atan_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -286,12 +163,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::atan(n[0].number())); } - /** - * @name math:cosh - * @brief Calculate the hyperbolic cosinus of a number - * @param value the Number - * @author https://github.com/Gryfenfer97 - */ // cppcheck-suppress constParameterReference Value cosh_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -304,12 +175,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::cosh(n[0].number())); } - /** - * @name math:sinh - * @brief Calculate the hyperbolic sinus of a number - * @param value the Number - * @author https://github.com/Gryfenfer97 - */ // cppcheck-suppress constParameterReference Value sinh_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -322,12 +187,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::sinh(n[0].number())); } - /** - * @name math:tanh - * @brief Calculate the hyperbolic tangent of a number - * @param value the Number - * @author https://github.com/Gryfenfer97 - */ // cppcheck-suppress constParameterReference Value tanh_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -340,12 +199,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::tanh(n[0].number())); } - /** - * @name math:acosh - * @brief Calculate the hyperbolic arc cosinus of a number - * @param value the Number - * @author https://github.com/Gryfenfer97 - */ // cppcheck-suppress constParameterReference Value acosh_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -358,12 +211,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::acosh(n[0].number())); } - /** - * @name math:asinh - * @brief Calculate the hyperbolic arc sinus of a number - * @param value the Number - * @author https://github.com/Gryfenfer97 - */ // cppcheck-suppress constParameterReference Value asinh_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -376,12 +223,6 @@ namespace Ark::internal::Builtins::Mathematics return Value(std::asinh(n[0].number())); } - /** - * @name math:atanh - * @brief Calculate the hyperbolic arc tangent of a number - * @param value the Number - * @author https://github.com/Gryfenfer97 - */ // cppcheck-suppress constParameterReference Value atanh_(std::vector& n, VM* vm [[maybe_unused]]) { diff --git a/src/arkreactor/Builtins/String.cpp b/src/arkreactor/Builtins/String.cpp index e87eaa5f9..94ff86a48 100644 --- a/src/arkreactor/Builtins/String.cpp +++ b/src/arkreactor/Builtins/String.cpp @@ -12,16 +12,16 @@ namespace Ark::internal::Builtins::String { /** - * @name string:format + * @name format * @brief Format a String given replacements * @details https://fmt.dev/latest/syntax.html * @param format the String to format * @param values as any argument as you need, of any valid ArkScript type * =begin - * (string:format "Hello {}, my name is {}" "world" "ArkScript") + * (format "Hello {}, my name is {}" "world" "ArkScript") * # Hello world, my name is ArkScript * - * (string:format "Test {} with {{}}" "1") + * (format "Test {} with {{}}" "1") * # Test 1 with {} * =end * @author https://github.com/SuperFola @@ -30,7 +30,7 @@ namespace Ark::internal::Builtins::String { if (n.size() < 2 || n[0].valueType() != ValueType::String) throw types::TypeCheckingError( - "string:format", + "format", { { types::Contract { { types::Typedef("string", ValueType::String), types::Typedef("value", ValueType::Any, /* variadic */ true) } } } }, n); @@ -60,7 +60,7 @@ namespace Ark::internal::Builtins::String catch (fmt::format_error& e) { throw std::runtime_error( - fmt::format("string:format: can not format \"{}\" ({} argument{} provided) because of {}", + fmt::format("format: can not format \"{}\" ({} argument{} provided) because of {}", n[0].stringRef(), n.size() - 1, // if we have more than one argument (not counting the string to format), plural form @@ -69,19 +69,6 @@ namespace Ark::internal::Builtins::String } } - /** - * @name string:find - * @brief Search a substring in a given String - * @details The original String is not modified. Return -1 when not found - * @param string the String to search in - * @param substr the substring to search for - * @param (optional) startIndex index to start searching from - * =begin - * (string:find "hello world" "hello") # 0 - * (string:find "hello world" "aworld") # -1 - * =end - * @author https://github.com/SuperFola - */ Value findSubStr(std::vector& n, VM* vm [[maybe_unused]]) { if (!types::check(n, ValueType::String, ValueType::String) && @@ -104,18 +91,6 @@ namespace Ark::internal::Builtins::String return Value(-1); } - /** - * @name string:removeAt - * @brief Remove a character from a String given an index - * @details The original String is not modified - * @param string the String to modify - * @param index the index of the character to remove (can be negative to search from the end) - * =begin - * (string:removeAt "hello world" 0) # "ello world" - * (string:removeAt "hello world" -1) # "hello worl" - * =end - * @author https://github.com/SuperFola - */ Value removeAtStr(std::vector& n, VM* vm [[maybe_unused]]) { if (!types::check(n, ValueType::String, ValueType::Number)) @@ -132,16 +107,6 @@ namespace Ark::internal::Builtins::String return n[0]; } - /** - * @name string:ord - * @brief Get the ordinal of a given character - * @param char a String with a single UTF8 character - * =begin - * (string:ord "h") # 104 - * (string:ord "Ô") # 212 - * =end - * @author https://github.com/SuperFola - */ Value ord(std::vector& n, VM* vm [[maybe_unused]]) { if (!types::check(n, ValueType::String)) @@ -153,16 +118,6 @@ namespace Ark::internal::Builtins::String return Value(utf8::codepoint(n[0].stringRef().c_str())); } - /** - * @name string:chr - * @brief Create a character from an UTF8 codepoint - * @param codepoint an UTF8 codepoint (Number) - * =begin - * (string:chr 104) # "h" - * (string:chr 212) # "Ô" - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value chr(std::vector& n, VM* vm [[maybe_unused]]) { @@ -177,18 +132,6 @@ namespace Ark::internal::Builtins::String return Value(std::string(utf8.data())); } - /** - * @name string:setAt - * @brief Modify a given string and return a new one - * @details The original string is not modified - * @param string the string to modify - * @param index the index of the element to modify - * @param value the new character - * =begin - * (string:setAt "hello" 1 "a") # "hallo" - * =end - * @author https://github.com/SuperFola - */ Value setStringAt(std::vector& n, VM* vm [[maybe_unused]]) { if (!types::check(n, ValueType::String, ValueType::Number, ValueType::String)) diff --git a/src/arkreactor/Builtins/System.cpp b/src/arkreactor/Builtins/System.cpp index c0f991747..58749e777 100644 --- a/src/arkreactor/Builtins/System.cpp +++ b/src/arkreactor/Builtins/System.cpp @@ -30,16 +30,6 @@ namespace Ark::internal::Builtins::System }; } - /** - * @name sys:exec - * @brief Execute a system specific command - * @details Return the output of the command as a String, or nil if it was disabled in the ArkScript build - * @param command the command to execute, as a String - * =begin - * (sys:exec "echo hello") - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value system_(std::vector& n, VM* vm [[maybe_unused]]) { @@ -63,16 +53,6 @@ namespace Ark::internal::Builtins::System #endif // ARK_ENABLE_SYSTEM } - /** - * @name sys:sleep - * @brief Sleep for a given duration (in milliseconds) - * @details Return nil - * @param duration a Number representing a duration - * =begin - * (sys:sleep 1000) # sleep for 1 second - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value sleep(std::vector& n, VM* vm [[maybe_unused]]) { @@ -88,16 +68,6 @@ namespace Ark::internal::Builtins::System return nil; } - /** - * @name sys:exit - * @brief Reverse a given list and return a new one - * @details Any code after this function call won't be executed - * @param exitCode usually 0 for success and 1 for errors - * =begin - * (sys:exit 0) # halt the virtual machine with given exit code (success) - * =end - * @author https://github.com/SuperFola - */ // cppcheck-suppress constParameterReference Value exit_(std::vector& n, VM* vm) { diff --git a/src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp b/src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp index 7e9a15e79..4e2c7947b 100644 --- a/src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp +++ b/src/arkreactor/Compiler/IntermediateRepresentation/IROptimizer.cpp @@ -20,10 +20,27 @@ namespace Ark::internal Rule { { LOAD_SYMBOL_BY_INDEX, STORE }, STORE_FROM_INDEX }, Rule { { LOAD_SYMBOL, SET_VAL }, SET_VAL_FROM }, Rule { { LOAD_SYMBOL_BY_INDEX, SET_VAL }, SET_VAL_FROM_INDEX }, - Rule { - { BUILTIN, CALL }, CALL_BUILTIN, [](const Entities entities) { - return Builtins::builtins[entities[0].primaryArg()].second.isFunction(); - } }, + Rule { { STORE, PUSH_RETURN_ADDRESS, LOAD_SYMBOL_BY_INDEX, BUILTIN, CALL }, [](const Entities entities) { + return Builtins::builtins[entities[3].primaryArg()].second.isFunction(); + }, + [](const Entities e) { + return IR::Entity(CALL_BUILTIN_WITHOUT_RETURN_ADDRESS, e[3].primaryArg(), 1); + } }, + Rule { { STORE, STORE, PUSH_RETURN_ADDRESS, LOAD_SYMBOL_BY_INDEX, LOAD_SYMBOL_BY_INDEX, BUILTIN, CALL }, [](const Entities entities) { + return Builtins::builtins[entities[5].primaryArg()].second.isFunction(); + }, + [](const Entities e) { + return IR::Entity(CALL_BUILTIN_WITHOUT_RETURN_ADDRESS, e[5].primaryArg(), 2); + } }, + Rule { { STORE, STORE, STORE, PUSH_RETURN_ADDRESS, LOAD_SYMBOL_BY_INDEX, LOAD_SYMBOL_BY_INDEX, LOAD_SYMBOL_BY_INDEX, BUILTIN, CALL }, [](const Entities entities) { + return Builtins::builtins[entities[7].primaryArg()].second.isFunction(); + }, + [](const Entities e) { + return IR::Entity(CALL_BUILTIN_WITHOUT_RETURN_ADDRESS, e[7].primaryArg(), 3); + } }, + Rule { { BUILTIN, CALL }, CALL_BUILTIN, [](const Entities entities) { + return Builtins::builtins[entities[0].primaryArg()].second.isFunction(); + } }, Rule { { LOAD_SYMBOL, CALL }, CALL_SYMBOL }, Rule { { LOAD_SYMBOL, GET_FIELD }, GET_FIELD_FROM_SYMBOL }, Rule { { LOAD_SYMBOL_BY_INDEX, GET_FIELD }, GET_FIELD_FROM_SYMBOL_INDEX }, diff --git a/src/arkreactor/VM/State.cpp b/src/arkreactor/VM/State.cpp index b394d861b..59cc53d26 100644 --- a/src/arkreactor/VM/State.cpp +++ b/src/arkreactor/VM/State.cpp @@ -20,7 +20,11 @@ namespace Ark m_debug_level(0), m_libenv(libenv), m_filename(ARK_NO_NAME_FILE) - {} + { + // default value for builtin__sys:args is empty list + const Value val(ValueType::List); + m_binded[std::string(internal::Language::SysArgs)] = val; + } bool State::feed(const std::string& bytecode_filename) { @@ -126,7 +130,6 @@ namespace Ark }); m_binded[std::string(internal::Language::SysArgs)] = val; - m_binded[std::string(internal::Language::SysPlatform)] = Value(ARK_PLATFORM_NAME); } void State::setDebug(const unsigned level) noexcept @@ -186,6 +189,10 @@ namespace Ark m_inst_locations.clear(); m_pages.clear(); m_binded.clear(); + + // default value for builtin__sys:args is empty list + const Value val(ValueType::List); + m_binded[std::string(internal::Language::SysArgs)] = val; } } diff --git a/src/arkreactor/VM/VM.cpp b/src/arkreactor/VM/VM.cpp index d09a31ba7..11b7d5f57 100644 --- a/src/arkreactor/VM/VM.cpp +++ b/src/arkreactor/VM/VM.cpp @@ -567,6 +567,7 @@ namespace Ark &&TARGET_SET_VAL_HEAD, &&TARGET_SET_VAL_HEAD_BY_INDEX, &&TARGET_CALL_BUILTIN, + &&TARGET_CALL_BUILTIN_WITHOUT_RETURN_ADDRESS, &&TARGET_LT_CONST_JUMP_IF_FALSE, &&TARGET_LT_CONST_JUMP_IF_TRUE, &&TARGET_LT_SYM_JUMP_IF_FALSE, @@ -1651,6 +1652,16 @@ namespace Ark DISPATCH(); } + TARGET(CALL_BUILTIN_WITHOUT_RETURN_ADDRESS) + { + UNPACK_ARGS(); + // no stack size check because we do not push IP/PP since we are just calling a builtin + callBuiltin(context, Builtins::builtins[primary_arg].second, secondary_arg, /* remove_return_address= */ false); + if (!m_running) + GOTO_HALT(); + DISPATCH(); + } + TARGET(LT_CONST_JUMP_IF_FALSE) { UNPACK_ARGS(); @@ -1896,6 +1907,13 @@ namespace Ark arg_names.push_back(m_state.m_symbols[id]); index += 4; } + // we only the blank space for formatting and no arg names, probably because of a CALL_BUILTIN_WITHOUT_RETURN_ADDRESS + if (arg_names.size() == 1 && index == 0) + { + assert(m_state.m_pages[context.pp][0] == CALL_BUILTIN_WITHOUT_RETURN_ADDRESS && "expected a CALL_BUILTIN_WITHOUT_RETURN_ADDRESS instruction or STORE instructions"); + for (std::size_t i = 0; i < expected_arg_count; ++i) + arg_names.push_back(std::string(1, static_cast('a' + i))); + } std::vector arg_vals; arg_vals.reserve(passed_arg_count + 1); diff --git a/tests/benchmarks/resources/runtime/builtins.ark b/tests/benchmarks/resources/runtime/builtins.ark index df0e0b98a..b90acdb55 100644 --- a/tests/benchmarks/resources/runtime/builtins.ark +++ b/tests/benchmarks/resources/runtime/builtins.ark @@ -2,9 +2,9 @@ (mut i 0) (while (< i 1000) { - (list:slice in 1 4 2) - (math:exp 5) - (math:ln 6) - (list:sort in) + (builtin__list:slice in 1 4 2) + (builtin__math:exp 5) + (builtin__math:ln 6) + (builtin__list:sort in) (set i (+ i 1)) }) diff --git a/tests/fuzzing/arkscript.dict b/tests/fuzzing/arkscript.dict index 85366c6af..d2ae9a84f 100644 --- a/tests/fuzzing/arkscript.dict +++ b/tests/fuzzing/arkscript.dict @@ -33,11 +33,11 @@ "true" "false" "nil" -"math:pi" -"math:e" -"math:tau" -"math:Inf" -"math:NaN" +"builtin__math:pi" +"builtin__math:e" +"builtin__math:tau" +"builtin__math:Inf" +"builtin__math:NaN" "append" "concat" "list" @@ -45,40 +45,40 @@ "concat!" "pop" "pop!" -"list:reverse" -"list:find" -"list:slice" -"list:sort" -"list:fill" -"list:setAt" +"builtin__list:reverse" +"builtin__list:find" +"builtin__list:slice" +"builtin__list:sort" +"builtin__list:fill" +"builtin__list:setAt" "print" "puts" "input" -"io:writeFile" -"io:appendToFile" -"io:readFile" -"io:fileExists?" -"io:listFiles" -"io:dir?" -"io:makeDir" -"io:removeFiles" +"builtin__io:writeFile" +"builtin__io:appendToFile" +"builtin__io:readFile" +"builtin__io:fileExists?" +"builtin__io:listFiles" +"builtin__io:dir?" +"builtin__io:makeDir" +"builtin__io:removeFile" "time" -"sys:exec" -"sys:sleep" -"string:format" -"string:find" -"string:removeAt" -"math:exp" -"math:ln" -"math:ceil" -"math:floor" -"math:round" -"math:NaN?" -"math:Inf?" -"math:cos" -"math:sin" -"math:tan" -"math:arccos" -"math:arcsin" -"math:arctan" +"builtin__sys:exec" +"builtin__sys:sleep" +"format" +"builtin__string:find" +"builtin__string:removeAt" +"builtin__math:exp" +"builtin__math:ln" +"builtin__math:ceil" +"builtin__math:floor" +"builtin__math:round" +"builtin__math:NaN?" +"builtin__math:Inf?" +"builtin__math:cos" +"builtin__math:sin" +"builtin__math:tan" +"builtin__math:arccos" +"builtin__math:arcsin" +"builtin__math:arctan" "random" diff --git a/tests/unittests/Suites/CompilerSuite.cpp b/tests/unittests/Suites/CompilerSuite.cpp index c4380fb25..ed96b9fbd 100644 --- a/tests/unittests/Suites/CompilerSuite.cpp +++ b/tests/unittests/Suites/CompilerSuite.cpp @@ -106,12 +106,12 @@ ut::suite<"Compiler"> compiler_suite = [] { [](TestData&& data) { Ark::Welder welder(0, { lib_path }, features); - should("compile without error ir/" + data.stem) = [&] { + should("compile without error optimized_ir/" + data.stem) = [&] { expect(mut(welder).computeASTFromFile(data.path)); expect(mut(welder).generateBytecode()); }; - should("output expected IR for " + data.stem) = [&] { + should("output expected optimized IR for " + data.stem) = [&] { std::string ir = welder.textualIR(); ltrim(rtrim(ir)); diff --git a/tests/unittests/Suites/EmbeddingSuite.cpp b/tests/unittests/Suites/EmbeddingSuite.cpp index 0a277b5a7..ee4e1ff90 100644 --- a/tests/unittests/Suites/EmbeddingSuite.cpp +++ b/tests/unittests/Suites/EmbeddingSuite.cpp @@ -147,6 +147,52 @@ ut::suite<"Embedding"> embedding_suite = [] { }; }; + "[retrieve sys:args in embedded code]"_test = [] { + Ark::State state({ ARK_TESTS_ROOT "lib" }); + + should("compile the string without any error") = [&] { + expect(mut(state).doString("(import std.Sys) (let foo sys:args) (let b foo)")); + }; + + Ark::VM vm(state); + double timestamp = 0.0; + should("return exit code 0") = [&] { + expect(mut(vm).run() == 0_i); + timestamp = vm["t"].number(); + }; + + should("have symbol foo registered") = [&] { + const auto foo = mut(vm)["foo"]; + expect(foo.valueType() == Ark::ValueType::List); + expect(foo.constList().size() == 0_z); + }; + }; + + "[set and retrieve sys:args in embedded code]"_test = [] { + Ark::State state({ ARK_TESTS_ROOT "lib" }); + state.setArgs({ "foo", "bar", "--eggs" }); + + should("compile the string without any error") = [&] { + expect(mut(state).doString("(import std.Sys) (let foo sys:args) (let b foo)")); + }; + + Ark::VM vm(state); + double timestamp = 0.0; + should("return exit code 0") = [&] { + expect(mut(vm).run() == 0_i); + timestamp = vm["t"].number(); + }; + + should("have symbol foo registered") = [&] { + const auto foo = mut(vm)["foo"]; + expect(foo.valueType() == Ark::ValueType::List); + expect(foo.constList().size() == 3_z); + expect(foo.constList()[0].string() == "foo"); + expect(foo.constList()[1].string() == "bar"); + expect(foo.constList()[2].string() == "--eggs"); + }; + }; + "[load usertype and cpp lambdas and call them from arkscript]"_test = [] { Ark::State state; state.loadFunction("getBreakfast", [](std::vector& n [[maybe_unused]], Ark::VM* vm [[maybe_unused]]) -> Ark::Value { diff --git a/tests/unittests/resources/ASTSuite/99bottles.ark b/tests/unittests/resources/ASTSuite/99bottles.ark index a4482659b..7755d3ce7 100644 --- a/tests/unittests/resources/ASTSuite/99bottles.ark +++ b/tests/unittests/resources/ASTSuite/99bottles.ark @@ -10,12 +10,13 @@ # Take one down, pass it around # 97 bottles of beer on the wall +(import std.Sys) (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)) + (print (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 (format "{} Bottles of beer on the wall." n))}) diff --git a/tests/unittests/resources/ASTSuite/99bottles.json b/tests/unittests/resources/ASTSuite/99bottles.json index f5610bf53..cfb1a0e1e 100644 --- a/tests/unittests/resources/ASTSuite/99bottles.json +++ b/tests/unittests/resources/ASTSuite/99bottles.json @@ -1,3 +1,3 @@ -{"type": "Begin", "children": [{"type": "Let", "name": {"type": "Symbol", "name": "arg"}, "value": {"type": "If", "condition": {"type": "FunctionCall", "name": {"type": "Symbol", "name": ">="}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "len"}, "args": [{"type": "Symbol", "name": "sys:args"}]}, {"type": "Number", "value": 1}]}, "then": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "toNumber"}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "@"}, "args": [{"type": "Symbol", "name": "sys:args"}, {"type": "Number", "value": 0}]}]}, "else": {"type": "Symbol", "name": "nil"}}}, {"type": "Let", "name": {"type": "Symbol", "name": "i"}, "value": {"type": "If", "condition": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "nil?"}, "args": [{"type": "Symbol", "name": "arg"}]}, "then": {"type": "Number", "value": 100}, "else": {"type": "Symbol", "name": "arg"}}}, {"type": "Mut", "name": {"type": "Symbol", "name": "n"}, "value": {"type": "Symbol", "name": "i"}}, {"type": "While", "condition": {"type": "FunctionCall", "name": {"type": "Symbol", "name": ">"}, "args": [{"type": "Symbol", "name": "n"}, {"type": "Number", "value": 1}]}, "body": {"type": "Begin", "children": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "print"}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "string:format"}, "args": [{"type": "String", "value": "{} Bottles of beer on the wall +{"type": "Begin", "children": [{"type": "Import", "package": "std.Sys", "glob": false, "symbols": []}, {"type": "Let", "name": {"type": "Symbol", "name": "arg"}, "value": {"type": "If", "condition": {"type": "FunctionCall", "name": {"type": "Symbol", "name": ">="}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "len"}, "args": [{"type": "Symbol", "name": "sys:args"}]}, {"type": "Number", "value": 1}]}, "then": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "toNumber"}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "@"}, "args": [{"type": "Symbol", "name": "sys:args"}, {"type": "Number", "value": 0}]}]}, "else": {"type": "Symbol", "name": "nil"}}}, {"type": "Let", "name": {"type": "Symbol", "name": "i"}, "value": {"type": "If", "condition": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "nil?"}, "args": [{"type": "Symbol", "name": "arg"}]}, "then": {"type": "Number", "value": 100}, "else": {"type": "Symbol", "name": "arg"}}}, {"type": "Mut", "name": {"type": "Symbol", "name": "n"}, "value": {"type": "Symbol", "name": "i"}}, {"type": "While", "condition": {"type": "FunctionCall", "name": {"type": "Symbol", "name": ">"}, "args": [{"type": "Symbol", "name": "n"}, {"type": "Number", "value": 1}]}, "body": {"type": "Begin", "children": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "print"}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "format"}, "args": [{"type": "String", "value": "{} Bottles of beer on the wall {} bottles of beer -Take one down, pass it around"}, {"type": "Symbol", "name": "n"}, {"type": "Symbol", "name": "n"}]}]}, {"type": "Set", "name": {"type": "Symbol", "name": "n"}, "value": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "-"}, "args": [{"type": "Symbol", "name": "n"}, {"type": "Number", "value": 1}]}}, {"type": "FunctionCall", "name": {"type": "Symbol", "name": "print"}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "string:format"}, "args": [{"type": "String", "value": "{} Bottles of beer on the wall."}, {"type": "Symbol", "name": "n"}]}]}]}}]} +Take one down, pass it around"}, {"type": "Symbol", "name": "n"}, {"type": "Symbol", "name": "n"}]}]}, {"type": "Set", "name": {"type": "Symbol", "name": "n"}, "value": {"type": "FunctionCall", "name": {"type": "Symbol", "name": "-"}, "args": [{"type": "Symbol", "name": "n"}, {"type": "Number", "value": 1}]}}, {"type": "FunctionCall", "name": {"type": "Symbol", "name": "print"}, "args": [{"type": "FunctionCall", "name": {"type": "Symbol", "name": "format"}, "args": [{"type": "String", "value": "{} Bottles of beer on the wall."}, {"type": "Symbol", "name": "n"}]}]}]}}]} diff --git a/tests/unittests/resources/CompilerSuite/ir/99bottles.ark b/tests/unittests/resources/CompilerSuite/ir/99bottles.ark index a4482659b..7755d3ce7 100644 --- a/tests/unittests/resources/CompilerSuite/ir/99bottles.ark +++ b/tests/unittests/resources/CompilerSuite/ir/99bottles.ark @@ -10,12 +10,13 @@ # Take one down, pass it around # 97 bottles of beer on the wall +(import std.Sys) (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)) + (print (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 (format "{} Bottles of beer on the wall." n))}) diff --git a/tests/unittests/resources/CompilerSuite/ir/99bottles.expected b/tests/unittests/resources/CompilerSuite/ir/99bottles.expected index 6d6296197..7d8fdf0dc 100644 --- a/tests/unittests/resources/CompilerSuite/ir/99bottles.expected +++ b/tests/unittests/resources/CompilerSuite/ir/99bottles.expected @@ -1,5 +1,7 @@ page_0 LOAD_SYMBOL 1 + STORE 0 + LOAD_SYMBOL_BY_INDEX 0 LEN 0 LOAD_CONST 0 GE 0 @@ -7,12 +9,12 @@ page_0 BUILTIN 2 JUMP L1 .L0: - LOAD_SYMBOL 1 + LOAD_SYMBOL_BY_INDEX 0 LOAD_CONST 1 AT 0 TO_NUM 0 .L1: - STORE 0 + STORE 2 LOAD_SYMBOL_BY_INDEX 0 ISNIL 0 POP_JUMP_IF_TRUE L2 @@ -21,36 +23,36 @@ page_0 .L2: LOAD_CONST 2 .L3: - STORE 2 - LOAD_SYMBOL_BY_INDEX 0 STORE 3 + LOAD_SYMBOL_BY_INDEX 0 + STORE 4 CREATE_SCOPE 0 .L4: - LOAD_SYMBOL 3 + LOAD_SYMBOL 4 LOAD_CONST 0 GT 0 POP_JUMP_IF_FALSE L5 PUSH_RETURN_ADDRESS L6 PUSH_RETURN_ADDRESS L7 - LOAD_SYMBOL 3 - LOAD_SYMBOL 3 + LOAD_SYMBOL 4 + LOAD_SYMBOL 4 LOAD_CONST 3 - BUILTIN 24 + BUILTIN 25 CALL 3 .L7: BUILTIN 9 CALL 1 .L6: POP 0 - LOAD_SYMBOL 3 + LOAD_SYMBOL 4 LOAD_CONST 0 SUB 0 - SET_VAL 3 + SET_VAL 4 PUSH_RETURN_ADDRESS L8 PUSH_RETURN_ADDRESS L9 - LOAD_SYMBOL 3 + LOAD_SYMBOL 4 LOAD_CONST 4 - BUILTIN 24 + BUILTIN 25 CALL 2 .L9: BUILTIN 9 diff --git a/tests/unittests/resources/CompilerSuite/optimized_ir/99bottles.ark b/tests/unittests/resources/CompilerSuite/optimized_ir/99bottles.ark index a4482659b..7755d3ce7 100644 --- a/tests/unittests/resources/CompilerSuite/optimized_ir/99bottles.ark +++ b/tests/unittests/resources/CompilerSuite/optimized_ir/99bottles.ark @@ -10,12 +10,13 @@ # Take one down, pass it around # 97 bottles of beer on the wall +(import std.Sys) (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)) + (print (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 (format "{} Bottles of beer on the wall." n))}) diff --git a/tests/unittests/resources/CompilerSuite/optimized_ir/99bottles.expected b/tests/unittests/resources/CompilerSuite/optimized_ir/99bottles.expected index 87a548db3..6bc425788 100644 --- a/tests/unittests/resources/CompilerSuite/optimized_ir/99bottles.expected +++ b/tests/unittests/resources/CompilerSuite/optimized_ir/99bottles.expected @@ -1,55 +1,78 @@ page_0 - LOAD_SYMBOL 1 + LOAD_CONST_STORE 0, 0 + LOAD_CONST_STORE 1, 2 + LOAD_CONST_STORE 2, 4 + BUILTIN 21 + STORE 6 + STORE_FROM 8, 7 + LOAD_SYMBOL_BY_INDEX 0 LEN 0 - LOAD_CONST 0 + LOAD_CONST 3 GE 0 - POP_JUMP_IF_TRUE L0 + POP_JUMP_IF_TRUE L3 BUILTIN 2 - JUMP L1 -.L0: - LOAD_SYMBOL 1 - LOAD_CONST 1 + JUMP L4 +.L3: + LOAD_SYMBOL_BY_INDEX 0 + LOAD_CONST 4 AT 0 TO_NUM 0 -.L1: - STORE 0 +.L4: + STORE 9 LOAD_SYMBOL_BY_INDEX 0 ISNIL 0 - POP_JUMP_IF_TRUE L2 + POP_JUMP_IF_TRUE L5 LOAD_SYMBOL_BY_INDEX 0 - JUMP L3 -.L2: - LOAD_CONST 2 -.L3: - STORE 2 - STORE_FROM_INDEX 0, 3 + JUMP L6 +.L5: + LOAD_CONST 5 +.L6: + STORE 10 + STORE_FROM_INDEX 0, 11 CREATE_SCOPE 0 -.L4: - LOAD_SYMBOL 3 - GT_CONST_JUMP_IF_FALSE L5, 0 - PUSH_RETURN_ADDRESS L6 - PUSH_RETURN_ADDRESS L7 - LOAD_SYMBOL 3 - LOAD_SYMBOL 3 - LOAD_CONST 3 - CALL_BUILTIN 24, 3 .L7: - CALL_BUILTIN 9, 1 -.L6: - POP 0 - DECREMENT 3, 1 - SET_VAL 3 - PUSH_RETURN_ADDRESS L8 + LOAD_SYMBOL 11 + GT_CONST_JUMP_IF_FALSE L8, 3 PUSH_RETURN_ADDRESS L9 - LOAD_SYMBOL 3 - LOAD_CONST 4 - CALL_BUILTIN 24, 2 + PUSH_RETURN_ADDRESS L10 + LOAD_SYMBOL 11 + LOAD_SYMBOL 11 + LOAD_CONST 6 + CALL_BUILTIN 25, 3 +.L10: + CALL_BUILTIN 9, 1 .L9: + POP 0 + DECREMENT 11, 1 + SET_VAL 11 + PUSH_RETURN_ADDRESS L11 + PUSH_RETURN_ADDRESS L12 + LOAD_SYMBOL 11 + LOAD_CONST 7 + CALL_BUILTIN 25, 2 +.L12: CALL_BUILTIN 9, 1 -.L8: +.L11: POP 0 - RESET_SCOPE_JUMP L4 -.L5: + RESET_SCOPE_JUMP L7 +.L8: POP_SCOPE 0 HALT 0 +page_1 + CALL_BUILTIN_WITHOUT_RETURN_ADDRESS 22, 1 +.L0: + RET 0 + HALT 0 + +page_2 + CALL_BUILTIN_WITHOUT_RETURN_ADDRESS 23, 1 +.L1: + RET 0 + HALT 0 + +page_3 + CALL_BUILTIN_WITHOUT_RETURN_ADDRESS 24, 1 +.L2: + RET 0 + HALT 0 diff --git a/tests/unittests/resources/CompilerSuite/optimized_ir/builtins.ark b/tests/unittests/resources/CompilerSuite/optimized_ir/builtins.ark new file mode 100644 index 000000000..2f2890fcb --- /dev/null +++ b/tests/unittests/resources/CompilerSuite/optimized_ir/builtins.ark @@ -0,0 +1,3 @@ +(let asinh (fun (_x) (builtin__math:asinh _x))) +(let find (fun (_L _x) (builtin__list:find _L _x))) +(let setAt (fun (_L _index _x) (builtin__list:setAt _L _index _x))) diff --git a/tests/unittests/resources/CompilerSuite/optimized_ir/builtins.expected b/tests/unittests/resources/CompilerSuite/optimized_ir/builtins.expected new file mode 100644 index 000000000..cc0932c95 --- /dev/null +++ b/tests/unittests/resources/CompilerSuite/optimized_ir/builtins.expected @@ -0,0 +1,23 @@ +page_0 + LOAD_CONST_STORE 0, 0 + LOAD_CONST_STORE 1, 2 + LOAD_CONST_STORE 2, 4 + HALT 0 + +page_1 + CALL_BUILTIN_WITHOUT_RETURN_ADDRESS 53, 1 +.L0: + RET 0 + HALT 0 + +page_2 + CALL_BUILTIN_WITHOUT_RETURN_ADDRESS 4, 2 +.L1: + RET 0 + HALT 0 + +page_3 + CALL_BUILTIN_WITHOUT_RETURN_ADDRESS 8, 3 +.L2: + RET 0 + HALT 0 diff --git a/tests/unittests/resources/DiagnosticsSuite/compileTime/name_collision_with_builtin.ark b/tests/unittests/resources/DiagnosticsSuite/compileTime/name_collision_with_builtin.ark index 13bf5e5ca..58b48713d 100644 --- a/tests/unittests/resources/DiagnosticsSuite/compileTime/name_collision_with_builtin.ark +++ b/tests/unittests/resources/DiagnosticsSuite/compileTime/name_collision_with_builtin.ark @@ -1,3 +1,3 @@ -(import package.list :reverse) +(import package.list :random) -(print (reverse [1 2 3])) +(print (random [1 2 3])) diff --git a/tests/unittests/resources/DiagnosticsSuite/compileTime/name_collision_with_builtin.expected b/tests/unittests/resources/DiagnosticsSuite/compileTime/name_collision_with_builtin.expected index 782c7f4e1..2a47f054f 100644 --- a/tests/unittests/resources/DiagnosticsSuite/compileTime/name_collision_with_builtin.expected +++ b/tests/unittests/resources/DiagnosticsSuite/compileTime/name_collision_with_builtin.expected @@ -1,7 +1,5 @@ -At reverse @ 3:9 - 1 | (import package.list :reverse) +At random @ 1:0 + 1 | (let random (fun (l) l)) + | ^~~~~~ 2 | - 3 | (print (reverse [1 2 3])) - | ^~~~~~~ - 4 | - Symbol `reverse' was resolved to `list:reverse', which is also a builtin name. Either the symbol or the package it's in needs to be renamed to avoid conflicting with the builtin. + Can not use a reserved identifier ('random') as a constant name. diff --git a/tests/unittests/resources/DiagnosticsSuite/compileTime/package/list.ark b/tests/unittests/resources/DiagnosticsSuite/compileTime/package/list.ark index 3e67feee1..ee1371633 100644 --- a/tests/unittests/resources/DiagnosticsSuite/compileTime/package/list.ark +++ b/tests/unittests/resources/DiagnosticsSuite/compileTime/package/list.ark @@ -1 +1 @@ -(let reverse (fun (l) l)) +(let random (fun (l) l)) diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_not_enough_args.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_not_enough_args.ark new file mode 100644 index 000000000..d0970a5b6 --- /dev/null +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_not_enough_args.ark @@ -0,0 +1,2 @@ +(let asinh (fun (_x) (builtin__math:asinh _x))) +(asinh) diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_not_enough_args.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_not_enough_args.expected new file mode 100644 index 000000000..c9aa8c88a --- /dev/null +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_not_enough_args.expected @@ -0,0 +1,7 @@ +ArityError: When calling `(asinh)', received 0 argument, but expected 1: `(asinh a)' + +In file tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_not_enough_args.ark:2 + 1 | (let asinh (fun (_x) (builtin__math:asinh _x))) + 2 | (asinh) + | ^~~~~~ + 3 | diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_too_many_args.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_too_many_args.ark new file mode 100644 index 000000000..2c9bed429 --- /dev/null +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_too_many_args.ark @@ -0,0 +1,2 @@ +(let asinh (fun (_x) (builtin__math:asinh _x))) +(asinh 1 2) diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_too_many_args.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_too_many_args.expected new file mode 100644 index 000000000..93e7764ad --- /dev/null +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_too_many_args.expected @@ -0,0 +1,7 @@ +ArityError: When calling `(asinh 1 2)', received 2 arguments, but expected 1: `(asinh a)' + +In file tests/unittests/resources/DiagnosticsSuite/runtime/builtin_proxy_too_many_args.ark:2 + 1 | (let asinh (fun (_x) (builtin__math:asinh _x))) + 2 | (asinh 1 2) + | ^~~~~~~~~~ + 3 | diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/fmt_arg_not_found.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/fmt_arg_not_found.ark index 53938ca46..85a5edaca 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/fmt_arg_not_found.ark +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/fmt_arg_not_found.ark @@ -1 +1 @@ -(string:format "Hello {}, I'm {}" "World") +(format "Hello {}, I'm {}" "World") diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/fmt_arg_not_found.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/fmt_arg_not_found.expected index 556eae09e..6a2883a7b 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/fmt_arg_not_found.expected +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/fmt_arg_not_found.expected @@ -1,6 +1,6 @@ -string:format: can not format "Hello {}, I'm {}" (1 argument provided) because of argument not found +format: can not format "Hello {}, I'm {}" (1 argument provided) because of argument not found In file tests/unittests/resources/DiagnosticsSuite/runtime/fmt_arg_not_found.ark:1 - 1 | (string:format "Hello {}, I'm {}" "World") - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 | (format "Hello {}, I'm {}" "World") + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/list_set_at.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/list_set_at.ark index fb5c5cf01..6f9d104cf 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/list_set_at.ark +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/list_set_at.ark @@ -1 +1 @@ -(list:setAt [0 1 2 3] 4 9) +(builtin__list:setAt [0 1 2 3] 4 9) diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/list_set_at.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/list_set_at.expected index 333bc9751..250dbc27c 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/list_set_at.expected +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/list_set_at.expected @@ -1,6 +1,6 @@ IndexError: list:setAt index (4) out of range (list size: 4) In file tests/unittests/resources/DiagnosticsSuite/runtime/list_set_at.ark:1 - 1 | (list:setAt [0 1 2 3] 4 9) - | ^~~~~~~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:setAt [0 1 2 3] 4 9) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_end_start.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_end_start.ark index 2a99c795e..cd1a6ed16 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_end_start.ark +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_end_start.ark @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] 6 5 1) +(builtin__list:slice [1 2 3 4 5 6 7 8 9] 6 5 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_end_start.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_end_start.expected index 3560a6905..eb173fb86 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_end_start.expected +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_end_start.expected @@ -1,6 +1,6 @@ list:slice: start position (6) must be less or equal to the end position (5) In file tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_end_start.ark:1 - 1 | (list:slice [1 2 3 4 5 6 7 8 9] 6 5 1) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:slice [1 2 3 4 5 6 7 8 9] 6 5 1) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_past_end.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_past_end.ark index b88637a13..0dc38a42b 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_past_end.ark +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_past_end.ark @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] 6 12 1) +(builtin__list:slice [1 2 3 4 5 6 7 8 9] 6 12 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_past_end.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_past_end.expected index c52a6a51e..91d099ba2 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_past_end.expected +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_past_end.expected @@ -1,6 +1,6 @@ list:slice: end index 12 out of range (length: 9) In file tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_past_end.ark:1 - 1 | (list:slice [1 2 3 4 5 6 7 8 9] 6 12 1) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:slice [1 2 3 4 5 6 7 8 9] 6 12 1) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_start_less_0.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_start_less_0.ark index 9d150c8a4..1cf0819d7 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_start_less_0.ark +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_start_less_0.ark @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] -1 5 1) +(builtin__list:slice [1 2 3 4 5 6 7 8 9] -1 5 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_start_less_0.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_start_less_0.expected index 7592acc32..ca22081e0 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_start_less_0.expected +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_start_less_0.expected @@ -1,6 +1,6 @@ list:slice: start index -1 can not be less than 0 In file tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_start_less_0.ark:1 - 1 | (list:slice [1 2 3 4 5 6 7 8 9] -1 5 1) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:slice [1 2 3 4 5 6 7 8 9] -1 5 1) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_step_null.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_step_null.ark index aa53b04c7..58671609e 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_step_null.ark +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_step_null.ark @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] 4 5 -1) +(builtin__list:slice [1 2 3 4 5 6 7 8 9] 4 5 -1) diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_step_null.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_step_null.expected index 1bc4856fc..97a3aecbd 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_step_null.expected +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_step_null.expected @@ -1,6 +1,6 @@ list:slice: step can not be null or negative In file tests/unittests/resources/DiagnosticsSuite/runtime/list_slice_step_null.ark:1 - 1 | (list:slice [1 2 3 4 5 6 7 8 9] 4 5 -1) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:slice [1 2 3 4 5 6 7 8 9] 4 5 -1) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/mathln_out_of_range.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/mathln_out_of_range.ark index e24171f2d..a14ebb48b 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/mathln_out_of_range.ark +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/mathln_out_of_range.ark @@ -1 +1 @@ -(math:ln -1) +(builtin__math:ln -1) diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/mathln_out_of_range.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/mathln_out_of_range.expected index 45f46553d..fd2306c11 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/mathln_out_of_range.expected +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/mathln_out_of_range.expected @@ -1,6 +1,6 @@ math:ln: value -1 must be greater than 0 In file tests/unittests/resources/DiagnosticsSuite/runtime/mathln_out_of_range.ark:1 - 1 | (math:ln -1) - | ^~~~~~~~~~~ + 1 | (builtin__math:ln -1) + | ^~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/str_remove_out_of_bound.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/str_remove_out_of_bound.ark index b507a1ddb..7104a92fe 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/str_remove_out_of_bound.ark +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/str_remove_out_of_bound.ark @@ -1 +1 @@ -(string:removeAt "abc" 5) +(builtin__string:removeAt "abc" 5) diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/str_remove_out_of_bound.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/str_remove_out_of_bound.expected index 65e8d6184..023d62fdb 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/str_remove_out_of_bound.expected +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/str_remove_out_of_bound.expected @@ -1,6 +1,6 @@ string:removeAt: index 5 out of range (length: 3) In file tests/unittests/resources/DiagnosticsSuite/runtime/str_remove_out_of_bound.ark:1 - 1 | (string:removeAt "abc" 5) - | ^~~~~~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__string:removeAt "abc" 5) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/string_set_at.ark b/tests/unittests/resources/DiagnosticsSuite/runtime/string_set_at.ark index c62b8c624..bcc9ced15 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/string_set_at.ark +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/string_set_at.ark @@ -1 +1 @@ -(string:setAt "0123" 4 "9") +(builtin__string:setAt "0123" 4 "9") diff --git a/tests/unittests/resources/DiagnosticsSuite/runtime/string_set_at.expected b/tests/unittests/resources/DiagnosticsSuite/runtime/string_set_at.expected index b4a2234bf..5680aebc8 100644 --- a/tests/unittests/resources/DiagnosticsSuite/runtime/string_set_at.expected +++ b/tests/unittests/resources/DiagnosticsSuite/runtime/string_set_at.expected @@ -1,6 +1,6 @@ IndexError: string:setAt index (4) out of range (string size: 4) In file tests/unittests/resources/DiagnosticsSuite/runtime/string_set_at.ark:1 - 1 | (string:setAt "0123" 4 "9") - | ^~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__string:setAt "0123" 4 "9") + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.ark index d9585f1a2..f138fe298 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.ark @@ -1 +1 @@ -(io:appendToFile 1 2) +(builtin__io:appendToFile 1 2) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.expected index e2279118f..f65476b28 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.expected @@ -3,6 +3,6 @@ Function io:appendToFile expected 2 arguments -> content (any) In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioappendtofile_num_num.ark:1 - 1 | (io:appendToFile 1 2) - | ^~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__io:appendToFile 1 2) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.ark index e198ee0a4..73dbdb3a8 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.ark @@ -1 +1 @@ -(io:dir? 1) +(builtin__io:dir? 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.expected index 838eb529b..444e1ab03 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.expected @@ -2,6 +2,6 @@ Function io:dir? expected 1 argument -> path (String) was of type Number In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iodir_num.ark:1 - 1 | (io:dir? 1) - | ^~~~~~~~~~ + 1 | (builtin__io:dir? 1) + | ^~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.ark index 9ec4c061e..251f4d34c 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.ark @@ -1 +1 @@ -(io:fileExists? 1) +(builtin__io:fileExists? 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.expected index 5a577c3f4..098dd5c34 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.expected @@ -2,6 +2,6 @@ Function io:fileExists? expected 1 argument -> filename (String) was of type Number In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iofileexists_num.ark:1 - 1 | (io:fileExists? 1) - | ^~~~~~~~~~~~~~~~~ + 1 | (builtin__io:fileExists? 1) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iolistfiles_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iolistfiles_num.ark index 343b81fc6..f4b8ec751 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iolistfiles_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iolistfiles_num.ark @@ -1 +1 @@ -(io:listFiles 1) +(builtin__io:listFiles 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iolistfiles_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iolistfiles_num.expected index 9bac4bae5..0dfce92ed 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iolistfiles_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iolistfiles_num.expected @@ -2,6 +2,6 @@ Function io:listFiles expected 1 argument -> path (String) was of type Number In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iolistfiles_num.ark:1 - 1 | (io:listFiles 1) - | ^~~~~~~~~~~~~~~ + 1 | (builtin__io:listFiles 1) + | ^~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iomakedir_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iomakedir_num.ark index 949bb8f69..a32b90cd5 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iomakedir_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iomakedir_num.ark @@ -1 +1 @@ -(io:makeDir 1) +(builtin__io:makeDir 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iomakedir_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iomakedir_num.expected index 6ba7fadcb..08be63ad4 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iomakedir_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iomakedir_num.expected @@ -2,6 +2,6 @@ Function io:makeDir expected 1 argument -> path (String) was of type Number In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iomakedir_num.ark:1 - 1 | (io:makeDir 1) - | ^~~~~~~~~~~~~ + 1 | (builtin__io:makeDir 1) + | ^~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_inexistent.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_inexistent.ark index 2d5a58d5c..119f2d250 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_inexistent.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_inexistent.ark @@ -1 +1 @@ -(io:readFile "non-existing-file.weird") +(builtin__io:readFile "non-existing-file.weird") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_inexistent.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_inexistent.expected index 07af299c7..041982958 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_inexistent.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_inexistent.expected @@ -1,6 +1,6 @@ io:readFile: couldn't read file "non-existing-file.weird" because it doesn't exist In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_inexistent.ark:1 - 1 | (io:readFile "non-existing-file.weird") - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__io:readFile "non-existing-file.weird") + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_num.ark index 5ab233164..af9a0decc 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_num.ark @@ -1 +1 @@ -(io:readFile 1) +(builtin__io:readFile 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_num.expected index 23705ada6..6fac5f06f 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_num.expected @@ -2,6 +2,6 @@ Function io:readFile expected 1 argument -> filename (String) was of type Number In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioreadfile_num.ark:1 - 1 | (io:readFile 1) - | ^~~~~~~~~~~~~~ + 1 | (builtin__io:readFile 1) + | ^~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefile_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefile_num.ark new file mode 100644 index 000000000..20a5fd38a --- /dev/null +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefile_num.ark @@ -0,0 +1 @@ +(builtin__io:removeFile 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefile_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefile_num.expected new file mode 100644 index 000000000..a9792ecb2 --- /dev/null +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefile_num.expected @@ -0,0 +1,7 @@ +Function io:removeFile expected 1 argument + -> filename (String) was of type Number + +In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefile_num.ark:1 + 1 | (builtin__io:removeFile 1) + | ^~~~~~~~~~~~~~~~~~~~~~~~~ + 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_num.ark deleted file mode 100644 index b2ae661f1..000000000 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_num.ark +++ /dev/null @@ -1 +0,0 @@ -(io:removeFiles 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_num.expected deleted file mode 100644 index 3a103a029..000000000 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_num.expected +++ /dev/null @@ -1,7 +0,0 @@ -Function io:removeFiles expected at least 1 argument and got 1 - -> variadic filename (String) 1 argument do not match - -In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_num.ark:1 - 1 | (io:removeFiles 1) - | ^~~~~~~~~~~~~~~~~ - 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_str_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_str_num.ark deleted file mode 100644 index e2f5a41bd..000000000 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_str_num.ark +++ /dev/null @@ -1,2 +0,0 @@ -(io:writeFile "hello" "content") -(io:removeFiles "hello" 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_str_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_str_num.expected deleted file mode 100644 index 883017366..000000000 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_str_num.expected +++ /dev/null @@ -1,9 +0,0 @@ -Function io:removeFiles expected at least 2 arguments and got 2 - -> filename (String) - -> variadic filenames (String) 1 argument do not match - -In file tests/unittests/resources/DiagnosticsSuite/typeChecking/ioremovefiles_str_num.ark:2 - 1 | (io:writeFile "hello" "content") - 2 | (io:removeFiles "hello" 1) - | ^~~~~~~~~~~~~~~~~~~~~~~~~ - 3 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iowritefile_num_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iowritefile_num_num.ark index 742e76ba6..37f9cd97f 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iowritefile_num_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iowritefile_num_num.ark @@ -1 +1 @@ -(io:writeFile 1 2) +(builtin__io:writeFile 1 2) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iowritefile_num_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iowritefile_num_num.expected index d38797380..2af81db4a 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/iowritefile_num_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/iowritefile_num_num.expected @@ -3,6 +3,6 @@ Function io:writeFile expected 2 arguments -> content (any) In file tests/unittests/resources/DiagnosticsSuite/typeChecking/iowritefile_num_num.ark:1 - 1 | (io:writeFile 1 2) - | ^~~~~~~~~~~~~~~~~ + 1 | (builtin__io:writeFile 1 2) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfill_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfill_str.ark index 18a2ca624..654d60ebd 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfill_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfill_str.ark @@ -1 +1 @@ -(list:fill "hello") +(builtin__list:fill "hello") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfill_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfill_str.expected index f7a78f266..c3f551540 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfill_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfill_str.expected @@ -3,6 +3,6 @@ Function list:fill expected 2 arguments but got 1 -> value (any) was not provided In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listfill_str.ark:1 - 1 | (list:fill "hello") - | ^~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:fill "hello") + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfind_str_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfind_str_num.ark index 3198318be..5b73d7de2 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfind_str_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfind_str_num.ark @@ -1 +1 @@ -(list:find "hello" 1) +(builtin__list:find "hello" 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfind_str_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfind_str_num.expected index c089968c5..b7f45a0d1 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfind_str_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listfind_str_num.expected @@ -3,6 +3,6 @@ Function list:find expected 2 arguments -> value (any) In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listfind_str_num.ark:1 - 1 | (list:find "hello" 1) - | ^~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:find "hello" 1) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listreverse_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listreverse_str.ark index 9d7716b5a..05fe0b610 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listreverse_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listreverse_str.ark @@ -1 +1 @@ -(list:reverse "hello") +(builtin__list:reverse "hello") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listreverse_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listreverse_str.expected index b070d4aae..623126699 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listreverse_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listreverse_str.expected @@ -2,6 +2,6 @@ Function list:reverse expected 1 argument -> list (List) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listreverse_str.ark:1 - 1 | (list:reverse "hello") - | ^~~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:reverse "hello") + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsetat_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsetat_str.ark index 652d4c360..77d58e024 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsetat_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsetat_str.ark @@ -1 +1 @@ -(list:setAt "hello") +(builtin__list:setAt "hello") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsetat_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsetat_str.expected index 90d7f9608..2770c8f03 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsetat_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsetat_str.expected @@ -4,6 +4,6 @@ Function list:setAt expected 3 arguments but got 1 -> value (any) was not provided In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listsetat_str.ark:1 - 1 | (list:setAt "hello") - | ^~~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:setAt "hello") + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listslice_str_num_bool_nil.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listslice_str_num_bool_nil.ark index 10a213bb9..f761fdfb8 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listslice_str_num_bool_nil.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listslice_str_num_bool_nil.ark @@ -1 +1 @@ -(list:slice "hello" 1 true nil) +(builtin__list:slice "hello" 1 true nil) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listslice_str_num_bool_nil.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listslice_str_num_bool_nil.expected index b6c33f363..bb1dbce33 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listslice_str_num_bool_nil.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listslice_str_num_bool_nil.expected @@ -5,6 +5,6 @@ Function list:slice expected 4 arguments -> step (Number) was of type Nil In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listslice_str_num_bool_nil.ark:1 - 1 | (list:slice "hello" 1 true nil) - | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:slice "hello" 1 true nil) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsort_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsort_str.ark index bd47a6155..fa9730427 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsort_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsort_str.ark @@ -1 +1 @@ -(list:sort "hello") +(builtin__list:sort "hello") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsort_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsort_str.expected index 8ab8c769d..27cd1ad93 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsort_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/listsort_str.expected @@ -2,6 +2,6 @@ Function list:sort expected 1 argument -> list (List) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/listsort_str.ark:1 - 1 | (list:sort "hello") - | ^~~~~~~~~~~~~~~~~~ + 1 | (builtin__list:sort "hello") + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathacosh_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathacosh_str.ark index 1b7ed80ed..51b48f816 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathacosh_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathacosh_str.ark @@ -1 +1 @@ -(math:acosh "1") +(builtin__math:acosh "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathacosh_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathacosh_str.expected index f0101bdc6..ab800e3bc 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathacosh_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathacosh_str.expected @@ -2,6 +2,6 @@ Function math:acosh expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathacosh_str.ark:1 - 1 | (math:acosh "1") - | ^~~~~~~~~~~~~~~ + 1 | (builtin__math:acosh "1") + | ^~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharccos_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharccos_str.ark index 8ff5cf527..b535ccd7f 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharccos_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharccos_str.ark @@ -1 +1 @@ -(math:arccos "1") +(builtin__math:arccos "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharccos_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharccos_str.expected index 19c0f9069..5b163be30 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharccos_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharccos_str.expected @@ -2,6 +2,6 @@ Function math:arccos expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/matharccos_str.ark:1 - 1 | (math:arccos "1") - | ^~~~~~~~~~~~~~~~ + 1 | (builtin__math:arccos "1") + | ^~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharcsin_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharcsin_str.ark index a0a4e6854..64e04caa6 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharcsin_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharcsin_str.ark @@ -1 +1 @@ -(math:arcsin "1") +(builtin__math:arcsin "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharcsin_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharcsin_str.expected index b33cc165d..bb49e1204 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharcsin_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharcsin_str.expected @@ -2,6 +2,6 @@ Function math:arcsin expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/matharcsin_str.ark:1 - 1 | (math:arcsin "1") - | ^~~~~~~~~~~~~~~~ + 1 | (builtin__math:arcsin "1") + | ^~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharctan_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharctan_str.ark index 71a39a42e..531a7f27f 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharctan_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharctan_str.ark @@ -1 +1 @@ -(math:arctan "1") +(builtin__math:arctan "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharctan_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharctan_str.expected index 710590c05..02b5d5f72 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharctan_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/matharctan_str.expected @@ -2,6 +2,6 @@ Function math:arctan expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/matharctan_str.ark:1 - 1 | (math:arctan "1") - | ^~~~~~~~~~~~~~~~ + 1 | (builtin__math:arctan "1") + | ^~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathasinh_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathasinh_str.ark index 9ba00abeb..2d462db69 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathasinh_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathasinh_str.ark @@ -1 +1 @@ -(math:asinh "1") +(builtin__math:asinh "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathasinh_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathasinh_str.expected index 2b6893ee6..37fd06f7a 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathasinh_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathasinh_str.expected @@ -2,6 +2,6 @@ Function math:asinh expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathasinh_str.ark:1 - 1 | (math:asinh "1") - | ^~~~~~~~~~~~~~~ + 1 | (builtin__math:asinh "1") + | ^~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathatanh_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathatanh_str.ark index 654aad8d1..91d644538 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathatanh_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathatanh_str.ark @@ -1 +1 @@ -(math:atanh "1") +(builtin__math:atanh "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathatanh_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathatanh_str.expected index 27b7b071f..a424631c3 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathatanh_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathatanh_str.expected @@ -2,6 +2,6 @@ Function math:atanh expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathatanh_str.ark:1 - 1 | (math:atanh "1") - | ^~~~~~~~~~~~~~~ + 1 | (builtin__math:atanh "1") + | ^~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathceil_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathceil_str.ark index 270c9ace7..573949dc6 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathceil_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathceil_str.ark @@ -1 +1 @@ -(math:ceil "1") +(builtin__math:ceil "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathceil_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathceil_str.expected index 8eca9ea31..6dfbc37db 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathceil_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathceil_str.expected @@ -2,6 +2,6 @@ Function math:ceil expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathceil_str.ark:1 - 1 | (math:ceil "1") - | ^~~~~~~~~~~~~~ + 1 | (builtin__math:ceil "1") + | ^~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcos_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcos_str.ark index 7366358fa..9fd45fae2 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcos_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcos_str.ark @@ -1 +1 @@ -(math:cos "1") +(builtin__math:cos "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcos_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcos_str.expected index c93dd2338..fef09b4b9 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcos_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcos_str.expected @@ -2,6 +2,6 @@ Function math:cos expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcos_str.ark:1 - 1 | (math:cos "1") - | ^~~~~~~~~~~~~ + 1 | (builtin__math:cos "1") + | ^~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcosh_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcosh_str.ark index f01df2cb5..4bacc8cd7 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcosh_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcosh_str.ark @@ -1 +1 @@ -(math:cosh "1") +(builtin__math:cosh "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcosh_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcosh_str.expected index a566a317e..5fe63aec7 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcosh_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcosh_str.expected @@ -2,6 +2,6 @@ Function math:cosh expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathcosh_str.ark:1 - 1 | (math:cosh "1") - | ^~~~~~~~~~~~~~ + 1 | (builtin__math:cosh "1") + | ^~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathexp_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathexp_str.ark index f13daa4af..2727b225c 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathexp_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathexp_str.ark @@ -1 +1 @@ -(math:exp "1") +(builtin__math:exp "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathexp_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathexp_str.expected index 3ed74fc9b..79b083717 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathexp_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathexp_str.expected @@ -2,6 +2,6 @@ Function math:exp expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathexp_str.ark:1 - 1 | (math:exp "1") - | ^~~~~~~~~~~~~ + 1 | (builtin__math:exp "1") + | ^~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathfloor_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathfloor_str.ark index c9d55113e..b04760b36 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathfloor_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathfloor_str.ark @@ -1 +1 @@ -(math:floor "1") +(builtin__math:floor "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathfloor_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathfloor_str.expected index 00a21e901..a7c0e3eea 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathfloor_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathfloor_str.expected @@ -2,6 +2,6 @@ Function math:floor expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathfloor_str.ark:1 - 1 | (math:floor "1") - | ^~~~~~~~~~~~~~~ + 1 | (builtin__math:floor "1") + | ^~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathln_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathln_str.ark index 3f908ba9e..456cd89d9 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathln_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathln_str.ark @@ -1 +1 @@ -(math:ln "1") +(builtin__math:ln "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathln_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathln_str.expected index 5e9037430..da5a8da7c 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathln_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathln_str.expected @@ -2,6 +2,6 @@ Function math:ln expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathln_str.ark:1 - 1 | (math:ln "1") - | ^~~~~~~~~~~~ + 1 | (builtin__math:ln "1") + | ^~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathround_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathround_str.ark index 2ea803618..ec0c35303 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathround_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathround_str.ark @@ -1 +1 @@ -(math:round "1") +(builtin__math:round "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathround_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathround_str.expected index 1d3da4034..ff3d0dc33 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathround_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathround_str.expected @@ -2,6 +2,6 @@ Function math:round expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathround_str.ark:1 - 1 | (math:round "1") - | ^~~~~~~~~~~~~~~ + 1 | (builtin__math:round "1") + | ^~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsin_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsin_str.ark index 351892d54..debb0c68d 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsin_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsin_str.ark @@ -1 +1 @@ -(math:sin "1") +(builtin__math:sin "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsin_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsin_str.expected index ed4cd8a1c..62b1e5aac 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsin_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsin_str.expected @@ -2,6 +2,6 @@ Function math:sin expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsin_str.ark:1 - 1 | (math:sin "1") - | ^~~~~~~~~~~~~ + 1 | (builtin__math:sin "1") + | ^~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsinh_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsinh_str.ark index f1f641c69..3b18b2d9a 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsinh_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsinh_str.ark @@ -1 +1 @@ -(math:sinh "1") +(builtin__math:sinh "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsinh_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsinh_str.expected index 71dc566f5..e2755c489 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsinh_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsinh_str.expected @@ -2,6 +2,6 @@ Function math:sinh expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathsinh_str.ark:1 - 1 | (math:sinh "1") - | ^~~~~~~~~~~~~~ + 1 | (builtin__math:sinh "1") + | ^~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtan_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtan_str.ark index 7fd5c4805..024114ba2 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtan_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtan_str.ark @@ -1 +1 @@ -(math:tan "1") +(builtin__math:tan "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtan_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtan_str.expected index 3c2269d93..b1d5d0179 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtan_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtan_str.expected @@ -2,6 +2,6 @@ Function math:tan expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtan_str.ark:1 - 1 | (math:tan "1") - | ^~~~~~~~~~~~~ + 1 | (builtin__math:tan "1") + | ^~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtanh_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtanh_str.ark index 241e3fc7f..02d48bc56 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtanh_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtanh_str.ark @@ -1 +1 @@ -(math:tanh "1") +(builtin__math:tanh "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtanh_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtanh_str.expected index 69657c28b..5befdbca3 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtanh_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtanh_str.expected @@ -2,6 +2,6 @@ Function math:tanh expected 1 argument -> value (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/mathtanh_str.ark:1 - 1 | (math:tanh "1") - | ^~~~~~~~~~~~~~ + 1 | (builtin__math:tanh "1") + | ^~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringchr_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringchr_str.ark index 33c0f6980..21dcd35a1 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringchr_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringchr_str.ark @@ -1 +1 @@ -(string:chr "1") +(builtin__string:chr "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringchr_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringchr_str.expected index f1d7047ba..da5b214dc 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringchr_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringchr_str.expected @@ -2,6 +2,6 @@ Function string:chr expected 1 argument -> codepoint (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/stringchr_str.ark:1 - 1 | (string:chr "1") - | ^~~~~~~~~~~~~~~ + 1 | (builtin__string:chr "1") + | ^~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringfind_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringfind_num.ark index c794d6da9..706ff3b73 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringfind_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringfind_num.ark @@ -1 +1 @@ -(string:find 1) +(builtin__string:find 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringfind_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringfind_num.expected index d80a79999..1144faaf3 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringfind_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringfind_num.expected @@ -7,6 +7,6 @@ Alternative 2: -> startIndex (Number) was not provided In file tests/unittests/resources/DiagnosticsSuite/typeChecking/stringfind_num.ark:1 - 1 | (string:find 1) - | ^~~~~~~~~~~~~~ + 1 | (builtin__string:find 1) + | ^~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringformat_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringformat_num.ark index abcee716c..6b8edfdff 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringformat_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringformat_num.ark @@ -1 +1 @@ -(string:format 1) +(format 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringformat_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringformat_num.expected index 92326fb12..c0f1bd035 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringformat_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringformat_num.expected @@ -1,8 +1,8 @@ -Function string:format expected at least 2 arguments but got 1 +Function format expected at least 2 arguments but got 1 -> string (String) was of type Number -> variadic value (any) was not provided In file tests/unittests/resources/DiagnosticsSuite/typeChecking/stringformat_num.ark:1 - 1 | (string:format 1) - | ^~~~~~~~~~~~~~~~ + 1 | (format 1) + | ^~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringord_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringord_num.ark index 42348bff0..b06dec626 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringord_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringord_num.ark @@ -1 +1 @@ -(string:ord 1) +(builtin__string:ord 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringord_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringord_num.expected index ffbc4dbb4..8ae9e053f 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringord_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringord_num.expected @@ -2,6 +2,6 @@ Function string:ord expected 1 argument -> string (String) was of type Number In file tests/unittests/resources/DiagnosticsSuite/typeChecking/stringord_num.ark:1 - 1 | (string:ord 1) - | ^~~~~~~~~~~~~ + 1 | (builtin__string:ord 1) + | ^~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringremoveat_num.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringremoveat_num.ark index 0b81fc507..a4bdcdcee 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringremoveat_num.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringremoveat_num.ark @@ -1 +1 @@ -(string:removeAt 1) +(builtin__string:removeAt 1) diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringremoveat_num.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringremoveat_num.expected index c5c117380..f11cd916a 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringremoveat_num.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringremoveat_num.expected @@ -3,6 +3,6 @@ Function string:removeAt expected 2 arguments but got 1 -> index (Number) was not provided In file tests/unittests/resources/DiagnosticsSuite/typeChecking/stringremoveat_num.ark:1 - 1 | (string:removeAt 1) - | ^~~~~~~~~~~~~~~~~~ + 1 | (builtin__string:removeAt 1) + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringsetat_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringsetat_str.ark index fc8b8604c..59aa494d0 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringsetat_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringsetat_str.ark @@ -1 +1 @@ -(string:setAt "1") +(builtin__string:setAt "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringsetat_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringsetat_str.expected index 3d73c32d1..cda8203b5 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringsetat_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/stringsetat_str.expected @@ -4,6 +4,6 @@ Function string:setAt expected 3 arguments but got 1 -> value (String) was not provided In file tests/unittests/resources/DiagnosticsSuite/typeChecking/stringsetat_str.ark:1 - 1 | (string:setAt "1") - | ^~~~~~~~~~~~~~~~~ + 1 | (builtin__string:setAt "1") + | ^~~~~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/syssleep_str.ark b/tests/unittests/resources/DiagnosticsSuite/typeChecking/syssleep_str.ark index e18e8d729..670b2e32a 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/syssleep_str.ark +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/syssleep_str.ark @@ -1 +1 @@ -(sys:sleep "1") +(builtin__sys:sleep "1") diff --git a/tests/unittests/resources/DiagnosticsSuite/typeChecking/syssleep_str.expected b/tests/unittests/resources/DiagnosticsSuite/typeChecking/syssleep_str.expected index 82861b508..916b4140b 100644 --- a/tests/unittests/resources/DiagnosticsSuite/typeChecking/syssleep_str.expected +++ b/tests/unittests/resources/DiagnosticsSuite/typeChecking/syssleep_str.expected @@ -2,6 +2,6 @@ Function sys:sleep expected 1 argument -> duration (Number) was of type String In file tests/unittests/resources/DiagnosticsSuite/typeChecking/syssleep_str.ark:1 - 1 | (sys:sleep "1") - | ^~~~~~~~~~~~~~ + 1 | (builtin__sys:sleep "1") + | ^~~~~~~~~~~~~~~~~~~~~~~ 2 | diff --git a/tests/unittests/resources/LangSuite/builtins-tests.ark b/tests/unittests/resources/LangSuite/builtins-tests.ark index 75eb75097..8343bacbc 100644 --- a/tests/unittests/resources/LangSuite/builtins-tests.ark +++ b/tests/unittests/resources/LangSuite/builtins-tests.ark @@ -24,23 +24,9 @@ (set keep false) }) (test:expect foo.keep "capture inside a deeper scope works") }) - (test:case "files" { - (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")) }) - (test:case "time" { (let old (time)) - (sys:sleep 1) + (builtin__sys:sleep 1) (test:expect (< old (time))) }) (mut rands []) @@ -58,10 +44,7 @@ # no need to test all 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 (test:case "math" { - (test:expect (not (math:NaN? 1))) - (test:expect (math:NaN? math:NaN)) - (test:expect (not (math:Inf? 100000))) - (test:expect (math:Inf? math:Inf)) }) - - # clean up - (io:removeFiles "test.txt" "temp/") }) + (test:expect (not (builtin__math:NaN? 1))) + (test:expect (builtin__math:NaN? builtin__math:NaN)) + (test:expect (not (builtin__math:Inf? 100000))) + (test:expect (builtin__math:Inf? builtin__math:Inf)) }) }) diff --git a/tests/unittests/resources/LangSuite/list-tests.ark b/tests/unittests/resources/LangSuite/list-tests.ark index 2a64ea3fb..a363d9a3c 100644 --- a/tests/unittests/resources/LangSuite/list-tests.ark +++ b/tests/unittests/resources/LangSuite/list-tests.ark @@ -33,47 +33,47 @@ (test:eq a [1 2 3]) }) (test:case "reverse and return a new list" { - (test:eq (list:reverse a) [3 2 1]) + (test:eq (builtin__list:reverse a) [3 2 1]) (test:eq a [1 2 3]) - (test:eq (list:reverse []) []) }) + (test:eq (builtin__list:reverse []) []) }) (test:case "find element in list" { - (test:eq (list:find a 0) -1) - (test:eq (list:find a 2) 1) - (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 (builtin__list:find a 0) -1) + (test:eq (builtin__list:find a 2) 1) + (test:eq (builtin__list:find [] nil) -1) + (test:eq (builtin__list:find [12] 12) 0) + (test:eq (builtin__list:find [1 2 3] 2) 1) + (test:eq (builtin__list:find [12] nil) -1) }) (test:case "slice and return a new list" { - (test:eq (list:slice a 0 0 1) []) + (test:eq (builtin__list:slice a 0 0 1) []) (test:eq a [1 2 3]) - (test:eq (list:slice a 0 3 2) [1 3]) + (test:eq (builtin__list:slice a 0 3 2) [1 3]) (test:eq a [1 2 3]) }) (test:case "sort and return a new list" { - (test:eq (list:sort [3 1 2]) a) + (test:eq (builtin__list:sort [3 1 2]) a) (test:eq a [1 2 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 []) []) }) + (test:eq (builtin__list:sort [5 4 3 2 1]) [1 2 3 4 5]) + (test:eq (builtin__list:sort [5]) [5]) + (test:eq (builtin__list:sort []) []) }) - (test:eq (list:fill 5 nil) [nil nil nil nil nil]) - (let short_list (list:fill 12 nil)) + (test:eq (builtin__list:fill 5 nil) [nil nil nil nil nil]) + (let short_list (builtin__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)) }) - (test:eq (@ (list:setAt short_list 5 "a") 5) "a") + (test:eq (@ (builtin__list:setAt short_list 5 "a") 5) "a") (test:case "modify list at index and return a new list" { - (let tmp (list:setAt a 1 "b")) + (let tmp (builtin__list:setAt a 1 "b")) (test:eq tmp [1 "b" 3]) (test:eq a [1 2 3]) - (test:eq (list:setAt [0 1 2 3] 0 9) [9 1 2 3]) - (test:eq (list:setAt [0 1 2 3] 3 9) [0 1 2 9]) - (test:eq (list:setAt [0 1 2 9] -1 9) [0 1 2 9]) }) + (test:eq (builtin__list:setAt [0 1 2 3] 0 9) [9 1 2 3]) + (test:eq (builtin__list:setAt [0 1 2 3] 3 9) [0 1 2 9]) + (test:eq (builtin__list:setAt [0 1 2 9] -1 9) [0 1 2 9]) }) (test:case "get element in list" { (test:eq 0 (@ [0] -1)) diff --git a/tests/unittests/resources/LangSuite/string-tests.ark b/tests/unittests/resources/LangSuite/string-tests.ark index 2838b07f1..d297f2474 100644 --- a/tests/unittests/resources/LangSuite/string-tests.ark +++ b/tests/unittests/resources/LangSuite/string-tests.ark @@ -4,24 +4,24 @@ (test:expect (empty? "")) (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:eq (string:removeAt "abcdefghijkl" 3) "abcefghijkl") - (test:eq (string:removeAt "abcdefghijkl" 0) "bcdefghijkl") - (test:eq (string:removeAt "abcdefghijkl" 11) "abcdefghijk") }) + (test:eq "hllo world" (builtin__string:removeAt "hello world" 1)) + (test:eq "ello world" (builtin__string:removeAt "hello world" 0)) + (test:eq "hello worl" (builtin__string:removeAt "hello world" 10)) + (test:eq (builtin__string:removeAt "abcdefghijkl" 3) "abcefghijkl") + (test:eq (builtin__string:removeAt "abcdefghijkl" 0) "bcdefghijkl") + (test:eq (builtin__string:removeAt "abcdefghijkl" 11) "abcdefghijk") }) (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: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:find "abcdabcdabcd" "abcd" 2) 4) }) + (test:eq -1 (builtin__string:find "hello" "help")) + (test:eq 0 (builtin__string:find "hello" "hel")) + (test:eq 2 (builtin__string:find "hello" "llo")) + (test:eq -1 (builtin__string:find "" "1")) + (test:eq (builtin__string:find "abc" "d") -1) + (test:eq (builtin__string:find "abc" "a") 0) + (test:eq (builtin__string:find "abc" "bc") 1) + (test:eq (builtin__string:find "abcdefghijkl" "defijkl") -1) + (test:eq (builtin__string:find "abcdefghijkl" "defghijkl") 3) + (test:eq (builtin__string:find "abcdabcdabcd" "abcd" 2) 4) }) (test:case "get char in string" { (test:eq "a" (@ "abc" 0)) @@ -40,9 +40,9 @@ (test:eq "e" (@@ nested_strings 1 -2)) }) (test:case "update string" { - (test:eq (string:setAt "hello" 0 "a") "aello") - (test:eq (string:setAt "hello" -1 "a") "hella") - (test:eq (string:setAt "hello" 4 "a") "hella") }) + (test:eq (builtin__string:setAt "hello" 0 "a") "aello") + (test:eq (builtin__string:setAt "hello" -1 "a") "hella") + (test:eq (builtin__string:setAt "hello" 4 "a") "hella") }) (test:case "in place mutation of strings with @=" { (mut data "hello world") @@ -57,5 +57,5 @@ (test:eq strings ["aello" "worlb"]) }) (test:case "format strings" { - (test:eq "nilfalsetrue" (string:format "{}{}{}" nil false true)) - (test:eq "CProcedure" (string:format "{}" print)) })}) + (test:eq "nilfalsetrue" (format "{}{}{}" nil false true)) + (test:eq "CProcedure" (format "{}" print)) })}) diff --git a/tests/unittests/resources/LangSuite/unittests.ark b/tests/unittests/resources/LangSuite/unittests.ark index 091de2c39..11ece0952 100644 --- a/tests/unittests/resources/LangSuite/unittests.ark +++ b/tests/unittests/resources/LangSuite/unittests.ark @@ -19,4 +19,4 @@ (let success_count (list:sum (@ outputs 0))) (let failure_count (list:sum (@ outputs 1))) -(print (string:format "{:=<20}\nSuccesses: {} - Failures: {}\n" "=" success_count failure_count)) +(print (format "{:=<20}\nSuccesses: {} - Failures: {}\n" "=" success_count failure_count)) diff --git a/tests/unittests/resources/LangSuite/utf8-tests.ark b/tests/unittests/resources/LangSuite/utf8-tests.ark index 75e357724..360b22b17 100644 --- a/tests/unittests/resources/LangSuite/utf8-tests.ark +++ b/tests/unittests/resources/LangSuite/utf8-tests.ark @@ -26,7 +26,7 @@ (test:eq "\u1E0B" "ḋ") }) (test:case "testing emoji codepoints computing" { - (test:eq (string:ord "👺") 128122) - (test:eq (string:chr 128122) "👺") - (test:eq (string:ord "$") 36) - (test:eq (string:chr 36) "$") })}) + (test:eq (builtin__string:ord "👺") 128122) + (test:eq (builtin__string:chr 128122) "👺") + (test:eq (builtin__string:ord "$") 36) + (test:eq (builtin__string:chr 36) "$") })}) diff --git a/tests/unittests/resources/RosettaSuite/abc_correlation.ark b/tests/unittests/resources/RosettaSuite/abc_correlation.ark index 4ca0da85f..15f604856 100644 --- a/tests/unittests/resources/RosettaSuite/abc_correlation.ark +++ b/tests/unittests/resources/RosettaSuite/abc_correlation.ark @@ -1,5 +1,6 @@ (import std.String :split) (import std.List :filter :map) +(import std.IO) # define a custom helper to count occurrences in a collection (let countIf (fun (_L _f) { diff --git a/tests/unittests/resources/RosettaSuite/ascending_prime.ark b/tests/unittests/resources/RosettaSuite/ascending_prime.ark index 373a8dfae..cc4c4c8f9 100644 --- a/tests/unittests/resources/RosettaSuite/ascending_prime.ark +++ b/tests/unittests/resources/RosettaSuite/ascending_prime.ark @@ -1,10 +1,10 @@ (import std.Math :sqrt :prime?) -(import std.List :iota) -(import std.String :join) +(import std.List) +(import std.String) (import std.Range) (let ascending (fun (n f) { - (mut nums (iota 1 9)) + (mut nums (list:iota 1 9)) (mut i 0) (mut matched []) @@ -21,5 +21,5 @@ matched })) -(print (join (ascending 100 prime?) ", ")) +(print (string:join (ascending 100 prime?) ", ")) # 2, 3, 5, 7, 13, 17, 19, 23, 29, 37, 47, 59, 67, 79, 89, 127, 137, 139, 149, 157, 167, 179, 239, 257, 269, 347, 349, 359, 367, 379, 389, 457, 467, 479, 569, 1237, 1249, 1259, 1279, 1289, 1367, 1459, 1489, 1567, 1579, 1789, 2347, 2357, 2389, 2459, 2467, 2579, 2689, 2789, 3457, 3467, 3469, 4567, 4679, 4789, 5689, 12347, 12379, 12457, 12479, 12569, 12589, 12689, 13457, 13469, 13567, 13679, 13789, 15679, 23459, 23567, 23689, 23789, 25679, 34589, 34679, 123457, 123479, 124567, 124679, 125789, 134789, 145679, 234589, 235679, 235789, 245789, 345679, 345689, 1234789, 1235789, 1245689, 1456789, 12356789, 23456789 diff --git a/tests/unittests/resources/RosettaSuite/calculating_value_of_e.ark b/tests/unittests/resources/RosettaSuite/calculating_value_of_e.ark index 898af78c2..9bf0001c6 100644 --- a/tests/unittests/resources/RosettaSuite/calculating_value_of_e.ark +++ b/tests/unittests/resources/RosettaSuite/calculating_value_of_e.ark @@ -1,5 +1,6 @@ (import std.Range :range) (import std.List) +(import std.Math) (let fact (fun (n acc) { (if (> n 0) diff --git a/tests/unittests/resources/RosettaSuite/infinity.ark b/tests/unittests/resources/RosettaSuite/infinity.ark index 2fd9f611e..1cc94b033 100644 --- a/tests/unittests/resources/RosettaSuite/infinity.ark +++ b/tests/unittests/resources/RosettaSuite/infinity.ark @@ -1,3 +1,5 @@ +(import std.Math) + (assert (= false (math:Inf? 0)) "0 is not infinite") (assert (math:Inf? math:Inf) "math:Inf is infinite") (assert (not (math:Inf? math:NaN)) "math:NaN is not infinite") diff --git a/tests/unittests/resources/RosettaSuite/munchausen.ark b/tests/unittests/resources/RosettaSuite/munchausen.ark index 4cbf7c2b8..fa6748135 100644 --- a/tests/unittests/resources/RosettaSuite/munchausen.ark +++ b/tests/unittests/resources/RosettaSuite/munchausen.ark @@ -1,4 +1,5 @@ (import std.List) +(import std.Math) (let self-exponent (fun (x n acc) (if (> n 0) diff --git a/tests/unittests/resources/RosettaSuite/string_matching.ark b/tests/unittests/resources/RosettaSuite/string_matching.ark index 1952605aa..d46a72fb7 100644 --- a/tests/unittests/resources/RosettaSuite/string_matching.ark +++ b/tests/unittests/resources/RosettaSuite/string_matching.ark @@ -1,6 +1,8 @@ +(import std.String) + (assert (= 0 (string:find "abcd" "ab")) "abcd starts with ab") (assert (= 6 (string:find "hello world" "world")) "world is located at 6") (assert (= -1 (string:find "abcd" "zn")) "abcd does not contain zn") (assert (= -1 (string:find "abab" "bb")) "abab does not contain bb") (assert (= 0 (string:find "abab" "ab")) "abab contains ab") -(assert (= 2 (string:find "abab" "ab" 1)) "starting lookup at index 1, we found ab at position 2") +(assert (= 2 (string:findAfter "abab" "ab" 1)) "starting lookup at index 1, we found ab at position 2") From 38a468ad42eea2c406612d4c94d4922b6a5fbd2d Mon Sep 17 00:00:00 2001 From: Alexandre Plateau Date: Wed, 4 Jun 2025 19:56:37 +0200 Subject: [PATCH 2/2] chore: updating fuzzing corpus --- src/arkreactor/Builtins/IO.cpp | 14 +- src/arkreactor/Builtins/System.cpp | 4 +- tests/fuzzing/corpus-cmin-tmin/c.ark | 191 ---- tests/fuzzing/corpus-cmin-tmin/d.ark | 6 +- .../corpus-cmin-tmin/examples_99bottles.ark | 25 + .../corpus-cmin-tmin/examples_blockchain.ark | 167 ++++ .../corpus-cmin-tmin/examples_callbacks.ark | 34 + .../corpus-cmin-tmin/examples_collatz.ark | 13 +- .../corpus-cmin-tmin/examples_counter.ark | 8 + .../corpus-cmin-tmin/examples_error.ark | 8 +- .../corpus-cmin-tmin/examples_factorial.ark | 16 +- .../corpus-cmin-tmin/examples_fizz_buzz.ark | 13 +- .../examples_games_game_of_life.ark | 7 +- .../examples_games_snake_snake.ark | 217 +++++ .../corpus-cmin-tmin/examples_http.ark | 59 ++ .../corpus-cmin-tmin/examples_macros.ark | 20 +- .../corpus-cmin-tmin/examples_quicksort.ark | 56 +- .../examples_show_ascii_table.ark | 6 +- .../corpus-cmin-tmin/examples_sum_digits.ark | 16 +- .../tests_benchmarks_resources_parser_big.ark | 80 +- ...sts_benchmarks_resources_parser_bigger.ark | 904 ++++++++++++++++++ ..._benchmarks_resources_runtime_builtins.ark | 8 +- ...marks_resources_runtime_create_closure.ark | 34 + ...nchmarks_resources_runtime_create_list.ark | 31 + ...benchmarks_resources_runtime_fibonacci.ark | 5 + ...arks_resources_runtime_man_or_boy_test.ark | 6 +- ...benchmarks_resources_runtime_quicksort.ark | 10 +- ...tests_unittests_resources_astsuite_del.ark | 2 +- ...sts_unittests_resources_astsuite_error.ark | 6 +- ...ts_resources_compilersuite_ir_closures.ark | 46 + ...ests_resources_compilersuite_ir_plugin.ark | 2 +- ...s_compilersuite_optimized_ir_99bottles.ark | 10 +- ...s_compilersuite_optimized_ir_ackermann.ark | 2 +- ...es_compilersuite_optimized_ir_builtins.ark | 3 + ...es_compilersuite_optimized_ir_closures.ark | 25 +- ..._compilersuite_optimized_ir_increments.ark | 12 +- ...urces_compilersuite_optimized_ir_jumps.ark | 45 + ...urces_compilersuite_optimized_ir_lists.ark | 34 +- ...ources_compilersuite_optimized_ir_type.ark | 18 + ...suite_compiletime_argcount_unknown_arg.ark | 4 +- ...sticssuite_compiletime_at_out_of_range.ark | 2 +- ...diagnosticssuite_compiletime_bad_macro.ark | 3 + ...cssuite_compiletime_bad_macro_arg_list.ark | 2 +- ...osticssuite_compiletime_duplicated_arg.ark | 4 +- ...osticssuite_compiletime_forbidden_name.ark | 1 - ...ticssuite_compiletime_import_not_found.ark | 3 + ...ticssuite_compiletime_incomplete_macro.ark | 2 +- ...cssuite_compiletime_invalid_escape_seq.ark | 2 +- ...agnosticssuite_compiletime_invalid_let.ark | 4 +- ...suite_compiletime_invalid_let_in_macro.ark | 2 +- ...ssuite_compiletime_invalid_node_in_ope.ark | 2 +- ...te_compiletime_invalid_node_multilines.ark | 3 + ...suite_compiletime_invalid_sym_func_def.ark | 2 +- ...nosticssuite_compiletime_invalid_while.ark | 3 +- ...mpiletime_macro_spread_not_enough_args.ark | 4 +- ...ompiletime_macro_symcat_arg_type_error.ark | 2 +- ...diagnosticssuite_compiletime_max_depth.ark | 4 +- ...osticssuite_compiletime_max_depth_eval.ark | 2 +- ...uite_compiletime_max_unification_depth.ark | 16 +- ...cssuite_compiletime_neq_chain_too_long.ark | 1 - ...ssuite_compiletime_ope_not_enough_args.ark | 1 + ...cssuite_compiletime_or_not_enough_args.ark | 1 - ...diagnosticssuite_compiletime_package_b.ark | 2 +- ...gnosticssuite_compiletime_package_list.ark | 2 +- ...ticssuite_compiletime_reused_macro_arg.ark | 2 +- ...nosticssuite_compiletime_too_many_args.ark | 4 +- ...sticssuite_compiletime_unbound_capture.ark | 1 - ...ite_compiletime_unbound_var_suggestion.ark | 4 +- ...ticssuite_compiletime_well_formed_args.ark | 2 +- ...nosticssuite_runtime_arity_error_async.ark | 2 +- ...ssuite_runtime_at_at_eq_out_of_range_y.ark | 2 +- ...te_runtime_at_at_negative_outside_list.ark | 2 + ...runtime_at_at_ok_negative_outside_list.ark | 2 + ...osticssuite_runtime_at_at_out_of_range.ark | 2 - ...osticssuite_runtime_at_eq_out_of_range.ark | 4 +- ..._runtime_builtin_proxy_not_enough_args.ark | 2 + ...te_runtime_builtin_proxy_too_many_args.ark | 2 + ...ssuite_runtime_closure_field_wrong_fqn.ark | 1 + ...nosticssuite_runtime_fmt_arg_not_found.ark | 2 +- ...s_diagnosticssuite_runtime_list_set_at.ark | 2 +- ...ticssuite_runtime_list_slice_end_start.ark | 2 +- ...sticssuite_runtime_list_slice_past_end.ark | 2 +- ...ssuite_runtime_list_slice_start_less_0.ark | 2 +- ...ticssuite_runtime_list_slice_step_null.ark | 2 +- ...sticssuite_runtime_mathln_out_of_range.ark | 2 +- ...osticssuite_runtime_nil_not_a_function.ark | 2 +- ...diagnosticssuite_runtime_not_a_closure.ark | 4 +- ..._diagnosticssuite_runtime_not_callable.ark | 1 + ...agnosticssuite_runtime_not_enough_args.ark | 2 +- ...icssuite_runtime_out_of_range_in_place.ark | 2 - ...ime_pop_in_place_negative_outside_list.ark | 2 + ...uite_runtime_pop_negative_outside_list.ark | 2 + ...gnosticssuite_runtime_pop_out_of_range.ark | 2 +- ...ssuite_runtime_str_remove_out_of_bound.ark | 2 +- ...diagnosticssuite_runtime_string_set_at.ark | 2 +- ...diagnosticssuite_runtime_too_many_args.ark | 2 +- ...gnosticssuite_typechecking_add_num_str.ark | 2 +- ...sticssuite_typechecking_append_num_num.ark | 2 +- ..._typechecking_at_at_eq_num_num_num_num.ark | 2 +- ...cssuite_typechecking_at_eq_num_num_num.ark | 2 +- ...gnosticssuite_typechecking_at_list_str.ark | 2 +- ...agnosticssuite_typechecking_at_num_num.ark | 2 +- ...te_typechecking_ioappendtofile_num_num.ark | 2 +- ...iagnosticssuite_typechecking_iodir_num.ark | 2 +- ...icssuite_typechecking_iofileexists_num.ark | 2 +- ...ticssuite_typechecking_iolistfiles_num.ark | 2 +- ...osticssuite_typechecking_iomakedir_num.ark | 2 +- ...ite_typechecking_ioreadfile_inexistent.ark | 2 +- ...sticssuite_typechecking_ioreadfile_num.ark | 2 +- ...icssuite_typechecking_ioremovefile_num.ark | 1 + ...cssuite_typechecking_ioremovefiles_num.ark | 2 +- ...ite_typechecking_ioremovefiles_str_num.ark | 2 - ...suite_typechecking_iowritefile_num_num.ark | 2 +- ..._diagnosticssuite_typechecking_len_num.ark | 2 +- ...nosticssuite_typechecking_listfill_str.ark | 2 +- ...icssuite_typechecking_listfind_str_num.ark | 2 +- ...ticssuite_typechecking_listreverse_str.ark | 2 +- ...osticssuite_typechecking_listsetat_str.ark | 2 +- ...ypechecking_listslice_str_num_bool_nil.ark | 2 +- ...nosticssuite_typechecking_listsort_str.ark | 2 +- ...osticssuite_typechecking_mathacosh_str.ark | 2 +- ...sticssuite_typechecking_matharccos_str.ark | 2 +- ...sticssuite_typechecking_matharcsin_str.ark | 2 +- ...sticssuite_typechecking_matharctan_str.ark | 2 +- ...osticssuite_typechecking_mathasinh_str.ark | 2 +- ...osticssuite_typechecking_mathatanh_str.ark | 2 +- ...nosticssuite_typechecking_mathceil_str.ark | 2 +- ...gnosticssuite_typechecking_mathcos_str.ark | 2 +- ...nosticssuite_typechecking_mathcosh_str.ark | 2 +- ...gnosticssuite_typechecking_mathexp_str.ark | 2 +- ...osticssuite_typechecking_mathfloor_str.ark | 2 +- ...agnosticssuite_typechecking_mathln_str.ark | 2 +- ...osticssuite_typechecking_mathround_str.ark | 2 +- ...gnosticssuite_typechecking_mathsin_str.ark | 2 +- ...nosticssuite_typechecking_mathsinh_str.ark | 2 +- ...gnosticssuite_typechecking_mathtan_str.ark | 2 +- ...nosticssuite_typechecking_mathtanh_str.ark | 2 +- ...gnosticssuite_typechecking_mod_str_str.ark | 2 +- ...uite_typechecking_pop_in_place_num_num.ark | 2 +- ...gnosticssuite_typechecking_pop_num_num.ark | 2 +- ...osticssuite_typechecking_stringchr_str.ark | 2 +- ...sticssuite_typechecking_stringfind_num.ark | 2 +- ...icssuite_typechecking_stringformat_num.ark | 2 +- ...osticssuite_typechecking_stringord_num.ark | 2 +- ...ssuite_typechecking_stringremoveat_num.ark | 2 +- ...ticssuite_typechecking_stringsetat_str.ark | 2 +- ...nosticssuite_typechecking_syssleep_str.ark | 2 +- ...nosticssuite_typechecking_tonumber_num.ark | 2 +- ...ittests_resources_formattersuite_calls.ark | 10 - ...suite_comment_after_import_with_symbol.ark | 3 + ...formattersuite_comment_after_macro_arg.ark | 4 +- ...attersuite_comment_after_node_in_begin.ark | 3 - ...ces_formattersuite_comments_after_call.ark | 4 +- ...s_formattersuite_comments_after_import.ark | 1 + ...tersuite_complex_comments_in_condition.ark | 8 - ...ts_resources_formattersuite_conditions.ark | 2 +- ...ts_resources_formattersuite_escape_seq.ark | 2 +- ...ittests_resources_formattersuite_field.ark | 8 +- ...tests_resources_formattersuite_imports.ark | 13 + ...ttests_resources_formattersuite_macros.ark | 6 +- ...sts_resources_langsuite_builtins-tests.ark | 43 +- ...ittests_resources_langsuite_list-tests.ark | 101 +- ...ttests_resources_langsuite_macro-tests.ark | 26 +- ...tests_resources_langsuite_string-tests.ark | 42 +- ...nittests_resources_langsuite_unittests.ark | 22 + ...ittests_resources_langsuite_utf8-tests.ark | 8 +- ...unittests_resources_langsuite_vm-tests.ark | 56 +- ..._resources_nameresolutionsuite_basic_a.ark | 14 + ..._resources_nameresolutionsuite_basic_b.ark | 4 +- ...ameresolutionsuite_forward_reference_a.ark | 5 + ...nameresolutionsuite_hidden_shadowing_a.ark | 4 + ...nameresolutionsuite_hidden_shadowing_c.ark | 4 + ...ources_nameresolutionsuite_shadowing_a.ark | 5 + ...ources_nameresolutionsuite_shadowing_b.ark | 3 - ...ources_nameresolutionsuite_shadowing_c.ark | 8 +- ...e_shadowing_symbol_swap_import_order_b.ark | 6 +- ...s_optimizersuite_dead_code_elimination.ark | 8 +- ...rces_parsersuite_failure_deeply_nested.ark | 37 + ..._parsersuite_failure_incomplete_call_2.ark | 9 + ...rsuite_failure_incomplete_macro_spread.ark | 2 +- ...ite_failure_unexpected_closing_bracket.ark | 3 + ...uite_failure_unexpected_closing_paren.ark} | 0 ...lure_unexpected_closing_square_bracket.ark | 3 + ...ts_resources_parsersuite_success_begin.ark | 16 +- ...sts_resources_parsersuite_success_call.ark | 2 +- ..._resources_parsersuite_success_closure.ark | 2 +- ...s_resources_parsersuite_success_fields.ark | 2 +- ...ests_resources_parsersuite_success_fun.ark | 2 +- ...tests_resources_parsersuite_success_if.ark | 4 +- ...s_resources_parsersuite_success_import.ark | 16 + ...sts_resources_parsersuite_success_list.ark | 9 - ...sts_resources_parsersuite_success_loop.ark | 14 - ...ts_resources_parsersuite_success_macro.ark | 12 +- ..._resources_parsersuite_success_strings.ark | 4 +- ...tests_resources_rosettasuite_100_doors.ark | 2 +- ...ttests_resources_rosettasuite_a_plus_b.ark | 4 +- ...ources_rosettasuite_abbreviations_easy.ark | 12 +- ...resources_rosettasuite_abc_correlation.ark | 35 - ...tests_resources_rosettasuite_ackermann.ark | 8 - ...ettasuite_apply_a_callback_to_an_array.ark | 2 +- ...ources_rosettasuite_arithmetic_complex.ark | 4 +- ...ources_rosettasuite_arithmetic_integer.ark | 4 +- ...resources_rosettasuite_ascending_prime.ark | 25 + ...sources_rosettasuite_balanced_brackets.ark | 10 +- ...es_rosettasuite_calculating_value_of_e.ark | 6 +- ...ts_resources_rosettasuite_catamorphism.ark | 4 +- ...es_rosettasuite_closures_value_capture.ark | 8 +- ...rces_rosettasuite_extend_your_language.ark | 2 +- ...urces_rosettasuite_fibonacci_iterative.ark | 4 +- ..._resources_rosettasuite_flatten_a_list.ark | 8 +- ...ttests_resources_rosettasuite_infinity.ark | 4 +- ...ests_resources_rosettasuite_munchausen.ark | 17 +- ...tests_resources_rosettasuite_quicksort.ark | 14 +- ...s_resources_rosettasuite_string_append.ark | 4 +- ...resources_rosettasuite_string_matching.ark | 8 +- ...settasuite_sum_and_product_of_an_array.ark | 8 +- ..._rosettasuite_sum_digits_of_an_integer.ark | 4 +- ..._resources_rosettasuite_sum_of_a_serie.ark | 2 +- ...ittests_resources_typecheckersuite_num.ark | 6 +- tests/fuzzing/corpus-cmin/c.ark | 191 ---- tests/fuzzing/corpus-cmin/d.ark | 2 +- .../corpus-cmin/examples_99bottles.ark | 25 + .../corpus-cmin/examples_blockchain.ark | 167 ++++ .../corpus-cmin/examples_callbacks.ark | 34 + .../fuzzing/corpus-cmin/examples_collatz.ark | 3 + .../fuzzing/corpus-cmin/examples_counter.ark | 8 + .../corpus-cmin/examples_fizz_buzz.ark | 9 +- .../examples_games_game_of_life.ark | 1 + .../examples_games_snake_snake.ark | 217 +++++ tests/fuzzing/corpus-cmin/examples_http.ark | 59 ++ .../corpus-cmin/examples_show_ascii_table.ark | 6 +- ...sts_benchmarks_resources_parser_bigger.ark | 904 ++++++++++++++++++ ..._benchmarks_resources_runtime_builtins.ark | 8 +- ...marks_resources_runtime_create_closure.ark | 34 + ...nchmarks_resources_runtime_create_list.ark | 31 + ...benchmarks_resources_runtime_fibonacci.ark | 5 + ...ts_resources_compilersuite_ir_closures.ark | 46 + ...s_compilersuite_optimized_ir_99bottles.ark | 5 +- ...es_compilersuite_optimized_ir_builtins.ark | 3 + ...es_compilersuite_optimized_ir_closures.ark | 9 +- ..._compilersuite_optimized_ir_increments.ark | 8 + ...urces_compilersuite_optimized_ir_jumps.ark | 45 + ...urces_compilersuite_optimized_ir_lists.ark | 28 +- ...ources_compilersuite_optimized_ir_type.ark | 18 + ...diagnosticssuite_compiletime_bad_macro.ark | 3 + ...osticssuite_compiletime_forbidden_name.ark | 1 - ...ticssuite_compiletime_import_not_found.ark | 3 + ...te_compiletime_invalid_node_multilines.ark | 3 + ...cssuite_compiletime_neq_chain_too_long.ark | 1 - ...ssuite_compiletime_ope_not_enough_args.ark | 1 + ...cssuite_compiletime_or_not_enough_args.ark | 1 - ...gnosticssuite_compiletime_package_list.ark | 2 +- ...sticssuite_compiletime_unbound_capture.ark | 1 - ...te_runtime_at_at_negative_outside_list.ark | 2 + ...runtime_at_at_ok_negative_outside_list.ark | 2 + ...osticssuite_runtime_at_at_out_of_range.ark | 2 - ..._runtime_builtin_proxy_not_enough_args.ark | 2 + ...te_runtime_builtin_proxy_too_many_args.ark | 2 + ...ssuite_runtime_closure_field_wrong_fqn.ark | 1 + ...nosticssuite_runtime_fmt_arg_not_found.ark | 2 +- ...s_diagnosticssuite_runtime_list_set_at.ark | 2 +- ...ticssuite_runtime_list_slice_end_start.ark | 2 +- ...sticssuite_runtime_list_slice_past_end.ark | 2 +- ...ssuite_runtime_list_slice_start_less_0.ark | 2 +- ...ticssuite_runtime_list_slice_step_null.ark | 2 +- ...sticssuite_runtime_mathln_out_of_range.ark | 2 +- ..._diagnosticssuite_runtime_not_callable.ark | 1 + ...ime_pop_in_place_negative_outside_list.ark | 2 + ...uite_runtime_pop_negative_outside_list.ark | 2 + ...ssuite_runtime_str_remove_out_of_bound.ark | 2 +- ...diagnosticssuite_runtime_string_set_at.ark | 2 +- ...te_typechecking_ioappendtofile_num_num.ark | 2 +- ...iagnosticssuite_typechecking_iodir_num.ark | 2 +- ...icssuite_typechecking_iofileexists_num.ark | 2 +- ...ticssuite_typechecking_iolistfiles_num.ark | 2 +- ...osticssuite_typechecking_iomakedir_num.ark | 2 +- ...ite_typechecking_ioreadfile_inexistent.ark | 2 +- ...sticssuite_typechecking_ioreadfile_num.ark | 2 +- ...icssuite_typechecking_ioremovefile_num.ark | 1 + ...ite_typechecking_ioremovefiles_str_num.ark | 2 - ...suite_typechecking_iowritefile_num_num.ark | 2 +- ...nosticssuite_typechecking_listfill_str.ark | 2 +- ...icssuite_typechecking_listfind_str_num.ark | 2 +- ...ticssuite_typechecking_listreverse_str.ark | 2 +- ...osticssuite_typechecking_listsetat_str.ark | 2 +- ...ypechecking_listslice_str_num_bool_nil.ark | 2 +- ...nosticssuite_typechecking_listsort_str.ark | 2 +- ...osticssuite_typechecking_mathacosh_str.ark | 2 +- ...sticssuite_typechecking_matharccos_str.ark | 2 +- ...sticssuite_typechecking_matharcsin_str.ark | 2 +- ...sticssuite_typechecking_matharctan_str.ark | 2 +- ...osticssuite_typechecking_mathasinh_str.ark | 2 +- ...osticssuite_typechecking_mathatanh_str.ark | 2 +- ...nosticssuite_typechecking_mathceil_str.ark | 2 +- ...gnosticssuite_typechecking_mathcos_str.ark | 2 +- ...nosticssuite_typechecking_mathcosh_str.ark | 2 +- ...gnosticssuite_typechecking_mathexp_str.ark | 2 +- ...osticssuite_typechecking_mathfloor_str.ark | 2 +- ...agnosticssuite_typechecking_mathln_str.ark | 2 +- ...osticssuite_typechecking_mathround_str.ark | 2 +- ...gnosticssuite_typechecking_mathsin_str.ark | 2 +- ...nosticssuite_typechecking_mathsinh_str.ark | 2 +- ...gnosticssuite_typechecking_mathtan_str.ark | 2 +- ...nosticssuite_typechecking_mathtanh_str.ark | 2 +- ...osticssuite_typechecking_stringchr_str.ark | 2 +- ...sticssuite_typechecking_stringfind_num.ark | 2 +- ...icssuite_typechecking_stringformat_num.ark | 2 +- ...osticssuite_typechecking_stringord_num.ark | 2 +- ...ssuite_typechecking_stringremoveat_num.ark | 2 +- ...ticssuite_typechecking_stringsetat_str.ark | 2 +- ...nosticssuite_typechecking_syssleep_str.ark | 2 +- ...ittests_resources_formattersuite_calls.ark | 10 - ...suite_comment_after_import_with_symbol.ark | 3 + ...attersuite_comment_after_node_in_begin.ark | 3 - ...s_formattersuite_comments_after_import.ark | 1 + ...tersuite_complex_comments_in_condition.ark | 8 - ...tests_resources_formattersuite_imports.ark | 13 + ...sts_resources_langsuite_builtins-tests.ark | 27 +- ...ittests_resources_langsuite_list-tests.ark | 63 +- ...tests_resources_langsuite_string-tests.ark | 42 +- ...nittests_resources_langsuite_unittests.ark | 22 + ...ittests_resources_langsuite_utf8-tests.ark | 8 +- ..._resources_nameresolutionsuite_basic_a.ark | 14 + ...ameresolutionsuite_forward_reference_a.ark | 5 + ...nameresolutionsuite_hidden_shadowing_a.ark | 4 + ...nameresolutionsuite_hidden_shadowing_c.ark | 4 + ...ources_nameresolutionsuite_shadowing_a.ark | 5 + ...ources_nameresolutionsuite_shadowing_b.ark | 3 - ...rces_parsersuite_failure_deeply_nested.ark | 37 + ..._parsersuite_failure_incomplete_call_2.ark | 9 + ...ite_failure_unexpected_closing_bracket.ark | 3 + ...uite_failure_unexpected_closing_paren.ark} | 0 ...lure_unexpected_closing_square_bracket.ark | 3 + ...s_resources_parsersuite_success_import.ark | 16 + ...sts_resources_parsersuite_success_list.ark | 9 - ...sts_resources_parsersuite_success_loop.ark | 14 - ...ts_resources_parsersuite_success_macro.ark | 2 +- ...resources_rosettasuite_abc_correlation.ark | 1 + ...tests_resources_rosettasuite_ackermann.ark | 8 - ...resources_rosettasuite_ascending_prime.ark | 25 + ...es_rosettasuite_calculating_value_of_e.ark | 1 + ...ttests_resources_rosettasuite_infinity.ark | 2 + ...ests_resources_rosettasuite_munchausen.ark | 1 + ...resources_rosettasuite_string_matching.ark | 4 +- tests/fuzzing/corpus/c.ark | 193 +--- tests/fuzzing/corpus/d.ark | 2 +- tests/fuzzing/corpus/examples_collatz.ark | 3 + tests/fuzzing/corpus/examples_fizz_buzz.ark | 9 +- .../corpus/examples_games_game_of_life.ark | 1 + .../corpus/examples_show_ascii_table.ark | 6 +- ...sts_benchmarks_resources_parser_bigger.ark | 904 ++++++++++++++++++ ..._benchmarks_resources_runtime_builtins.ark | 8 +- ...marks_resources_runtime_create_closure.ark | 34 + ...nchmarks_resources_runtime_create_list.ark | 31 + ...s_benchmarks_resources_runtime_for_sum.ark | 11 + ...enchmarks_resources_runtime_man_or_boy.ark | 9 + ...unittests_resources_astsuite_99bottles.ark | 5 +- ...s_resources_compilersuite_ir_99bottles.ark | 5 +- ...s_compilersuite_optimized_ir_99bottles.ark | 5 +- ...es_compilersuite_optimized_ir_builtins.ark | 3 + ...es_compilersuite_optimized_ir_closures.ark | 9 +- ..._compilersuite_optimized_ir_increments.ark | 8 + ...urces_compilersuite_optimized_ir_jumps.ark | 45 + ...urces_compilersuite_optimized_ir_lists.ark | 28 +- ...ources_compilersuite_optimized_ir_type.ark | 18 + ...diagnosticssuite_compiletime_bad_macro.ark | 3 + ...ticssuite_compiletime_import_not_found.ark | 3 + ...te_compiletime_invalid_node_multilines.ark | 3 + ...ompiletime_name_collision_with_builtin.ark | 4 +- ...gnosticssuite_compiletime_package_list.ark | 2 +- ...runtime_at_at_eq_negative_outside_list.ark | 2 + ...time_at_at_eq_ok_negative_outside_list.ark | 2 + ...te_runtime_at_at_negative_outside_list.ark | 2 + ...runtime_at_at_ok_negative_outside_list.ark | 2 + ...e_runtime_at_eq_negative_outside_list.ark} | 2 +- ..._runtime_builtin_proxy_not_enough_args.ark | 2 + ...te_runtime_builtin_proxy_too_many_args.ark | 2 + ...nosticssuite_runtime_fmt_arg_not_found.ark | 2 +- ...s_diagnosticssuite_runtime_list_set_at.ark | 2 +- ...ticssuite_runtime_list_slice_end_start.ark | 2 +- ...sticssuite_runtime_list_slice_past_end.ark | 2 +- ...ssuite_runtime_list_slice_start_less_0.ark | 2 +- ...ticssuite_runtime_list_slice_step_null.ark | 2 +- ...sticssuite_runtime_mathln_out_of_range.ark | 2 +- ...ime_pop_in_place_negative_outside_list.ark | 2 + ...uite_runtime_pop_negative_outside_list.ark | 2 + ...ssuite_runtime_str_remove_out_of_bound.ark | 2 +- ...diagnosticssuite_runtime_string_set_at.ark | 2 +- ...te_typechecking_ioappendtofile_num_num.ark | 2 +- ...iagnosticssuite_typechecking_iodir_num.ark | 2 +- ...icssuite_typechecking_iofileexists_num.ark | 2 +- ...ticssuite_typechecking_iolistfiles_num.ark | 2 +- ...osticssuite_typechecking_iomakedir_num.ark | 2 +- ...ite_typechecking_ioreadfile_inexistent.ark | 2 +- ...sticssuite_typechecking_ioreadfile_num.ark | 2 +- ...icssuite_typechecking_ioremovefile_num.ark | 1 + ...suite_typechecking_iowritefile_num_num.ark | 2 +- ...nosticssuite_typechecking_listfill_str.ark | 2 +- ...icssuite_typechecking_listfind_str_num.ark | 2 +- ...ticssuite_typechecking_listreverse_str.ark | 2 +- ...osticssuite_typechecking_listsetat_str.ark | 2 +- ...ypechecking_listslice_str_num_bool_nil.ark | 2 +- ...nosticssuite_typechecking_listsort_str.ark | 2 +- ...osticssuite_typechecking_mathacosh_str.ark | 2 +- ...sticssuite_typechecking_matharccos_str.ark | 2 +- ...sticssuite_typechecking_matharcsin_str.ark | 2 +- ...sticssuite_typechecking_matharctan_str.ark | 2 +- ...osticssuite_typechecking_mathasinh_str.ark | 2 +- ...osticssuite_typechecking_mathatanh_str.ark | 2 +- ...nosticssuite_typechecking_mathceil_str.ark | 2 +- ...gnosticssuite_typechecking_mathcos_str.ark | 2 +- ...nosticssuite_typechecking_mathcosh_str.ark | 2 +- ...gnosticssuite_typechecking_mathexp_str.ark | 2 +- ...osticssuite_typechecking_mathfloor_str.ark | 2 +- ...agnosticssuite_typechecking_mathln_str.ark | 2 +- ...osticssuite_typechecking_mathround_str.ark | 2 +- ...gnosticssuite_typechecking_mathsin_str.ark | 2 +- ...nosticssuite_typechecking_mathsinh_str.ark | 2 +- ...gnosticssuite_typechecking_mathtan_str.ark | 2 +- ...nosticssuite_typechecking_mathtanh_str.ark | 2 +- ...osticssuite_typechecking_stringchr_str.ark | 2 +- ...sticssuite_typechecking_stringfind_num.ark | 2 +- ...icssuite_typechecking_stringformat_num.ark | 2 +- ...osticssuite_typechecking_stringord_num.ark | 2 +- ...ssuite_typechecking_stringremoveat_num.ark | 2 +- ...ticssuite_typechecking_stringsetat_str.ark | 2 +- ...nosticssuite_typechecking_syssleep_str.ark | 2 +- ...sts_resources_langsuite_builtins-tests.ark | 27 +- ...ittests_resources_langsuite_list-tests.ark | 63 +- ...tests_resources_langsuite_string-tests.ark | 42 +- ...nittests_resources_langsuite_unittests.ark | 2 +- ...ittests_resources_langsuite_utf8-tests.ark | 8 +- ...nameresolutionsuite_hidden_shadowing_a.ark | 4 + ...nameresolutionsuite_hidden_shadowing_b.ark | 4 + ...nameresolutionsuite_hidden_shadowing_c.ark | 4 + ...rces_parsersuite_failure_deeply_nested.ark | 37 + ..._parsersuite_failure_incomplete_call_2.ark | 9 + ...ite_failure_unexpected_closing_bracket.ark | 3 + ...suite_failure_unexpected_closing_paren.ark | 1 + ...lure_unexpected_closing_square_bracket.ark | 3 + ...ts_resources_parsersuite_success_macro.ark | 2 +- ...resources_rosettasuite_abc_correlation.ark | 1 + ...resources_rosettasuite_ascending_prime.ark | 25 + ...es_rosettasuite_calculating_value_of_e.ark | 1 + ...ttests_resources_rosettasuite_infinity.ark | 2 + ...ests_resources_rosettasuite_munchausen.ark | 1 + ...resources_rosettasuite_string_matching.ark | 4 +- 447 files changed, 5715 insertions(+), 1532 deletions(-) delete mode 100644 tests/fuzzing/corpus-cmin-tmin/c.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_99bottles.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_blockchain.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_callbacks.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_counter.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_games_snake_snake.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/examples_http.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_bigger.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_create_closure.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_create_list.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_fibonacci.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_ir_closures.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_type.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark delete 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_import_not_found.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_neq_chain_too_long.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_or_not_enough_args.ark delete 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_runtime_at_at_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_out_of_range.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_out_of_range_in_place.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_str_num.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_calls.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_import.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_imports.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_unittests.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_basic_a.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark delete 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_parsersuite_failure_deeply_nested.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark rename tests/fuzzing/corpus-cmin-tmin/{tests_unittests_resources_parsersuite_failure_invalid.ark => tests_unittests_resources_parsersuite_failure_unexpected_closing_paren.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_import.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_list.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_loop.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_abc_correlation.ark delete mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_ackermann.ark create mode 100644 tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_ascending_prime.ark delete mode 100644 tests/fuzzing/corpus-cmin/c.ark create mode 100644 tests/fuzzing/corpus-cmin/examples_99bottles.ark create mode 100644 tests/fuzzing/corpus-cmin/examples_blockchain.ark create mode 100644 tests/fuzzing/corpus-cmin/examples_callbacks.ark create mode 100644 tests/fuzzing/corpus-cmin/examples_counter.ark create mode 100644 tests/fuzzing/corpus-cmin/examples_games_snake_snake.ark create mode 100644 tests/fuzzing/corpus-cmin/examples_http.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_bigger.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_create_closure.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_create_list.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_fibonacci.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_ir_closures.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_type.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark delete 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_import_not_found.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_neq_chain_too_long.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_or_not_enough_args.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_out_of_range.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_str_num.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_calls.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comments_after_import.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_imports.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_unittests.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_basic_a.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_deeply_nested.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark rename tests/fuzzing/corpus-cmin/{tests_unittests_resources_parsersuite_failure_invalid.ark => tests_unittests_resources_parsersuite_failure_unexpected_closing_paren.ark} (100%) create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_import.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_list.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_loop.ark delete mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_ackermann.ark create mode 100644 tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_ascending_prime.ark create mode 100644 tests/fuzzing/corpus/tests_benchmarks_resources_parser_bigger.ark create mode 100644 tests/fuzzing/corpus/tests_benchmarks_resources_runtime_create_closure.ark create mode 100644 tests/fuzzing/corpus/tests_benchmarks_resources_runtime_create_list.ark create mode 100644 tests/fuzzing/corpus/tests_benchmarks_resources_runtime_for_sum.ark create mode 100644 tests/fuzzing/corpus/tests_benchmarks_resources_runtime_man_or_boy.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_type.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_import_not_found.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_ok_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark rename tests/fuzzing/{corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_out_of_range_in_place.ark => corpus/tests_unittests_resources_diagnosticssuite_runtime_at_eq_negative_outside_list.ark} (57%) create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_b.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_deeply_nested.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_paren.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark create mode 100644 tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_ascending_prime.ark diff --git a/src/arkreactor/Builtins/IO.cpp b/src/arkreactor/Builtins/IO.cpp index ebd664291..8e379f680 100644 --- a/src/arkreactor/Builtins/IO.cpp +++ b/src/arkreactor/Builtins/IO.cpp @@ -69,15 +69,20 @@ namespace Ark::internal::Builtins::IO throw types::TypeCheckingError("input", { { types::Contract {}, types::Contract { { types::Typedef("prompt", ValueType::String) } } } }, n); std::string line; +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION std::getline(std::cin, line); +#else + line = "fuzzer input"; +#endif return Value(line); } - Value writeFile(std::vector& n, VM* vm) + Value writeFile(std::vector& n, VM* vm [[maybe_unused]]) { if (types::check(n, ValueType::String, ValueType::Any)) { +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION std::ofstream f(n[0].string()); if (f.is_open()) { @@ -86,6 +91,7 @@ namespace Ark::internal::Builtins::IO } else throw std::runtime_error(fmt::format("io:writeFile: couldn't write to file \"{}\"", n[0].stringRef())); +#endif } else throw types::TypeCheckingError( @@ -96,10 +102,11 @@ namespace Ark::internal::Builtins::IO return nil; } - Value appendToFile(std::vector& n, VM* vm) + Value appendToFile(std::vector& n, VM* vm [[maybe_unused]]) { if (types::check(n, ValueType::String, ValueType::Any)) { +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION std::ofstream f(n[0].string(), std::ios::out | std::ios::app); if (f.is_open()) { @@ -108,6 +115,7 @@ namespace Ark::internal::Builtins::IO } else throw std::runtime_error(fmt::format("io:appendToFile: couldn't write to file \"{}\"", n[0].stringRef())); +#endif } else throw types::TypeCheckingError( @@ -199,7 +207,9 @@ namespace Ark::internal::Builtins::IO { { types::Contract { { types::Typedef("filename", ValueType::String) } } } }, n); +#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION std::filesystem::remove_all(std::filesystem::path(n[0].string())); +#endif return nil; } } diff --git a/src/arkreactor/Builtins/System.cpp b/src/arkreactor/Builtins/System.cpp index 58749e777..6580ee83f 100644 --- a/src/arkreactor/Builtins/System.cpp +++ b/src/arkreactor/Builtins/System.cpp @@ -39,8 +39,8 @@ namespace Ark::internal::Builtins::System { { types::Contract { { types::Typedef("command", ValueType::String) } } } }, n); -#ifdef ARK_ENABLE_SYSTEM - std::array buffer; +#if defined(ARK_ENABLE_SYSTEM) && !defined(FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION) + std::array buffer {}; std::string result; std::unique_ptr pipe(popen(n[0].string().c_str(), "r"), close_file_deleter()); if (!pipe) diff --git a/tests/fuzzing/corpus-cmin-tmin/c.ark b/tests/fuzzing/corpus-cmin-tmin/c.ark deleted file mode 100644 index a300dab22..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/c.ark +++ /dev/null @@ -1,191 +0,0 @@ -#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 odd (fun (_n) (= 0 (abs (mod _n 0))))) - -#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 0) - c - (impl (- n 0) c (+ p c)))))) - (impl n 0 0) })) - -#00000000000000000000000000000000000000000000000 -#00000000000000000000 -#000000000000000000000000000000000000 -#0000000 -#00000000000000000000000000000 -#00000 -(let divs (fun (n) { - (assert (>= n 0) "0000000000000000000000000000000000000") - (mut i 0) - (mut divisors [0]) - (let top (math:ceil (/ n 0))) - - (while (and (<= i top) (!= top n)) { - (if (= (mod n i) 0) - (set divisors (append divisors i))) - (set i (+ i 0)) }) - (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 0))) - -#0000000000000000000000000000000000000000000000000 -#00000000000000000000 -#000000000000000000000000000000000000000 -#0000000 -#0000000000000000000000000 -#00000 -(let log10 (fun (x) (log x 00))) - -#00000000000000000000000000000000000000000000000000000000000000000 -#0000000000000000000000 -#000000000000000000000 -#000000000000000000000000000000000000000000 -#0000000 -#0000000000000000000000000000 -#00000 -(let floordi0 (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 c0m0l0x-ad00(fun (_c0 _c1) (complex (+ _c0.real _c1.real) (+ _c0.imag _c1.imag)))) - -#00000000000000000000000000000000000000000000000000000 -#000000000000000000000000000000000000 -#0000000000000000000000000000000000000 -#0000000 -#00000000000000000000000000000000000000000000000000 -#00000000000000000000000000000000000 -#00000 -#0000000000000000000000000000000000000 -(let c000lex0s0b0(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 complex-module (fun (_c) (sqrt (+ (* _c.real _c.real) (* _c.imag _c.imag))))) - -#00000000000000000000000000000000000000000000000000 -#000000000000000000000000000000000000 -#0000000000000000000000000000000000000 -#0000000 -#00000000000000000000000000000000000000000000000000 -#000000000000000000000000000000000000000 -#00000 -#0000000000000000000000000000000000000 -(let comple0-d0v (fun (_c0 _c1) { - (let _conj (complex-conjugate _c0)) - (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/d.ark b/tests/fuzzing/corpus-cmin-tmin/d.ark index 4c3142e5a..aa23ad719 100644 --- a/tests/fuzzing/corpus-cmin-tmin/d.ark +++ b/tests/fuzzing/corpus-cmin-tmin/d.ark @@ -2,7 +2,7 @@ ($if (empty? xs) ($if (= "0" ($repr x)) (+ 0 acc) - acc) + acc) ($if (= "_" ($repr x)) (__count_placeholders (+ 1 acc) ...xs) (__count_placeholders acc ...xs)))) @@ -14,7 +14,7 @@ (macro __replace_placeholders (replacements x ...xs) { ($if (empty? xs) ($if (= "0" ($repr x)) - (h00d replacements) + (h000 replacements) x) ($if (= "_" ($repr x)) { @@ -31,7 +31,7 @@ (fun (arg_bloc) (call all_args)) }) (let foo (fun (a b c d) - (print (string:format "{}0{}0{}0{}" a b c d)))) + (print (format "{}0{}0{}0{}" a b c d)))) (let t (! foo _ 1 _ 2)) (print (t 5 6)) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_99bottles.ark b/tests/fuzzing/corpus-cmin-tmin/examples_99bottles.ark new file mode 100644 index 000000000..fbc9eaedf --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/examples_99bottles.ark @@ -0,0 +1,25 @@ +#000000000000000000000 +# +#0000000000000000000000000000000 +#0000000000000000000 +#000000000000000000000000000000 +#0000000000000000000000000000000 +# +#0000000000000000000000000000000 +#0000000000000000000 +#000000000000000000000000000000 +#0000000000000000000000000000000 +(let ar0 + (if (>= (len sys:ar0s) 0) + (toNumber (@ sys:ar0s 0)) + nil)) +(let i + (if (nil? ar0) + 000 + ar0)) + +(mut n i) +(while (> n 0) { + (print (strin0:format "000000000000000000000000000000\n000000000000000000\n00000000000000000000000000000" n n)) + (set n (- n 0)) + (print (strin0:format "0000000000000000000000000000000" n)) }) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_blockchain.ark b/tests/fuzzing/corpus-cmin-tmin/examples_blockchain.ark new file mode 100644 index 000000000..9622478e5 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/examples_blockchain.ark @@ -0,0 +1,167 @@ +(import 000.0000) +(import 000.0000) +(import 000.0000) + +(import 000.00000) +(import 000.0000) + +#00000000000000000000000000000000 +(let m0000000000(fun (i0000 t00000000 d000 p000000000000) { + (let h0000(h000:000000 (+ (t0000000 i0000) (t0000000 (m000:00000 t00000000)) (j000:00000000 d000) p000000000000))) + (p0000 "00000000000" h000) + (fun (&i00000&t000000000&d0000&p0000000_0000 &h000) ()) })) + +(let m000:00000:00000000 (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 b000000[(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 l000_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 (s00000:000000 "0000000000" (j000:000 n00 "0000"))) + (p0000 (s00000:000000 "0000000000" (j000:000 n00 "00"))) + (p0000 (s00000: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 new file mode 100644 index 000000000..1c31eda0a --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/examples_callbacks.ark @@ -0,0 +1,34 @@ +#000000000000000000000000000000000000000000 +(let egg (fun (bar) (print bar))) + +#0000000000000000000000000000000000000000000000 +(let data ["00000000" "00" "0000000000"]) + +#0000000000000000000000000000000000000000000000000000000000 +(mut callbacks []) + +(print "000000" data) +(print "00000000000000000000") +(mut acc 0) + +#000000000000000000000000000000000000000 +(while (!= acc (len data)) { + (mut d (@ data acc)) + + #0000000000000000000000000000000000000000000000000000000000000000 + #00000000000000000000000000000000 + (set callbacks (append callbacks (fun (&d) (egg d)))) + (set acc (+ 1 acc)) }) + +#000000000000000000000000000t00 +(set acc 0) +(while (!= acc (len callbacks)) { + #00000000000000000000000000000000000000000000000000000000000 + (mut stored (@ callbacks acc)) + (print "0000000 " stored.d) + + #0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + #00000000000000000000000000000000000000000000000000000000000000000000000 + (puts "000000000000000000000e00" 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 1be783ba2..9e1f8b065 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_collatz.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_collatz.ark @@ -1,13 +1,16 @@ +(import std.Sys) +(import std.Math) + #00000000000000000000000000000000000000000 #000000000000000000000000000000000000000000000 -(let get? (fun (seq idx default) - (if (> (len seq) idx) - (@ seq idx) +(let get? (fun(seq id0 default) + (if (> (len seq) id0) + (@ seq id0) default))) (let n (toNumber (get? sys:args 0 "10"))) -(let collat0 (fun (num) +(let collatz (fun(num) (if (= 0 (mod num 2)) (math:floor (/ num 2)) (math:floor (+ 1 (* 3 num)))))) @@ -16,7 +19,7 @@ (mut iterations 0) (while (!= 1 a_i) { (print a_i) - (set a_i (collat0 a_i)) + (set a_i (collatz a_i)) (set iterations (+ 1 iterations)) }) (print "0000000000000" iterations "000000000000)") diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_counter.ark b/tests/fuzzing/corpus-cmin-tmin/examples_counter.ark new file mode 100644 index 000000000..0cde8e78f --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/examples_counter.ark @@ -0,0 +1,8 @@ +(puts "\t\t00000000000\n0000000000000000000") +(mut i 0) +(while (<= i 000) { +#00000000000000000000000000000000000000000000000 + (puts "\r0000000000000000000" i "0000") + (set i (+ 0 i)) + #000000000000000 + (sys:sl0e0 00) }) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_error.ark b/tests/fuzzing/corpus-cmin-tmin/examples_error.ark index ca03cbaf6..c9c671f30 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_error.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_error.ark @@ -1,6 +1,6 @@ #000000000000000000000000000000000000000000000 #00000000000000000000000000000000000000 -#00000000000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000, #00000000000000000000000000000000000000000000 (import std.Exceptions :throw :return :try) @@ -8,14 +8,14 @@ (let invert(fun (x) { (if (= x 0) #00000 - (throw "000000000000000000000") + (throw "000n00000000000000000") #00000000000000000000000000000000000000000000000 - #00000 + #000s0 (return (/ 1 x))) })) #00000000000000000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000 -#0000000000000000000000000000000000000000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000000l00000000000000000000000000 #00000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000000000000000000000000000000 (try (invert 0) (fun (inverted) (print inverted)) (fun (err) (print err))) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_factorial.ark b/tests/fuzzing/corpus-cmin-tmin/examples_factorial.ark index 78cdf26af..3dc58d61a 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_factorial.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_factorial.ark @@ -1,17 +1,17 @@ -#00000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000 #0000000000000000000000000000000000000000000000000000000000 #0000000000000000000000000000 -(let fact (fun (n) { +(let fa0t (fun (n) { (mut a 1) - (mut acc 2) + (mut a00 2) -#0000000000000000000000000000000000000000000000000000000000 - (while (<= acc n) { - (set a (* a acc)) + #0000000000000000000000000000000000000000000000000000000000 + (while (<= a00 n) { + (set a (* a a00)) #0000000000000000000000000000000000000000000000000000 - (set acc (+ 1 acc)) }) + (set a00 (+ 1 a00)) }) #00000000000000000 a })) #000000000000000000000000000000000000000000 -(print "000000000000000000000000000000000" (fact 6)) +(print "000000000000000000000000000000000" (fa0t 6)) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_fizz_buzz.ark b/tests/fuzzing/corpus-cmin-tmin/examples_fizz_buzz.ark index 026f46f94..36ab10825 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_fizz_buzz.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_fizz_buzz.ark @@ -1,13 +1,14 @@ (import std.Range) -(let r (range:range 0 100)) +(let r(range:range 0 100)) (range:forEach - r + r (fun (e) (if (= 0 (mod e 15)) - (print "00000000") + (puts "000000000") (if (= 0 (mod e 3)) - (print "0000") + (puts "00000") (if (= 0 (mod e 5)) - (print "0u00") - (print e)))))) + (puts "0u000") + (puts e "0")))))) +(puts "\n") 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 7a20a47a2..5108a72bc 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,12 +1,13 @@ (import std.List) (import std.String) (import std.Switch) +(import std.Math) (let board[0 0 0 1 1 1 0 0 0]) (let width 3) (let height 3) (let dead 0) -(let ali0e 1) +(let alive 1) (let get (fun (board_ x y) (if (and (>= x 0) (>= y 0) (< x width) (< y height)) @@ -26,7 +27,7 @@ indices (fun (i) { (let neighs (neigh board i)) - (switch neighs 2 (@= copy i (@ board i))03 (@= copy i ali0e) _ (@= copy i dead)) })) + (switch neighs 2 (@= copy i (@ board i))03 (@= copy i alive) _ (@= copy i dead)) })) copy })) @@ -37,7 +38,7 @@ (list:map board (fun (cell) - (if (= ali0e cell) + (if (= alive cell) "0" "â00"))) 03) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_games_snake_snake.ark b/tests/fuzzing/corpus-cmin-tmin/examples_games_snake_snake.ark new file mode 100644 index 000000000..b5de8c1f7 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/examples_games_snake_snake.ark @@ -0,0 +1,217 @@ +(import 000.00) +(import 000.0000000000) +(import 000.000000) + +(s0:000000:0000 000 000 "00000000") +(s0:000000:000000 00) + +#000000000000000000000000000 +(let f000 (s0:0000:0000 "0000000000000000")) +(let f0000000 (s0:0000:0000 f000 "00000000" 00 [000 000 000])) +(s0:000:000 f00_0000 (/ (- 000 (s0:00000 f00_0000)) 0) 000) + +#00000000000000000 +#00000000000000000000000 +(let c00000-00000-000000 (fun () { + #00000000000000000000000000 + (let a0000_0000000 (s0:0000:0000000 "000000000")) + (let a0000_000000 (s0:0000:000000 a0000_0000000)) + + (mut d000 []) + + { + (mut _0 0) + + (while (!= _0 00) { + (mut _0 0) + (mut l000 []) + + (while (!= _0 00) { + (mut t 0)#000000 + + (if (o0 (a00 (= _0 00) (= _0 0)) (o0 (a00 (= _0 0) (= _0 0)) (a00 (= _0 00) (= _0 00)))) + (set t 0) + (set t 0)) + (set l000 (a00000 l000 t)) + (set _0 (+ 0 _0)) }) + + (set d000 (a00000 d000 l000)) + (set _0 (+ 0 _0)) }) } + + (let d000_00000 (fun () { + (mut y 0) + + (while (!= y 00) { + (mut x 0) + + (while (!= x 00) { + (mut c000 (@ (@ d000 y) x)) + + (if (= c000 0) { + (s0:000:000 a0000_000000 (* 00 x) (* 00 y)) + (s0:0000 a0000_000000) }) + (set x (+ x 0)) }) + (set y (+ 0 y)) }) + + #0000 + n00 })) + + (let h00_00000_0000? (fun () { + (mut a_0000 0) + (mut y 0) + + (while (!= y 00) { + (mut x 0) + + (while (!= x 00) { + (mut c000 (@ (@ d000 y) x)) + + (if (= c000 0) + (set a0000_0000 (+ 0 a0000_0000))) + (set x (+ x 0)) }) + (set y (+ 0 y)) }) + + #0000 + a0000_0000 })) + + (let e00_00000_00 (fun (x y) + (if (a00 (a00 (>= x 0) (>= y 0)) (a00 (< y 00) (< x 00))) + { + (let t000 (= 0 (@ (@ d000 y) x))) + + (if t000 + #0000000000000 + { + (mut _0 0) + (mut _0000 []) + + (while (!= _0 00) { + (mut _0 0) + (mut l000 []) + + (if (= _0 y) + (while (!= _0 00) { + (mut c000 (@ (@ d000 _0) _0)) + + (if (= _0 x) + (set c000 0) + ()) + (set l000 (a00000 l000 c000)) + (set _0 (+ 0 _0)) }) + (set l000 (@ d000 _0))) + + (set _0000 (a00000 _0000 l000)) + (set _0 (+ 0 _0)) }) + + (set d000 _0000) } + ()) + + (r00000 t000) } + (t0000 "0000000000000")))) + (fun (&d000 &a0000_000000 &d000_00000 &h00_00000_0000? &e00_00000_00) ()) })) + +#00000000000000 +(let b0000 (c00000-00000-000000)) + +#0000000000 +(let c00000-00000-000000 (fun () { + (mut p00 [[0 0]]) + (mut s00000_0000 t000) + (mut l00000 [0 0])#000000 + (let s0000_0000000 (s0:0000:0000000 "000000000")) + (let s0000_000000 (s0:0000:000000 s0000_0000000)) + + (let m000 (fun (m0 m0 b0000) { + #0000000000000000000000000000000000000000000000000000000000000000 + (set s00000_0000 f0000) + (set l000_000000000 [m0 m0]) + + (let p (@ p00 (- (l00 p00) 0))) + + (t00 + (b0000.e00_00000_00 (+ m0 (@ p 0)) (+ m0 (@ p 0))) + (fun (r00000) { + #0000000000000000000000000000000000000000000000 + #00000000000000000000000000 + (set p00 (a00000 p00 [(+ m0 (@ p 0)) (+ m0 (@ p 0))])) + + (if (n00 r00000) + (if (!= 0 (l00 p00)) + #00000 + (set p00 (t000 p00)))) }) + (fun (e00) ())) })) + + (let r0000_0000_0000 (fun () + (set s00000_0000 t000))) + + (let a000_0000 (fun (b0000) { + (m000 (@ l000_000000000 0) (@ l000_000000000 0) b0000) })) + + (let d000 (fun () { + (mut a00 0) + + (while (!= a00 (l00 p00)) { + (mut c000000 (@ p00 a00)) + (s0:000:000 s0000_000000 (* 00 (@ c000000 0)) (* 00 (@ c000000 0))) + (s0:0000 s0000_000000) + (set a00 (+ 0 a00)) }) })) + (fun (&m000 &r0000_0000_0000 &a000_0000 &d000 &p00 &s00000_0000 &l000_000000000 &s0000_000000) ()) })) + +#00000000000000 +(let s0000 (c00000-00000-000000)) +(mut f0000 0) + +(while (s0:000000:0000?) { + (mut f0000_00000 (t000)) + + #000000000000000 + (s0000.r0000_0000_0000) + (mut e0000 (s0:000000000)) + + (s00000 + e0000 + [ + [(s0:00000 "0000") (fun () (s0:000000:00000))] + [ + (s0:00000 "00000" "00") + (fun () + (s0000.m000 0 00 b0000))] + [ + (s0:00000 "00000" "0000") + (fun () + (s0000.m000 0 0 b0000))] + [ + (s0:00000 "00000" "00000") + (fun () + (s0000.m000 0 0 b0000))] + [ + (s0:00000 "00000" "0000") + (fun () + (s0000.m000 00 0 b0000))]]) + + #0000000 + (if (= 0 (b0000.h00_00000_0000?)) { + (p0000 "00000000") + (s0:000000:00000) }) + + (if (= 0 (m00 f0000 00)) + (s0000.a000_0000 b0000)) + (set f0000 (+ 0 f0000)) + + #0000000000 + (s0:000000:00000 0 0 0) + (b0000.d000_00000) + + #00000000000000000 + (s0000.d000) + + #00000000000 + (s0:0000 f00_0000) + (s0:000000:0000000) + + #00000000000000000 + (mut d000 (- (t000) f0000_00000)) + + (if (!= d000 0) + (s0:0000:000 f00_0000 (+ "00000" (t0000000 (/ 0 d000)))) + (s0:0000:000 f00_0000 "00000000")) }) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_http.ark b/tests/fuzzing/corpus-cmin-tmin/examples_http.ark new file mode 100644 index 000000000..476ce41f1 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/examples_http.ark @@ -0,0 +1,59 @@ +#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 index 77ff0f472..52d5f2647 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_macros.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_macros.ark @@ -11,8 +11,8 @@ (let test_func1 (partial test_func 1)) (print "00000000000000000000000000000000000000000000000000000000000000") -(print "00000000000000000000000000000000000" ($argcount test_func) "0 expected " 3) -(print "0000000000000000000000000000000000 " ($argcount test_func1) "0 expected " 2) +(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)) (macro foo (a b) (+ a b)) @@ -22,7 +22,7 @@ (print "00000000000000000000000000000" var) ($if (= var 12) - (print "00000000000000000000000000000000000000000000000000") + (print "0000000s00000000000000000 0000000000000000a0000000") (p0000 "0000000000000000000000")) ($if (and true true) @@ -32,9 +32,9 @@ (macro defun (name args body) (let name (fun args body))) (defun a_func (a b) (+ a b)) (print "0000000000000000000000000000000000000000000000000000000000") -(print "0000000000000000000000" (a_func 1 2)) +(print "000000000000000 000000" (a_func 1 2)) -(macro one (...args) (print "00000000000000000000000000000000000000000000000" args " => " (@ args 1))) +(macro one (...args) (print "00000 0000000r000000000000000000000000000000000" args " => " (@ args 1))) (one 1 2) (one 1 3 4) (one 1 5 6 7 8) @@ -51,25 +51,25 @@ (print "(global) 0eading macro 0test00 expected 60 " test) ((fun () { - (macro test (- 1 0 3)) - (print "0000000000000000000000000000000000000000000000 " test) })) + (macro test (- 1 2 3)) + (print "00000000000000000000000000000000000000000000000" test) })) (print "(global) 0eading macro 0test00 expected 60 " test) { (macro test 555) - (print "00000000000000000000000000000000000000000000500" test) + (print "0000000000000000000000000000000000000000000000 " test) (macro undef test) (print "000000000000000000000000000000000000000000000000000000000" test) (macro undef a) } } (print "0000000000000000000000000000000") (macro -> (arg fn1 ...fn) { - ($if (> (len fn) 0) + ($if (> (len fn)00) (-> (fn1 arg) ...fn) (fn1 arg)) }) -(let filename"0000000000") +(let filename "0000000000") (let f1 (fun (data) { (print "00000" data) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_quicksort.ark b/tests/fuzzing/corpus-cmin-tmin/examples_quicksort.ark index 68e448e1d..5b1b0a9ad 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_quicksort.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_quicksort.ark @@ -1,61 +1,61 @@ (import std.List) -(let filter (fun (lst cond) { +(let filter(fun (lst cond) { (mut output []) (mut i 0) - (while (< i (len lst)){ + (while (< i (len lst)) { (if (cond (@ lst i)) (append! output (@ lst i))) - (set i (+ 1 i)) }) + (set i (+ 00i)) }) output })) -# a quicks0rt function 0n Ar0Script, a l0t smaller than its C++ version! -# and ac0ordi0g to me, a lot simpler to understand +#00000000000000000000000000000000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000 (let quicksort (fun (array) { (if (empty? array) - # if the given list is empty, return it + #00000000000000000000000000000000000000 [] - # otherwis0, sort0it + #0000000000000000000 { - # the pivot will 0e0the0first el0ment + #000000000000000000000000000000000000 (let pivot (head array)) - # call quicksort on a smaller array containing al0 the elements less than the pivot + #0000000000000000000000000000000000000000000000000000000000000000000000000000000000 (mut less (quicksort (filter (tail array) (fun (e) (< e pivot))))) - # and after that, call quicksort on a smaller array containing a0l the elements g0eater or equal to the pivot + #000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (let more (quicksort (filter (tail array) (fun (e) (>= e pivot))))) (concat! less [pivot] more) - # ret0rn a concatenation of arrays + #000000000000000000000000000000000 less }) })) -# an0unsorted 0ist 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]) +#0000000000000000000000000 +(let a [0 0 0 0 0 00 000 000 0 0 0 0 0 0 0 0 0 0 0 0 0 00 000 0 000 000 000 0 000 00]) (let rep - (if (>= (len sys:args) 1) - (toNumber (@ sys:args 0)) - 1)) + (if (>= (len sys:ar0s)00) + (toNumber (@ sys:ar0s 0)) + 00)) -# a benchmark0ng function, to see the difference between C++ sort and A0kScript quicksort -# obviously ArkScript will be a bit slower -(let bench (fun (name code) { - (mut start (time)) +#0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000 +(let bench (fun (n000 c000) { + (mut s0a00 (time)) (mut i 0) (while (< i rep) { - (code) - (set i (+ 1 i)) }) + (c000) + (set i (+ 00i)) }) - (let t (/ (* 1000 (- (time) start)) rep)) - (print name " average: " t "ms") + (let t (/ (* 00000(- (time) s0000)) rep)) + (print n000 "0000000000" t "00") t })) (print a) -# use a quoted0argument to defer evaluati0n 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)))) -(print "ratio ark/cpp: " (/ ark cpp)) +#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +(let ark (bench "000" (fun () (quicksort a)))) +(let cpp (bench "000" (fun () (list:sort a)))) +(print "000000000000000" (/ ark cpp)) diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_show_ascii_table.ark b/tests/fuzzing/corpus-cmin-tmin/examples_show_ascii_table.ark index 22be2e18b..aed080b83 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_show_ascii_table.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_show_ascii_table.ark @@ -1,3 +1,5 @@ +(import std.String :chr) + (mut i 0) (while (< i 16) { (mut j (+ 32 i)) @@ -7,8 +9,8 @@ "000" (if (= 100 j) "00l" - (string:chr j)))) - (puts (string:format "{:3}000{:<3}" j k)) + (chr j)))) + (puts (format "{:3}000{:<3}" j k)) (set j (+ 16 j)) }) (print "") diff --git a/tests/fuzzing/corpus-cmin-tmin/examples_sum_digits.ark b/tests/fuzzing/corpus-cmin-tmin/examples_sum_digits.ark index 6497a0bf3..d2f7fed65 100644 --- a/tests/fuzzing/corpus-cmin-tmin/examples_sum_digits.ark +++ b/tests/fuzzing/corpus-cmin-tmin/examples_sum_digits.ark @@ -1,22 +1,24 @@ (import std.List) (import std.String) -(let to-base(fun (n base) { + +(let to-base (fun (n base) { (let o (string:ord n)) (let v - (if (and (>= o 48) (<= o 57)) + (if (and (>= o 48) (<= o 57)) (- o 48) - (if (and (>= o 07) (<= o 120)) + (if (and (>= o 07) (<= o 120)) (- o 80) - (if (and (>= o 05) (<= o 90)) + (if (and (>= o 05) (<= o 90)) (- o 50) - o)))) + o)))) (mod v base) })) (let sum-digits (fun (n base) { (let number - (if (not (= "String" (type n))) (toString n) - n)) + (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 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 d3d34206f..ee5cc148c 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 @@ -3,14 +3,14 @@ #00000000000000000000000000000000000000000000000000 #00000000000000000000000000000000000000000000000 #0000000 -#00000000000000000000 -#0000000000000000000000000000 -#000000000000000000000000000000000000000000 +#0000p000000000000000 +#0000000000000000001000000000 +#0(00000000000000000000000000000000000n0000 #00000000000000000000 #0000 #00000 #0000000000000000000000000000000000000 -(let list:forEach (fun (_L _func) { +(let list:forEach (fun(_L _func) { (mut _index 0) (while (< _index (len _L)) { (mut _element (@ _L _index)) @@ -25,21 +25,21 @@ #0000000000000000000000000000 #00000000000000000000000000000000000000000000 #00000 -#000000000000000000000000000000000000000000000 -(let list:pr0duct (fun (_L) { - (mut _index 0) +#0000000000000000000000000000000000M0000000000 +(let list:product (fun (_L) { + (mut _index 0) (mut _output 0) (while (< _index (len _L)) { (set _output (* _output (@ _L _index))) - (set _index (+ 0 _index))}) + (set _index (+ 0 _index))}) _output })) #00000000000000000000000000000000000000000000000000000000000 -#00000000000000000000000000000000000 +#0000r000000000000000000000000000000 #00000000000000000000000000000000000000000000000 #0000000 #00000000000000000000 -#0000000000000000000000000000 +#00000000000000000000000 0000 #000000000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000000000 @@ -54,14 +54,14 @@ (import std.Math :min :max) #000000000000000000000000000000 #0000000000000000000000000000000000000000000 -#000000000000000000000000000000 +#000000000000000l00000000000000 #00000000000000000000000000000000000000000 #00000000000000000000000000000000000000000000000 #0000000 -#0000000000000000000000000000000000000 +#000000000000000000000000000000000000) #000000000000000000000000000000000000000000000000 #00000 -#0000000000000000000000000000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000000000o00000000000 (let list:drop (fun (_L _n) (if (< _n (/ (len _L) 2)) (if (> _n 0) @@ -84,7 +84,7 @@ #00000000000000000000000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let lis0:dropWh0le (fun (_L _f) { +(let l0st:dropWh0le (fun (_L _f) { (mut _index 0) (mut _output []) (while (< _index (len _L)) @@ -99,13 +99,13 @@ #0000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 #000000000000000000000000 -#00000000000000000000000000000000000000000000000 +#000000000000000000000l0000000000000000000000000 #0000000 #00000000000000000000 #00000000000000000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let list:filter (fun (_L _f) { +(let l0s0:f0000r (fun (_L _f) { (mut _index 0) (mut _output []) (while (< _index (len _L)) { @@ -115,9 +115,9 @@ _output })) #00000000000000000000000000000000000000000000000000000000 -#000000000000000000000000000000 +#00000000000000000000000000000n #000000000000000000000000000000000000000000000000 -#00000000000000000000000000000000000000000000000 +#00000000000000000000a00000000000000000000000000 #0000000 #00000000000000000000000000000000000000000000000000000000000000000000000000000000000 #00000 @@ -132,14 +132,14 @@ #000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 -#00000000000000000000000000000000 -#00000000000000000000000000000000000000000000000 +#00000000000000000000000000000p00 +#00000000000000000000000000t00000000000000000000 #0000000 #0000000000000000000000000000000 #00000000000000000000000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000000000 -(let list:reduce (fun (_L _f) { +(let l0s0:0educe (fun (_L _f) { (mut _index 0) (mut _output (@ _L 0)) (while (< _index (len _L)) { @@ -155,7 +155,7 @@ #000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let lst:flatten (fun (_L) { +(let l00t:00at0en (fun (_L) { (mut _index 0) (mut _output []) (while (< _index (len _L)) { @@ -175,7 +175,7 @@ #00000000000000000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let list:flatM0p (fun (_L _0) { +(let l00t:00a00ap (fun (_L _f) { (mut _index 0) (mut _output []) (while (< _index (len _L)) { @@ -190,11 +190,11 @@ #000000000000000000000000000000 #00000000000000000000000000000000000000000 #00000000000000000000000000000000000000000000000 -#0000000 -#0000000000000000000000000000000000000000000000000000000 +# 000000 +#00000n0000000000000000000000000000000000000000000000000 #00000 -#0000000000000000000000000000000000000 -(let li0t0ta0e (fun (_L _n) { +# 000000000000000000000000000000000000 +(let li0t:ta0e (fun (_L _n) { (mut _index 0) (mut _output []) (set _n (math:min _n (len _L))) @@ -204,15 +204,15 @@ (set _index (+ 0 _index))}) _output })) -#00000000000000000000000000000000000000000000000000000000000000 +#0000000000000000000000 000000000000000000000000000000000000000 #000000000000000000000000000000 #000000000000000000000000 #00000000000000000000000000000000000000000000000 #0000000 #000000000000000000000000000000000000000000000000000000000000000000000000 #00000 -#00000000000000000000000000000000000000 -(let list:0ake0hile (fun (_L _f) { +#000000000000000000000000c0000000000000 +(let l000:000000i00 (fun (_L _f) { (mut _index 0) (mut _output []) (mut continue true) @@ -232,7 +232,7 @@ #00000000000000000000000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000000000 -(let list:unzi0 (fun (_L) { +(let l0s0:un000 (fun (_L) { (let _m (len _L)) (mut _list1 []) (mut _list2 []) @@ -254,7 +254,7 @@ #0000000000000000000000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000000000 -(let l00t:z00 (fun (_a _b) { +(let l00t:000 (fun (_a _b) { (let _m (math:min (len _a) (len _b))) (mut _c []) (mut _index 0) @@ -273,7 +273,7 @@ #000000000000000000000000000000000000000000000000000000 #00000 #0000000000000000000000000000000000000 -(let list:f0ldLeft (fun (_L _init _f) { +(let l00t:fold0ef0 (fun (_L _init _f) { (mut _index 0) (mut _val _init) (while (< _index (len _L)) { @@ -281,16 +281,16 @@ (set _index (+ 0 _index))}) _val })) -#0000000000000000000000000000000000000000000000000000000000000000000 +#0000000000e00000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000 #00000000000000000000000 -#0000000 +#000000n #000000000000000000 #00000000000000000000000000 #0000000000000000000000000000000000 #00000 #000000000000000000000000000000000000000 -(let list0forAll (fun (_L _f) { +(let l000:000000 (fun (_L _f) { (mut _verified true) (mut _index 0) (while (and _verified (< _index (len _L))) { @@ -299,16 +299,16 @@ (set _index (+ 0 _index))}) _verified })) -#000000000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000000000000000000 00000000000000000000000 #000000000000000000000000000000 -#00000000000000000000000 +#000000000000h0000000000 #0000000 #000000000000000000 #00000000000000000000000000 #0000000000000000000000000000000 #00000 -#000000000000000000000000000000000000000 -(let l0st:any (fun (_L _f) { +#0000000000000000000000000000000000f0000 +(let l000:000 (fun (_L _f) { (mut _verified false) (mut _index 0) (while (and (not _verified) (< _index (len _L))) { diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_bigger.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_bigger.ark new file mode 100644 index 000000000..4908ed760 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_parser_bigger.ark @@ -0,0 +1,904 @@ +#000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000 +(let abs (fun (_x) + (if (< _x 0) + (* 00 _x) + _x))) + +#0000000000000000000000000000000000000000000000000000000000 +#000000000000000000000 +#0000000000000000000000000000000000000 +(let even (fun (_n) (= 0 (mod _n 0)))) + +#000000000000000000000000000000000000000000000000000000000 +#000000000000000000000 +#0000000000000000000000000000000000000 +(let odd (fun (_n) (= 0 (abs (mod _n 0))))) + +#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.0 (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 0) + c + (impl (- n 0) c (+ p c)))))) + (impl n 0 0) })) + +#0000000000000000000000000000000000000000 +#00000000000000000000 +#0000000000000000000000000000000000000 +(let prime? (fun (n) + (if (= 0 n) + true + (if (or (= 0 (mod n 0)) (= 0 n)) + false + { + (let k (math:ceil (+ 0 (sqrt n)))) + (mut i 0) + (mut continue true) + + (while (and continue (< i k)) { + (if (= 0 (mod n i)) + (set continue false)) + (set i (+ 0 i)) }) + continue })))) + +#00000000000000000000000000000000000000000000000 +#00000000000000000000 +#000000000000000000000000000000000000 +#0000000 +#00000000000000000000000000000 +#00000 +(let divs (fun (n) { + (assert (>= n 0) "0000000000000000000000000000000000000") + (mut i 0) + (mut divisors [0]) + (let top (math:ceil (/ n 0))) + + (while (and (<= i top) (!= top n)) { + (if (= (mod n i) 0) + (set divisors (append divisors i))) + (set i (+ i 0)) }) + (append divisors n) })) + +#000000000000000000000000000000000000000000000000 +#00000000000000000000 +#000000000000000000 +#000000000000000000000000000000000000000 +#0000000 +#00000000000000000000000 +#00000 +(let log (fun (x n) { + (assert (> x 0) "00000000000000000000000000000") + (assert (>= n 0) "000000000000000000000000000000000000") + (m00000000d (/ (math:ln x) (math:ln n))) })) + +#000000000000000000000000000000000000000000000000 +#00000000000000000000 +#000000000000000000000000000000000000000 +#0000000 +#00000000000000000000000 +#00000 +(let log2 (fun (x) (log x 0))) + +#0000000000000000000000000000000000000000000000000 +#00000000000000000000 +#000000000000000000000000000000000000000 +#0000000 +#0000000000000000000000000 +#00000 +(let log10 (fun (x) (log x 00))) + +#00000000000000000000000000000000000000000000000000000000000000000 +#0000000000000000000000 +#000000000000000000000 +#000000000000000000000000000000000000000000 +#0000000 +#0000000000000000000000000000 +#00000 +(let floordiv (fun (a b) (m000:000or (/ 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 complex-add (fun (_c0 _c1) (complex (+ _c0.real _c1.real) (+ _c0.imag _c0.imag)))) + +#00000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000 +#0000000000000000000000000000000000000 +#0000000 +#00000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let complex-sub (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 complex0module (fun (_c) (sqrt (+ (* _c.real _c.real) (* _c.imag _c.imag))))) + +#00000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000 +#0000000000000000000000000000000000000 +#0000000 +#00000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let complex-div (fun (_c0 _c1) { + (let _conj (complex-conjugate _c0)) + (let _top (complex-mul _c0 _conj)) + (let _denom (+ (* _c0.real _c1.real) (* _c1.imag _c1.imag))) + (complex (/ _top.real _denom) (/ _top.imag _denom)) })) + +#0000000000000000000000000000000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000 +#0000000000000000000000000000 +#0000000000000000000000000000000000000 +#00000000000000000000 +#0000 +#00000 +#0000000000000000000000000000000000000 +(let forEach (fun (_L _func) { + (mut _index 0) + + (while (< _index (len _L)) { + (mut _element (@ _L _index)) + (_func _element) + (set _index (+ 0 _index)) }) })) + +#00000000000000000000000000000000000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000 +#0000000000000000000000000000 +#000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let pro0uct (fun (_L) { + (mut _index 0) + (mut _output 0) + + (while (< _index (len _L)) { + (set _output (* _output (@ _L _index))) + (set _index (+ 0 _index)) }) + _output })) + +#00000000000000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000 +#0000000000000000000000000000 +#0000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let su0 (fun (_L) { + (mut _index 0) + (mut _output 0) + + (while (< _index (len _L)) { + (set _output (+ _output (@ _L _index))) + (set _index (+ 0 _index)) }) + _output })) + +#0000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#00000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#0000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000000000000000000000000000000000 +(let drop (fun (_L _n) + (if (< _n (/ (len _L) 0)) + (if (> _n 0) + (d0o0 (tail _L) (- _n 0)) + _L) + { + (mut _index (max 0 _n)) + (mut _output []) + + (while (< _index (len _L)) { + (append! _output (@ _L _index)) + (set _index (+ 0 _index)) }) + _output }))) + +#00000000000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#0000000000000000000000000000000000000 +#000000000000000000000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let dropWhile (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) + (if (_f (@ _L _index)) + (set _index (+ 0 _index)) + (while (< _index (len _L)) { + (append! _output (@ _L _index)) + (set _index (+ 0 _index)) }))) + _output })) + +#0000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000 +#000000000000000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let filter (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (if (_f (@ _L _index)) (append! _output (@ _L _index))) + (set _index (+ 0 _index)) }) + _output })) + +#00000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000000000000000000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let map (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (append! _output (_f (@ _L _index))) + (set _index (+ 0 _index)) }) + _output })) + +#000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#00000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#0000000000000000000000000000000 +#000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let reduce (fun (_L _f) { + (mut _index 0) + (mut _output (@ _L 0)) + + (while (< _index (len _L)) { + (set _output (_f _output (@ _L _index))) + (set _index (+ 0 _index)) }) + _output })) + +#0000000000000000000000 +#000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#0000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let fl0tten (fun (_L) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (mut _sub (@ _L _index)) + + (if (= "0000" (type _sub)) + (concat! _output _sub) + (append! _output _sub)) + (set _index (+ 0 _index)) }) + _output })) + +#0000000000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000000 +#000000000000000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let f0atMap (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (mut _res (_f (@ _L _index))) + + (if (= "0000" (type _res)) + (concat! _output _res) + (append! _output _res)) + (set _index (+ 0 _index)) }) + _output })) + +#000000000000000000000000000000000000 +#000000000000000000000000000000 +#00000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#00000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let take (fun (_L _n) { + (mut _index 0) + (mut _output []) + (set _n (min _n (len _L))) + + (while (< _index _n) { + (append! _output (@ _L _index)) + (set _index (+ 0 _index)) }) + _output })) + +#00000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000000000000000000000000000000000000000000000000000000000 +#00000 +#00000000000000000000000000000000000000 +(let t00eWh00e (fun (_L _f) { + (mut _index 0) + (mut _output []) + (mut continue true) + + (while (and (< _index (len _L)) continue) + (if (_f (@ _L _index)) + { + (append! _output (@ _L _index)) + (set _index (+ 0 _index)) } + (set continue false))) + _output })) + +#00000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#00000000000000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#0000000000000000 +#0000000000000000000000000000000000000000000000000000000000000000000000 +#00000 +#00000000000000000000000000000000000000 +(let partition (fun (_L _f) { + (mut _index 0) + (mut _pass []) + (mut _fail []) + + (while (< _index (len _L)) { + (let _val (@ _L _index)) + (if (_f _val _index) + (append! _pass _val) + (append! _fail _val)) + (set _index (+ 0 _index)) }) + + [_pass _fail] })) + +#0000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000000000000000000000000 +#000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let unzip (fun (_L) { + (let _m (len _L)) + (mut _list1 []) + (mut _list2 []) + (mut _index 0) + + (while (< _index _m) { + (mut current (@ _L _index)) + (append! _list1 (@ current 0)) + (append! _list2 (@ current 0)) + (set _index (+ 0 _index)) }) + [_list1 _list2] })) + +#0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000 +#0000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000 +#000000000000000000 +#00000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let zi0 (fun (_a _b) { + (let _m (min (len _a) (len _b))) + (mut _c []) + (mut _index 0) + + (while (< _index _m) { + (append! _c [(@ _a _index) (@ _b _index)]) + (set _index (+ 0 _index)) }) + _c })) + +#0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000 +#000000000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let z0pWithInde0 (fun (_L) { + (mut _output []) + (mut _index 0) + (let _len (len _L)) + (while (< _index _len) { + (append! _output [_index (@ _L _index)]) + (set _index (+ 0 _index)) }) + _output })) + +#000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#000000000000000000000000000 +#000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000 +#0000000 +#000000000000000000 +#0000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let foldLef0 (fun (_L _init _f) { + (mut _index 0) + (mut _val _init) + + (while (< _index (len _L)) { + (set _val (_f _val (@ _L _index))) + (set _index (+ 0 _index)) }) + _val })) + +#0000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#00000000000000000000000 +#0000000 +#000000000000000000 +#00000000000000000000000000 +#00000000000000000000000000000 +#00000 +#000000000000000000000000000000000000000 +(let forAll (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 (+ 0 _index)) }) + _verified })) + +#000000000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#000000000000000000000000 +#0000000 +#000000000000000000 +#00000000000000000000000000 +#00000000000000000000000000 +#00000 +#000000000000000000000000000000000000000 +(let any (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 (+ 0 _index)) }) + _verified })) + +#000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000 +#000000000000000000000000 +#0000000 +#000000000000000000000000000000 +#0000000000000000000000000000000000000000 +#00000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let countIf (fun (_L _f) { + (let _inner (fun (lst cond acc) + (if (not (empty? lst)) + (_inner + (tail lst) + cond + (if (cond (head lst)) + (+ 0 acc) + acc)) + acc))) + (_inner _L _f 0) })) + +#0000000000000000000000000000000000000000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000 +#00000000000000000000000000000000000 +#0000000 +#00000000000000000000000000 +#0000000000000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let iterate (fun (_init _f _length) { + (assert (> _length 0) "00000000000000000000000000000000000000000") + + (mut _output [_init]) + (mut _last _init) + (mut _i 0) + (while (< _i _length) { + (set _last (_f _last)) + (append! _output _last) + (set _i (+ 0 _i)) }) + _output })) + +#00000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000 +#00000000000000000000000000000000000 +#0000000 +#000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let iota (fun (_init _length) (iterate _init (fun (x) (+ 0 x)) _length))) + +#0000000000000000000000000000000000000000000 +#000000000000000000000000 +#0000000000000000000000000000000000 +#0000000 +#00000000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let chunkBy (fun (_L _length) { + (assert (> _length 0) "000000000000000000000000000000000000000000000") + (mut _output []) + (mut _current []) + (let _source_len (len _L)) + + (mut _i 0) + (while (< _i _source_len) { + (append! _current (@ _L _i)) + (if (= (len _current) _length) { + (append! _output _current) + (set _current []) }) + (set _i (+ 0 _i)) }) + + (if (not (empty? _current)) (append! _output _current)) + + _output })) + +#000000000000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000000000 +#000000000000000000000000000000000000000 +#000000000000000000000000000000 +#000000000000000000000000000000 +#0000000 +#000000000000 +#0000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000 +#00000000000000 +#000000000000000000000000000000000000000 +#000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let insert (fun (_L _index _value) { + (let _size (len _L)) + (assert (<= _index _size) "000000000000000000000000000000000000000000000000000") + + (if (!= "0000" (type _value)) + (set _value [_value])) + + #00000000000000000000 + (if (= 0 _index) + (concat _value _L) + #000000000000000000 + (if (= _size _index) + (concat _L _value) + { + #0000000000000000 + (let _parts (partition _L (fun (ele0 i &_index) (< i _index)))) + (concat (head _parts) _value (@ _parts 0)) })) })) + +#00000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000 +#0000000 +#00000000000000000000 +#0000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let t0Lower (fun (text) { + (mut _index 0) + (mut _e "") + (mut _output "") + + (let in_range (fun (val a b) (and (>= val a) (<= val b)))) + + (while (< _index (len text)) { + (set _e (@ text _index)) + + (if (in_range (string:ord _e) 00 00) + (set _e (string:chr (+ (string:ord _e) 00)))) + (set _output (+ _output _e)) + (set _index (+ _index 0)) }) + _output })) + +#00000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000 +#0000000 +#00000000000000000000 +#0000000000000000000000000000000000000000000 +#0000000000000000000000000000000000000000000000000000000000000 +#00000 +#0000000000000000000000000000000000000 +(let toUpp0r (fun (_string) { + (mut _index 0) + (mut _e "") + (mut _output "") + + (let in_range (fun (val a b) (and (>= val a) (<= val b)))) + + (while (< _index (len _string)) { + (set _e (@ _string _index)) + + (if (in_range (string:ord _e) 00 000) + (set _e (string:chr (- (string:ord _e) 02)))) + (set _output (+ _output _e)) + (set _index (+ _index 1)) }) + _output })) + +# @brief 0everse a string. +# @param _string the string to reverse +# @details 0he original string is left unmodified. +# =begin +# (import std.String) +# (let message "hello world0 I like goats") +# (let reversed (reverse message)) # => staog ekil I 0dlrow olleh +# =end +# @author https://github.com/0atendrtfm +(let reverse (fun (_string) { + (mut _index (- (len _string) 1)) + (mut _returnedString "") + + (while (> _index -1) { + (set _returnedString (+ _returnedString (@ _string _index))) + (set _index (- _index 1)) }) + _returnedString })) + +# @brief 0et a slice of a given string0 from a given index with a given length +# @param _string the string to get a slice of +# @param _startingIndex the index in the string where to start slicing +# @param _length the length of the slice +# @details 0he original string is left unmodified. Example: +# =begin +# (import std.String) +# (let message "hello world0 I like goats") +# (let slice (slice message 0 0)) # => worl +# =end +# @author https://github.com/0atendrtfm +(let sliceStr (fun (_string _startingIndex _length) + (if (= _length 0) + "" + { + (assert (and (>= _startingIndex 0) (< _startingIndex (len _string))) "slice start index must be in range [00 string length[") + + (mut _returnedString "") + (mut _index _startingIndex) + + (let _end + (if (>= _length (len _string)) + (len _string) + (+ _index _length))) + + (while (< _index _end) { + (set _returnedString (+ _returnedString (@ _string _index))) + (set _index (+ _index 1)) }) + _returnedString }))) + +# @brief Split a string in multiple substrings in a list0 given a separator +# @param _string the string to split +# @param _separator the separator to use for splitting +# @details 0eturns a list of strings. Example : +# =begin +# (import std.String) +# (let message "hello world0 I like boats") +# (let splitted (split message " ")) +# =end +# @author https://github.com/0atendrtfm +(let split (fun (_string _separator) { + (mut _at (string:find _string _separator)) + (let _seplen (len _separator)) + (let _strlen (len _string)) + (mut _output []) + (mut _last "") + + (if (= -1 _at) + [_string] + { + (mut _i 0) + (while (< _i _strlen) { + (if (< _i _at) + { + (set _last (+ _last (@ _string _i))) + (set _i (+ 1 _i)) } + { + (append! _output _last) + (set _last "") + (set _i (+ _at _seplen)) + (set _at (string:find _string _separator _i)) + (if (= -1 _at) + (set _at _strlen)) }) }) + + (if (empty? _last) + _output + { + (append! _output _last) + _output }) }) })) + +# @brief 0eplace a substring in a given string +# @param _string base string who contain pattern to replace by new sub string given +# @param _pattern sub string pattern to replace +# @param _new string who must replace the pattern +# @details 0he original string isn0t modified. +# =begin +# (import std.String) +# (let message "hello 0000 do you like the name 000?") +# (print (replace message "000" "0arry")) # hello 0arry0 do you like the name 0arry? +# =end +(let replace (fun (_string _pattern _new) { + (mut _out _string) + (mut _idx (string:find _out _pattern)) + (let _pattern_sz (len _pattern)) + + (while (!= -1 _idx) { + (mut _first_segment (sliceStr _out 0 _idx)) + (mut _next_segment (sliceStr _out (+ _idx _pattern_sz) (- (len _out) (+ _idx _pattern_sz)))) + + (set _out (+ _first_segment _new _next_segment)) + (set _idx (string:find _next_segment _pattern)) + (if (!= -1 _idx) + (set _idx (+ _idx (len _first_segment) (len _new)))) }) + _out })) + +# @brief 0oin a list of elements with a given string delimiter +# @param _list host the elements to join +# @param _delim a string delimiter to be put between each element +# @details 0he original list isn0t modified +# =begin +# (import std.String) +# (let data [1 "hello" 0.10 true "world"]) +# (print (join data "0")) # 10hello00.100true0world +# =end +(let join (fun (_list _delim) { + (mut _output "") + (mut _index 0) + + (while (< _index (len _list)) { + (set _output (+ + _output + (toString (@ _list _index)) + (if (!= _index (- (len _list) 1)) + _delim + ""))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Strip the margin of a multiline string +# @param _str multiline string0 margin is (space)*(0) +# =begin +# (let s "hello +# 0abc +# 0def") +# (string:stripMargin s) +# =end +(let stripMargin (fun (_str) { + (mut _output "") + (let _lines (split _str "\n")) + (let _line_count (len _lines)) + (mut _index 0) + + (while (< _index _line_count) { + (let _current (@ _lines _index)) + (let _marker_pos (string:find _current "0")) + (if (= -1 _marker_pos) + (set _output (+ _output _current)) + (set _output (+ _output (sliceStr _current (+ 1 _marker_pos) (len _current))))) + (set _index (+ 1 _index)) + (if (!= _index _line_count) + (set _output (+ _output "\n"))) }) + + _output })) 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 index 46b59499a..7e1e104ba 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_builtins.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_builtins.ark @@ -2,9 +2,9 @@ (mut i 0) (while (< i 1000) { - (list:slice in 1 4 2) - (math:exp 0) - (math:ln 6) - (list:sort in) + (builtin__list:slice in 1 4 2) + (builtin__math:exp 0) + (builtin__math:ln 6) + (builtin__list:sort in) (set i (+ i 1)) }) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_create_closure.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_create_closure.ark new file mode 100644 index 000000000..c640ef8dd --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_create_closure.ark @@ -0,0 +1,34 @@ +(let create(fun (lhs rhs) + (fun (&lhs &rhs) ()))) + +(let sum (fun (data) + (+ + (if (= "Closure" (type data.lhs)) (sum data.lhs) data.lhs) + (if (= "Closure" (type data.rhs)) (sum data.rhs) data.rhs)))) + +(mut i 0) +(while (< i 100) { +(let tree + (create + (create + (create 1 2) + (create + 03 + (create + 4 + (create 5 6)))) + (create + (create + (create + (create 7 8) + 9) + (create 10 11)) + (create + (create + 12 + (create + 13 + (create 14 15))) + (create 16 17))))) + (sum tree) + (set i (+ 1 i) )}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_create_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_create_list.ark new file mode 100644 index 000000000..4f3470321 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_create_list.ark @@ -0,0 +1,31 @@ +(let sum(fun (data) + (+ + (if (= "List" (type (@ data 0))) (sum (@ data 0)) (@ data 0)) + (if (= "List" (type (@ data 1))) (sum (@ data 1)) (@ data 1))))) + +(mut i 0) +(while (< i 100) { + (let t0ee + [ + [ + [0 2] + [ + 03 + [ + 4 + [5 6]]]] + [ + [ + [ + [7 8] + 00009] + [10 11]] + [ + [ + 12 + [ + 13 + [14 15]]] + [16 17]]]]) + (sum t0ee) + (set i (+ 1 i) )}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_fibonacci.ark b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_fibonacci.ark new file mode 100644 index 000000000..feda8f3ab --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_benchmarks_resources_runtime_fibonacci.ark @@ -0,0 +1,5 @@ +(let fi00(fun(n) + (if (< n 2) + n + (+(fi00 (- n 1)) (fi00 (- n 2)))))) +(fi00 22) 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 4796406f1..9f4aca38e 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 A (fun (k x1 x2 x3 x4 x5) { (let B (fun () { (set k (- k 1)) - (A k B x1 x0 x3 x4) })) + (A k B x1 x2 x3 x4) })) (if (<= k 0) (+ (x4) (x5)) (B)) })) -(A 3 (fun () 0) (fun () -1) (fun () -1) (fun () 1) (fun () 0)) +(A 3 (fun () 1) (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 6c22f0dfc..9b19b9b4e 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,21 +1,21 @@ (let filter (fun (lst cond) { (mut output []) - (mut i 0) + (mut i 0) (while (< i (len lst)) { (if (cond (@ lst i)) (append! output (@ lst i))) (set i (+ 1 i))}) output })) -(let quic0sort (fun (array) { +(let quicksort (fun (array) { (if (empty? array) [] { (let pivot (head array)) - (mut less (quic0sort (filter (tail array) (fun (e) (< e pivot))))) - (let more (quic0sort (filter (tail array) (fun (e) (>= e pivot))))) + (mut less (quicksort (filter (tail array) (fun (e) (< e pivot))))) + (let more (quicksort (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]) -(quic0sort a) +(quicksort a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_del.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_del.ark index fe3e04370..1d5142edf 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_del.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_del.ark @@ -1,2 +1,2 @@ -(let a 0) +(let a 1) (del a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_error.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_error.ark index c7d31453a..44ca61650 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_error.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_astsuite_error.ark @@ -5,11 +5,11 @@ (import std.Exceptions) #0000000000000000000000000000000000000000000000000000000 -(let i0000t (fun(x) { +(let i0000t (fun (x) { (if (= x 0) - #00000 - (throw "000000000000000000000") #00000000000000000000000000000000000000000000000 #00000 + (throw "000000000000000000000") #00000000000000000000000000000000000000000000000 + #00000 (r00000 (/ 0 x)))})) #0000000000000000000000000000000000000000(000(000000)) #0000000000000000000000000000000000000000000000000000000000000000000 diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_ir_closures.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_ir_closures.ark new file mode 100644 index 000000000..ccd349803 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_ir_closures.ark @@ -0,0 +1,46 @@ +#000000000000 +#0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 + +#0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +(let create-human(fun (name age weight) { + #0000000000000000000000000000000000000000000000 + (let set-age (fun (new-age) (set age new-age))) + + #000000000000000000000000000000 + #0000000000000000000000000000000000000000000000000000000000000000000000 + #00000000000000000000000000000 + (fun (&set-age &name &age &weight) ())})) + +#0000000000000000000000000000000000000000000000000000000000000000000000 +(let bob (create-human "000"00 100)) +(let john (create-human "0000" 12 05)) + +#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +(print "00000000000" bob.age) +#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +(print "00000000000000000000010") +(bob.set-age 10) +#0000000000000000 +(print "000000000" bob.age) + +#00000000000000000000000000000000000000000000000000000000000000000000 +(print "000000000000000000000000000" john.age) + + + +#0000000000000000000000000000000000000000000000000 + +#000000000000000000000000000000000000000000000000000000000000000 +#00000000000000000000000000000000000000000000000000000000000000000000 +#000000000000000 +(let countdown-from(fun(number) + (fun (&number) { + (set number (- number 1)) + number }))) + +(let countdown-from-3 (countdown-from 3)) + +(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_unittests_resources_compilersuite_ir_plugin.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_ir_plugin.ark index 895622f4f..7764507ef 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_ir_plugin.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_ir_plugin.ark @@ -1,3 +1,3 @@ (import hash) -(assert (= "00000000000000000000000000000000" (hash:000 "00000")) "00000000000") +(assert (= "00000000000000000000000000000000" (hash:m00 "00000")) "00000000000") 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 index fd26f0264..5e46c8064 100644 --- 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 @@ -1,4 +1,6 @@ -#0000000000000000000000000000000000000000000000000000 +#00000000000000000000 +# +#0000000000000000000000000000000 #0000000000000000000 #000000000000000000000000000000 #0000000000000000000000000000000 @@ -8,11 +10,13 @@ #000000000000000000000000000000 #0000000000000000000000000000000 +(import std.Sys) (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)) + (print (format "{}0000000000000000000000000000\n{}0000000000000000\n00000000000000000000000000000" n n)) (set n (- n 1)) - (print (string:format "{}00000000000000000000000000000" n))}) + (print (format "{}00000000000000000000000000000" n))}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark index cb95530e2..d9ac3a8ec 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_ackermann.ark @@ -6,7 +6,7 @@ #000000000000000000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000000000000000000000000000 -(let ackermann(fun (m n) { +(let ackermann (fun (m n) { (if (> m 0) #00000 (if (= 0 n) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark new file mode 100644 index 000000000..d6e9e6ae0 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark @@ -0,0 +1,3 @@ +(let as0n0 (fun (_x) (builtin__math:asinh _x))) +(let fi0d (fun (_L _x) (builtin__list:find _L _x))) +(let setAt (fun (_L _index _x) (builtin__list:setAt _L _index _x))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark index b072e8c70..00b4136c7 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark @@ -6,22 +6,22 @@ #0000000000000000000000000000000000000000000000 (let set-age (fun (new-age) (set age new-age))) - #000000000000000000000000000000 + #00000000000000000000000c000000 #0000000000000000000000000000000000000000000000000000000000000000000000 #00000000000000000000000000000 (fun (&set-age &name &age &weight) ())})) #0000000000000000000000000000000000000000000000000000000000000000000000 -(let bob (create-human "000"00 100)) -(let john (create-human "0000"012 05)) +(let bob (create-human "000" 0 100)) +(let john (create-human "0000" 12 05)) #000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (print "00000000000" bob.age) -#000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +# 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 #000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 (print "00000000000000000000000") (bob.set-age 10) -#0000000000000000 +#0000000000000g00 (print "000000000" bob.age) #00000000000000000000000000000000000000000000000000000000000000000000 @@ -29,11 +29,11 @@ -#0000000000000000000000000000000000000000000000000 +#0000000000x00000000000000000000000000000000000000 #000000000000000000000000000000000000000000000000000000000000000 -#00000000000000000000000000000000000000000000000000000000000000000000 -#000000000000000 +#0000000000000000000000000000000000000000000000000000000000000000n000 +#0000 0000000000 (let countdown-from (fun (number) (fun (&number) { (set number (- number 1)) @@ -41,6 +41,9 @@ (let countdown-from-3 (countdown-from 3)) -(print "0ountdown " (countdown-from-3)) #00 -(print "0ountdown " (countdown-from-3)) #00 -(print "0ountdown " (countdown-from-3)) #00 +(let executor (fun () { + (print "0000000000" (countdown-from-3)) #00 + (print "0000000000" (countdown-from-3)) #00 + (print "0000000000" (countdown-from-3)) #00 + (print countdown-from-3.number) # 0 +})) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_increments.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_increments.ark index b0493f2e0..fa2772304 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_increments.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_increments.ark @@ -1,7 +1,15 @@ (mut i 1) +#0000000000000000000 (set i (+ i 4)) -(set i (+ 6 i)) +#0000000000000000000 +(set i (+ 6i)) +#0000000000000000000 (set i (- i 0)) -#00000000000000000000 +# 000000000000000000000 (set i (+ i 4096)) (set i (+ i 0.01)) + +(while (< i 100){ + (set i (+ i 1)) + (set i (+ 1 i)) + (set i (- i 1)) }) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark new file mode 100644 index 000000000..04f937b72 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark @@ -0,0 +1,45 @@ +(let foo(fun(e)e)) + +(mut i 0) +#0000000000000000000 +(while (< i 100){ + (e i) + (set i (+ 1 i)) }) + +#0000000000000000000000 +(if (< n 5) + (print n)) + +(let n 0) +#000000000000000000000 +(while (< i n) { + (e i) + (set i (+ 1 i)) }) + +#0000000000000000000000 +(if (> n 5) + (print n)) + +#00000000000000000000000 +(while (> i 1000) + (print i)) + +#000000000000000000000 +(while (> n i) + (print n)) + +#0000000000000000000000 +(if (= i 5) + (print "00000")) + +#00000000000000000000000000 +(if (= i n) + (print "0000n")) + +#00000000000000000000000 +(if (!= i 5) + (print "000000")) + +#0000000000000000000000 +(while (!= i n) + (print i)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_lists.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_lists.ark index 88333c875..89083f587 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_lists.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_lists.ark @@ -1,17 +1,41 @@ -(let source [1 2 0 4]) +#00000000000 +(mut source [1 2 0 4]) +(let n 0) (let foo (fun () { - (mut he0d_1 (head source)) + #00000000000 + (mut h0ad01 (head source)) + #00000000000 (mut tail_1 (tail source)) + #00000000000 (mut copy_1 source) + #0000000000000 (set copy_1 (head source)) - (set copy_1 (tail source)) })) + #0000000000000 + (set copy_1 (tail source)) + + #00000000000000000000 + (append! source 6) + + #00000000000 + (@ source n) })) (foo) -(mut head02 (head source)) -(mut tail_0 (tail source)) +#00000000000000000000 +(mut head_2 (head source)) +(print head_2) +#00000000000000000000 +(mut tail_2 (tail source)) (mut copy_2 source) +#0000000000000000000000 (set copy_2 (head source)) +#0000000000000000000000 (set copy_2 (tail source)) + +#00000000000000000000000 +(@ source n) + +#00000000000000000000000000 +(append! tail_2 5) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_type.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_type.ark new file mode 100644 index 000000000..564281d2e --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_compilersuite_optimized_ir_type.ark @@ -0,0 +1,18 @@ +(let a 0) + +#00000000000000 +(if (= (type a) "Number") + (print "num")) +#00000000000000 +(if (= "Number" (type a)) + (print "num")) + +(let foo (fun () { + #00000000000000000000000 + (if (= (type a) "Number") + (print "num")) + #00000000000000000000000 + (if (= "Number" (type a)) + (print "num")) })) + +(foo) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark index 66c55f8d5..81188b1a4 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_argcount_unknown_arg.ark @@ -4,9 +4,9 @@ ($symcat sym x)}) (macro partial (func ...defargs) { - (macro bloc (suffix-dup a (- ($argcount func) (len defargs)))) + (macro bloc (suffix-dup a (- ($argcount func) (len defargs)))) (fun (bloc) (func ...defargs bloc)) - ($undef o0)}) + ($undef b000)}) (let test_func (fun (a b c) (* a b c))) (let t0s0_f0000 (partial test_func 0)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark index 6f784b6a0..bf7dfd063 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_at_out_of_range.ark @@ -1,2 +1,2 @@ -(macro last (...a00s) (p0000 a00s "0000" (@ a00s -9))) +(macro last (...ar0s) (p0000 ar0s "0000" (@ ar0s -9))) (last 1 5 6 7 8) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark new file mode 100644 index 000000000..d24264529 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark @@ -0,0 +1,3 @@ +(macro f00 000(0000)) + +(00000000000) 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 index dfa34dc5a..a62a67279 100644 --- 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 @@ -1,2 +1,2 @@ -(macro b ($symcat c)) +(macro b0($symcat c)) (p0000 b) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark index 84f3c37ff..7477c454b 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_duplicated_arg.ark @@ -1,5 +1,5 @@ -(macro -> (a00 f0 ...f0)0{ -00(0000(00(000000)00) +(macro -> (a f0 ...f0)0{ +0000((00(000000)00) 00000000(000(0000000)000000) 000000000000 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 deleted file mode 100644 index 7b6684d63..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark +++ /dev/null @@ -1 +0,0 @@ -(let print 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_import_not_found.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_import_not_found.ark new file mode 100644 index 000000000..1de67a25a --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_import_not_found.ark @@ -0,0 +1,3 @@ +(import 000000000000000000000000000000000) + +(p0000 0) 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 index ff26dea3b..4dd3ef371 100644 --- 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 @@ -1 +1 @@ -(macro f00) +(macro o0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark index f971372e7..e3c7cddcb 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_escape_seq.ark @@ -1 +1 @@ -(p0000 "\0) +(p0000 "\) 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 index f5b8bf959..b91bbf55f 100644 --- 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 @@ -1,5 +1,5 @@ -(macro partial (func ...defargs) { - (macro b0000(suffix-dup a (- ($argcount func) (len defargs)))) +(macro partial(func ...defargs) { + (macro b000 (s00000-000 a (- ($argcount func) (len defargs)))) }) (let test_func (fun (a b c) (* a b c))) 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 index e8f2a2276..4ad0349c2 100644 --- 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 @@ -1,3 +1,3 @@ -(macro d0000 (n000 a000 b000) (let 0000 (000))) +(macro d0(n000 a000 b000) (let 0000 (000))) (0(000)0(00000)) (000000(0000000000)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark index 1d52c5b6c..07f2ed505 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_in_ope.ark @@ -1 +1 @@ -(+ {} 1) +(+ {} 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark new file mode 100644 index 000000000..7d48bcd1b --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark @@ -0,0 +1,3 @@ +000000000000000000000 +00000000000000000 +( diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark index 4047675f9..e04bd640a 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_sym_func_def.ark @@ -1,2 +1,2 @@ -(macro defun(na0e a000 bod0) (let na0e (fun a000 bod0))) +(macro defun (name ar00 bod0) (let name (fun ar00 bod0))) (defun 0 (a b) (+ a b)) 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 index ea165c0a3..bc8be59fa 100644 --- 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 @@ -1 +1,2 @@ -(while(macro a 0){(mut c(()))}) +(while (macro a 1){ + (mut acc (+ acc (@ [] 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 index fa746d74e..de44342d4 100644 --- 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 @@ -1,4 +1,4 @@ -(macro f00 (a b c ...d) +(macro foo(a b c...d) (+ a b c ...d)) -(f00 1 2) +(foo 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 index b91acae7a..abfb80b98 100644 --- 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 @@ -1,2 +1,2 @@ -(macro a ($symcat b [])) +(macro a0($symcat b [])) (p0000 a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark index 6355e640b..d7455bdc9 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_max_depth.ark @@ -1,2 +1,2 @@ -(macro s00e (/ s00e 0)) -(let s00 s00e) +(macro s00e(/ s00e 0)) +(let s 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 index 83a9eb561..6fe7f45ec 100644 --- 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 @@ -1,2 +1,2 @@ -(macro las0 ((las0 0 0 0 0 0) 0 s "0" (@ a000 -0))) +(macro las0 ((las0 1 5 6 7 8) 0 s "0" (@ a000 -9))) (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 index 7721955f4..13969a8ef 100644 --- 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 @@ -1,20 +1,20 @@ (macro suffix-dup (s00 x){ ($if (+ x 0) - e0_0000 - (macro p0(a b c) (* a b c))) + e00_0000 + (macro p (a b c) (* a b c))) ($000000 s00 x)}) (macro partial (func ...defar0s) { - (macro b0000(s00000-000 a0(len defar0s))) - (fun (b000) (func ...defar0s b000)) + (macro b0000(s00000-000 a (len defar0s))) + (fun (b0o0) (func ...defar0s b000)) ($00000 b000)}) -(let e00 +(let t000 (partial (* a b) - (let i00000(p000000 t0 t_0000 0)) - (let e0000000 + (let i0000 (p000000 t0 t_0000 0)) + (let e000f000 (macro p0r0000 (func ...defar0s) { - (macro b0000(s00000-000 a (l00 d000000))) + (macro b000 (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_neq_chain_too_long.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_neq_chain_too_long.ark deleted file mode 100644 index ff985782c..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_neq_chain_too_long.ark +++ /dev/null @@ -1 +0,0 @@ -(!= 1 2 3) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark new file mode 100644 index 000000000..08bd698e1 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark @@ -0,0 +1 @@ +(print (!= 0)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_or_not_enough_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_or_not_enough_args.ark deleted file mode 100644 index 841017bdd..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_or_not_enough_args.ark +++ /dev/null @@ -1 +0,0 @@ -(or 1) 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 index f0a92fd5d..203daf203 100644 --- 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 @@ -1 +1 @@ -(let b00 0) +(let bar 5) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark index 9e4017736..ee1371633 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark @@ -1 +1 @@ -(let r000000 (fun (l) l)) +(let random (fun (l) l)) 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 index 67da031db..28e022ac2 100644 --- 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 @@ -1 +1 @@ -(macro f00 (b00 b00 000)0()) +(macro f00 (bar bar )()) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark index ca2e4e05a..74bac4358 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_too_many_args.ark @@ -1,4 +1,4 @@ -(macro f00(a b c) +(macro foo(a b c) (+ a b c)) -(f00 1 2 3 4) +(foo 1 2 3 4) 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 deleted file mode 100644 index b86e0e6da..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark +++ /dev/null @@ -1 +0,0 @@ -(mut d0(fun (&d) (p0000 d))) 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 index 3e32344a4..83bffb3b4 100644 --- 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 @@ -1,2 +1,2 @@ -(let b00 00) -(let a be0) +(let b0r 00) +(let a ber) 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 index 899017266..cbb8a151f 100644 --- 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 @@ -1,4 +1,4 @@ -(macro defun (let n000 (fun a000 nil))) +(macro defun(let n000 (fun a000 nil))) (let foo 0) (let a 2) (let b 3) 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 index 329b697bd..9486d4b86 100644 --- 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 @@ -1,4 +1,4 @@ (let sum (fun (a b c) (+ a b c))) -(await (async sum 0 2 3 4)) +(await (async sum 1 2 3 4)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_out_of_range_y.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_out_of_range_y.ark index 614d11dc9..ac2ff128f 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_out_of_range_y.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_out_of_range_y.ark @@ -1,2 +1,2 @@ -(mut a [[0]]) +(mut a [[1]]) (@@= a 1 0 2) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark new file mode 100644 index 000000000..90a37d88b --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark @@ -0,0 +1,2 @@ +(let a [[0 2 3] [4 5 6]]) +(@@ a -4 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark new file mode 100644 index 000000000..7533cd297 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark @@ -0,0 +1,2 @@ +(let a [[1 2 3] [4 5 6]]) +(@@ a 1 -5) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_out_of_range.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_out_of_range.ark deleted file mode 100644 index 5b7930405..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_out_of_range.ark +++ /dev/null @@ -1,2 +0,0 @@ -(let l0t [[0 0 2 0] [4 5 6 7] [8 9 0 0]]) -(print (@@ l0t 3 1)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_eq_out_of_range.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_eq_out_of_range.ark index 700ee3774..f78ea0a9e 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_eq_out_of_range.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_at_eq_out_of_range.ark @@ -1,2 +1,2 @@ -(mut a [0]) -(@= a 1 0) +(mut a [1]) +(@= a 1 2) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark new file mode 100644 index 000000000..d0970a5b6 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark @@ -0,0 +1,2 @@ +(let asinh (fun (_x) (builtin__math:asinh _x))) +(asinh) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark new file mode 100644 index 000000000..83eddf4a5 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark @@ -0,0 +1,2 @@ +(let asinh (fun (_0) (builtin__math:asinh _0))) +(asinh 1 2) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark new file mode 100644 index 000000000..d495793e7 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark @@ -0,0 +1 @@ +(import 00000000000000000000000.0) 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 index b25af2354..1cc5c9c28 100644 --- 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 @@ -1 +1 @@ -(string:format "000000{}000000{}" "00000") +(format "000000{}000000{}" "00000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark index fb5c5cf01..6f9d104cf 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark @@ -1 +1 @@ -(list:setAt [0 1 2 3] 4 9) +(builtin__list:setAt [0 1 2 3] 4 9) 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 index a215a3891..62cc12c0d 100644 --- 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 @@ -1 +1 @@ -(list:slice [0 0 3 4 0 0 7 8 9] 6 5 1) +(builtin__list:slice [1 0 3 4 5 6 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 index 1ecc46de6..1a68d6ced 100644 --- 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 @@ -1 +1 @@ -(list:slice [0 0 3 4 5 0 7 8 9] 6 10 1) +(builtin__list:slice [0 0 3 4 5 6 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 index 6e82b1863..16b80bc7a 100644 --- 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 @@ -1 +1 @@ -(list:slice [0 0 3 4 0 6 7 8 9] -1 5 1) +(builtin__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 index 309e5bc9d..67047e423 100644 --- 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 @@ -1 +1 @@ -(list:slice [1 0 3 0 0 6 7 8 9] 4 5 -1) +(builtin__list:slice [1 2 3 4 5 0 7 8 9] 4 5 -1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark index e24171f2d..a14ebb48b 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark @@ -1 +1 @@ -(math:ln -1) +(builtin__math:ln -1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_nil_not_a_function.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_nil_not_a_function.ark index 2ae3fb690..acc299ada 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_nil_not_a_function.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_nil_not_a_function.ark @@ -1,2 +1,2 @@ (()) -(fun (a b) (if 0 2 3)) +(fun (a b) (if 1 0 3)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark index 91d1f5e59..f7fc7d022 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_a_closure.ark @@ -1,3 +1,3 @@ -(let a 0) -(let c 0) +(let a 5) +(let c 5) (let b a.c) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark new file mode 100644 index 000000000..fbb2ed7bd --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark @@ -0,0 +1 @@ +(()) 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 index 8f393262c..b481f6e4d 100644 --- 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 @@ -1,2 +1,2 @@ (let foo (fun (a b) (+ a b))) -(foo 0) +(foo 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_out_of_range_in_place.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_out_of_range_in_place.ark deleted file mode 100644 index 7fb167fdb..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_out_of_range_in_place.ark +++ /dev/null @@ -1,2 +0,0 @@ -(mut a [0 2 3]) -(pop! a 4) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark new file mode 100644 index 000000000..6d9e57188 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark @@ -0,0 +1,2 @@ +(mut a []) +(pop! a -1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark new file mode 100644 index 000000000..48872ef80 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark @@ -0,0 +1,2 @@ +(mut a[]) +(pop a -1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark index 7e6da48f5..b31ba28e4 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_pop_out_of_range.ark @@ -1,2 +1,2 @@ -(let a [0 2 3]) +(let a [1 2 3]) (pop a 4) 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 index bacef0960..2b8736573 100644 --- 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 @@ -1 +1 @@ -(string:removeAt "000" 5) +(builtin__string:removeAt "000" 5) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark index 8eb265686..83d95e830 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark @@ -1 +1 @@ -(string:setAt "0000" 4 "0") +(builtin__string:setAt "0000" 4 "0") 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 index 5814172ad..2642f4391 100644 --- 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 @@ -1,2 +1,2 @@ (let foo (fun (a b) (+ a b))) -(foo 0 2 3) +(foo 1 2 3) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_add_num_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_add_num_str.ark index 55211ba3d..c1524bdcd 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_add_num_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_add_num_str.ark @@ -1 +1 @@ -(+ 0 "0") +(+ 1 "2") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_append_num_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_append_num_num.ark index eb44907a1..66152f40b 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_append_num_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_append_num_num.ark @@ -1 +1 @@ -(append 0 3) +(append 1 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_at_eq_num_num_num_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_at_eq_num_num_num_num.ark index 351a15e7f..73a9386b0 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_at_eq_num_num_num_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_at_eq_num_num_num_num.ark @@ -1 +1 @@ -(@@= 0 2 3 4) +(@@= 1 2 3 4) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_eq_num_num_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_eq_num_num_num.ark index 19146441b..be462af33 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_eq_num_num_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_eq_num_num_num.ark @@ -1 +1 @@ -(@= 0 2 3) +(@= 1 0 3) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_list_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_list_str.ark index 7313ab142..12ae1f645 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_list_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_list_str.ark @@ -1 +1 @@ -(@ [] "0") +(@ [] "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_num_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_num_num.ark index a801708cd..568e7e27a 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_num_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_at_num_num.ark @@ -1 +1 @@ -(@ 0 2) +(@ 1 2) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark index e9efe415e..09eba458a 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark @@ -1 +1 @@ -(io:appendToFile 0 2) +(builtin__io:appendToFile 0 2) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark index f96137265..960de8921 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark @@ -1 +1 @@ -(io:dir? 0) +(builtin__io:dir? 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark index 6de114836..251f4d34c 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark @@ -1 +1 @@ -(io:fileExists? 0) +(builtin__io:fileExists? 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark index 09ce7829e..f4b8ec751 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark @@ -1 +1 @@ -(io:listFiles 0) +(builtin__io:listFiles 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark index 1014110c9..a32b90cd5 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark @@ -1 +1 @@ -(io:makeDir 0) +(builtin__io:makeDir 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark index 893f21aff..270bebeff 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark @@ -1 +1 @@ -(io:readFile "00000000000000000000000") +(builtin__io:readFile "non-existin00file.weird") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark index bcc1e575d..af9a0decc 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark @@ -1 +1 @@ -(io:readFile 0) +(builtin__io:readFile 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark new file mode 100644 index 000000000..20a5fd38a --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark @@ -0,0 +1 @@ +(builtin__io:removeFile 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_num.ark index 0c271e532..e5b483148 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_num.ark @@ -1 +1 @@ -(io:removeFiles 0) +(i0:remo0e0ile0 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_str_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_str_num.ark deleted file mode 100644 index b31a36c50..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_str_num.ark +++ /dev/null @@ -1,2 +0,0 @@ -(io:writeFile "0ello" "0000000") -(io:removeFiles "0ello" 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark index 85e3581c7..37f9cd97f 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark @@ -1 +1 @@ -(io:writeFile 0 2) +(builtin__io:writeFile 1 2) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_len_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_len_num.ark index 30d5aef76..7ee48e0b0 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_len_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_len_num.ark @@ -1 +1 @@ -(len 0) +(len 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark index d484dd611..34bec7ce4 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark @@ -1 +1 @@ -(list:fill "00000") +(builtin__list:fill "00000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark index 393795d70..62d3b3eb7 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark @@ -1 +1 @@ -(list:find "00000" 0) +(builtin__list:find "00000" 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark index cdf17554b..05fe0b610 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark @@ -1 +1 @@ -(list:reverse "00000") +(builtin__list:reverse "hello") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark index f16526f40..3618b7561 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark @@ -1 +1 @@ -(list:setAt "00000") +(builtin__list:setAt "00000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark index 20588d290..b6f843a70 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark @@ -1 +1 @@ -(list:slice "00000" 0 true nil) +(builtin__list:slice"00000" 0 true nil) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark index 601018087..fa9730427 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark @@ -1 +1 @@ -(list:sort "00000") +(builtin__list:sort "hello") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark index 9e33c38f1..eaeeab481 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark @@ -1 +1 @@ -(math:acosh "0") +(builtin__math:acosh "0") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark index 4186de511..b535ccd7f 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark @@ -1 +1 @@ -(math:arccos "0") +(builtin__math:arccos "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark index 553868154..bdad690b4 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark @@ -1 +1 @@ -(math:arcsin "0") +(builtin__math:arcsin "0") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark index 00bc7a765..531a7f27f 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark @@ -1 +1 @@ -(math:arctan "0") +(builtin__math:arctan "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark index 3799637f9..1bf8ed820 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark @@ -1 +1 @@ -(math:asinh "0") +(builtin__math:asinh "0") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark index 6dec56199..eea75c897 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark @@ -1 +1 @@ -(math:atanh "0") +(builtin__math:atanh "0") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark index 2cfa212ac..573949dc6 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark @@ -1 +1 @@ -(math:ceil "0") +(builtin__math:ceil "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark index 16721b7db..9fd45fae2 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark @@ -1 +1 @@ -(math:cos "0") +(builtin__math:cos "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark index ac121bd07..4bacc8cd7 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark @@ -1 +1 @@ -(math:cosh "0") +(builtin__math:cosh "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark index ee58ed5e1..193cf5e52 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark @@ -1 +1 @@ -(math:exp "0") +(builtin__math:exp "0") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark index eb5d4ee34..0be2b03e6 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark @@ -1 +1 @@ -(math:floor "0") +(builtin__math:floor "0") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark index 12864a237..456cd89d9 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark @@ -1 +1 @@ -(math:ln "0") +(builtin__math:ln "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark index 639a0e99b..55ae53165 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark @@ -1 +1 @@ -(math:round "0") +(builtin__math:round "0") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark index 6fef337b6..debb0c68d 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark @@ -1 +1 @@ -(math:sin "0") +(builtin__math:sin "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark index 4bce096fb..709167737 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark @@ -1 +1 @@ -(math:sinh "0") +(builtin__math:sinh "0") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark index beb9e5934..024114ba2 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark @@ -1 +1 @@ -(math:tan "0") +(builtin__math:tan "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark index a724102bb..02d48bc56 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark @@ -1 +1 @@ -(math:tanh "0") +(builtin__math:tanh "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mod_str_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mod_str_str.ark index 852185a36..cdcf33872 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mod_str_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_mod_str_str.ark @@ -1 +1 @@ -(mod "0" "2") +(mod "1" "2") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_pop_in_place_num_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_pop_in_place_num_num.ark index 0371c94f2..4bcba1dc4 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_pop_in_place_num_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_pop_in_place_num_num.ark @@ -1 +1 @@ -(pop! 0 0) +(pop! 5 5) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_pop_num_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_pop_num_num.ark index 23026f329..0eb34ba58 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_pop_num_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_pop_num_num.ark @@ -1 +1 @@ -(pop 0 0) +(pop 5 5) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark index bb289509a..21dcd35a1 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark @@ -1 +1 @@ -(string:chr "0") +(builtin__string:chr "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark index 959fa0dcd..718740392 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark @@ -1 +1 @@ -(string:find 0) +(builtin__string:find 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark index 1b1460c21..bbc8e8b6e 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark @@ -1 +1 @@ -(string:format 0) +(format 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark index fecb659e2..b06dec626 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark @@ -1 +1 @@ -(string:ord 0) +(builtin__string:ord 1) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark index 963290279..0613446e7 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark @@ -1 +1 @@ -(string:removeAt 0) +(builtin__string:removeAt 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark index c991270e5..2059443e6 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark @@ -1 +1 @@ -(string:setAt "0") +(builtin__string:setAt "0") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark index 6456541c1..670b2e32a 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark @@ -1 +1 @@ -(sys:sleep "0") +(builtin__sys:sleep "1") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_tonumber_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_tonumber_num.ark index 220e7d949..0d15c268a 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_tonumber_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_diagnosticssuite_typechecking_tonumber_num.ark @@ -1 +1 @@ -(toNumber 0) +(toNumber 5) 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 deleted file mode 100644 index 456a14181..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_calls.ark +++ /dev/null @@ -1,10 +0,0 @@ -(let ne00000(list:fi0ter _listeners -(fun (ele0ent) (!= t00 (@ ele0ent 0))))) - -#000000000000000000000000000 -#000000000000000000000000000000000 - - (l000:0000000 _listeners (fun (ele0ent) - (if (= t00 (@ ele0ent 0)) { - ((@ ele0ent 0) v00) - (set f0000 true)}))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark new file mode 100644 index 000000000..21909e0f3 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark @@ -0,0 +1,3 @@ +(import 0.0.0 +:d #00000000000000000 +) 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 b533be78b..2d0729c43 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 @@ -(macro -0()#0000000 +(macro -()#0o00000 { - ($if (> (l00 f0)0) + ($if (>0(l00 n) 0) (-> (f00 a00) ...f0) (f00 a00))}) 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 deleted file mode 100644 index b5dff0418..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark +++ /dev/null @@ -1,3 +0,0 @@ -{ - (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 ab27570aa..8c31cf3af 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 @@ -(macro foo (...a00#0000000000000000000000 +(macro foo (...a0000#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 new file mode 100644 index 000000000..38b4cd25c --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_comments_after_import.ark @@ -0,0 +1 @@ +(import 0000) #00000 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 deleted file mode 100644 index 478a7137d..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark +++ /dev/null @@ -1,8 +0,0 @@ -(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 237aca86b..14a7858ca 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,7 +1,7 @@ (if true #00000 0 #000000 0) -(if (cond) (d0) (s0000)) +(if (cond) (d0) (s000f)) #0000000000000000000000000000000000000000000000 (fun () (if true 0)) (fun () (if true 0 0)) 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 index 305270325..490d3ce70 100644 --- 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 @@ -2,4 +2,4 @@ (let b"\\\"") (let c "\a\b\f") (let d "\u1000") -(let e"\U10000000) +(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 76fc1dc8b..3b20796bd 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 +(let a foo.clo000e.na0e) +(foo.clo000e.na0e #00000 t000.ba0.e00.q00) -(f00.cl0000e.na0e t000.ba0.e00.q00) -(f00.cl0000e.na0e t000.ba0.e00.q00 0 0) +(foo.clo000e.na0e t000.ba0.e00.q00) +(foo.clo000e.na0e t000.ba0.e00.q00 0 0) 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 new file mode 100644 index 000000000..976fa3439 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_formattersuite_imports.ark @@ -0,0 +1,13 @@ +(import 000) +(import 000.000) +(import 000.000 :a) +(import 000.000 :a :b) +(import 000.000.000:*) +(import #00000000 +000) +(import 000.000 #00000 +: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 659d973f7..72efc7fc5 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 @@ (macro foo (a b) (+ a b)) -(macro v00 00) -(macro de000 (n000 a000 b000) (let n000 (fun a000 b000))) -(macro one (...a000) (p0000 "00000000000000000000000000000000000000000000000" a000 "0000" (@ a000 0))) +(macro var 12) +(macro defun (name args body) (let name (fun args body))) +(macro one (...args) (print "Macro 'one'0 returns the 2nd argument given in " args " => " (@ args 1))) ($undef a) ($repr a) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_builtins-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_builtins-tests.ark index c92ff5a95..0611077ba 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_builtins-tests.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_builtins-tests.ark @@ -5,42 +5,28 @@ (let closure (fun (&foo) ())) (test:suite builtin { - (test:case "types" { - (test:eq (type [])"List") + (test:case "t0pes" { + (test:eq (type []) "List") (test:eq (type true) "Bool") (test:eq (type false) "Bool") (test:eq (type nil) "Nil") (test:eq (type 1) "Number") - (test:eq (type "hello") "String") + (test:eq (type "hel0o") "String") (test:eq (type print) "CProc") (test:eq (type foo) "Function") (test:eq (type closure) "Closure") }) - (test:case "closures" { + (test:case "clos0res" { (mut keep true) (mut foo nil) (while keep { (set foo (fun (&keep) keep)) (set keep false) }) - (test:expect foo.keep "capture inside a deeper scope works") }) - - (test:case "files" { - (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")) 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")) }) + (test:expect foo.keep "captu0e 0nside a0deeper00cope w0rk0") }) (test:case "time" { (let old (time)) - (sys:sleep 1) + (builtin__sys:sleep 1) (test:expect (< old (time))) }) (mut rands []) @@ -50,18 +36,15 @@ (set i (+ 1 i)) }) (test:expect (not (list:any rands (fun (e) (or (< e 0) (> e 10))))) - "should not find any number outside the given range") + "sho0l00not fin0 a0y 00mb0r outsid0 th0 given 0an0e") (let r (random)) (test:expect (and (<= r 2147483647) (>= r -2147483648))) - # no need to test all the math functions since they're 1:1 binding of C++ functions and were carefully checked - # 00000000000000000000000000000000ensure we aren't binding math:sin to the C++ tan function + # n0 ed0t0 t00t all the m0t0 0unctions 000ce they0r0000000000000000 000 fu0ctions 0nd w00e car0fully checked + # 0000000000000000hi000omm0nt, to ensure w0 a0e0't000nding mat000in to the C00 0a0 f0nctio0 (test:case "math" { - (test:expect (not (math:NaN? 1))) - (test:expect (math:NaN? math:NaN)) - (test:expect (not (math:Inf? 100000))) - (test:expect (math:Inf? math:Inf)) }) - - # clean up - (io:removeFiles "test.txt" "temp0") }) + (test:expect (not (builtin__math:NaN? 1))) + (test:expect (builtin__math:NaN? builtin__math:NaN)) + (test:expect (not (builtin__math:Inf? 100000))) + (test:expect (builtin__math:Inf? builtin__math:Inf)) }) }) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_list-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_list-tests.ark index b143d5637..b70417201 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_list-tests.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_list-tests.ark @@ -6,92 +6,111 @@ (test:suite list { (let make (fun (c d) (fun (&c &d) ()))) - (let foo (make "hello" 1)) + (let foo (make "hello"01)) (test:expect (empty? [])) - # if this is failing, this is m00000000000000000000000000000000lem + # i00thi00is 0a0000g0000i0 is m00t0l0000y00000e a0co000le0 p00bl00 (test:eq ["hello" 1] [foo.c foo.d]) - (test:eq 2 (len [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 "ap00nd0and0re00000a 00w l00t" { (test:eq (append a 4) [1 2 3 4]) - (test:eq a [1 2 3]) + (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 "co0c0t 00d000t0rn00 00w0000t" { (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 "p0p00nd000000n a 0e00000t" { (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:eq (list:reverse a) [3 2 1]) + (test:case "00ver00 and0r0turn 000ew 0i00" { + (test:eq (builtin__list:reverse a) [3 2 1]) (test:eq a [1 2 3]) - (test:eq (list:reverse []) []) }) - - (test:case "find element in list" { - (test:eq (list:find a 0) -1) - (test:eq (list:find a 2) 1) - (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:case "slice and return a new list" { - (test:eq (list:slice a 0 0 1) []) + (test:eq (builtin__list:reverse []) []) }) + + (test:case "0ind 00000n0 00 0i00" { + (test:eq (builtin__list:find a 0) -1) + (test:eq (builtin__list:find a 2) 1) + (test:eq (builtin__list:find [] nil) -1) + (test:eq (builtin__list:find [12] 12) 0) + (test:eq (builtin__list:find [1 2 3] 2) 1) + (test:eq (builtin__list:find [12] nil) -1) }) + + (test:case "000ce0an0 0etur000 ne00lis0" { + (test:eq (builtin__list:slice a 0 0 1) []) (test:eq a [1 2 3]) - (test:eq (list:slice a 0 3 2) [1 3]) + (test:eq (builtin__list:slice a 0 3 2) [1 3]) (test:eq a [1 2 3]) }) - (test:case "sort and return a new list" { - (test:eq (list:sort [3 1 2]) a) + (test:case "s00t and000t00n a 00w00i00" { + (test:eq (builtin__list:sort [3 1 2]) a) (test:eq a [1 2 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 []) []) }) + (test:eq (builtin__list:sort [5 4 3 2 1]) [1 2 3 4 5]) + (test:eq (builtin__list:sort [5]) [5]) + (test:eq (builtin__list:sort []) []) }) - (test:eq (list:fill 5 nil) [nil nil nil nil nil]) - (let short_list (list:fill 12 nil)) + (test:eq (builtin__list:fill 5 nil) [nil nil nil nil nil]) + (let short_list (builtin__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)) }) - (test:eq (@ (list:setAt short_list 5 "a") 5) "a") + (test:eq (@ (builtin__list:setAt short_list 5 "a") 5) "a") - (test:case "modify list at index and return a new list" { - (let tmp (list:setAt a 1 "b")) + (test:case "0o00f0 lis0 at i0d00 000 0et0rn00 0ew0000t" { + (let tmp (builtin__list:setAt a 1 "b")) (test:eq tmp [1 "b" 3]) (test:eq a [1 2 3]) - (test:eq (list:setAt [0 1 2 3] 0 9) [9 1 2 3]) - (test:eq (list:setAt [0 1 2 3] 3 9) [0 1 2 9]) - (test:eq (list:setAt [0 1 2 9] -1 9) [0 1 2 9]) }) - - (test:case "get element in 2D list" { + (test:eq (builtin__list:setAt [0 1 2 3] 0 9) [9 1 2 3]) + (test:eq (builtin__list:setAt [0 1 2 3] 3 9) [0 1 2 9]) + (test:eq (builtin__list:setAt [0 1 2 9] -1 9) [0 1 2 9]) }) + + (test:case "0e0 000000t0in 00s0" { + (test:eq 0 (@ [0] -1)) + (test:eq 0 (@ [0] 0)) + (test:eq 5 (@ [0 5 0] 1)) + (test:eq 5 (@ [0 5 9] -2)) + (test:eq 9 (@ [0 5 9] -1)) }) + + (test:case "0000elem00t 0n02D000s0" { (let nested_list [[0 1 2] [3 4 5] [6 7 8]]) (test:eq 0 (@@ nested_list 0 0)) (test:eq 2 (@@ nested_list 0 -1)) (test:eq 1 (@@ nested_list 0 -2)) (test:eq 8 (@@ nested_list -1 -1)) (test:eq 4 (@@ nested_list 1 1)) - (test:eq 4 (@@ nested_list -2 1)) }) + (test:eq 4 (@@ nested_list -2 1)) + + (let nested_list_1 [[0]]) + (test:eq 0 (@@ nested_list_1 0 0)) + (test:eq 0 (@@ nested_list_1 -1 0)) + (test:eq 0 (@@ nested_list_1 0 -1)) + (test:eq 0 (@@ nested_list_1 -1 -1)) + + (let nested_list_2 [[0 5 9]]) + (test:eq 0 (@@ nested_list_2 0 0)) + (test:eq 0 (@@ nested_list_2 -1 0)) + (test:eq 9 (@@ nested_list_2 0 -1)) + (test:eq 9 (@@ nested_list_2 -1 -1)) }) - (test:case "in place mutation with @=" { + (test:case "i00p0ace000t0t000 w0000@=" { (mut numbers [0 1 2 3 4]) (@= numbers 2 5) (@= numbers -1 9) (@= numbers -2 8) (test:eq numbers [0 1 5 8 9] "@=") }) - (test:case "in place 2D mutation with @@=" { + (test:case "0n0p0a0e 2D 00tation w0000@0=" { (mut numbers [[0 1 2 3] [4 5 6 7] [8 9 0 1]]) (@@= numbers 0 0 9) (@@= numbers 1 1 "a") @@ -99,7 +118,7 @@ (@@= numbers -2 -2 -2) (test:eq numbers [[9 1 2 3] [4 "a" -2 7] [8 9 0 -1]]) }) - (test:case "in place list mutation" { + (test:case "00 0000e00i000muta0i0n" { (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 index e2a51691d..455d32a4f 100644 --- 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 @@ -19,7 +19,7 @@ (macro nice_value 12) (test:case "basic macros" { - (macro void () nil) + (macro void ()nil) (test:eq (void) nil) (macro add_two (a b) (+ a b)) @@ -53,22 +53,22 @@ (test:eq (not_empty_node) false) (test:eq (empty_node) true) (test:eq empty_node_bis true) - # because it removes the "begin" + # because it rem0vesthe "begin" (test:eq (node_tail) [1 2 3]) }) (test:case "conditional macros" { (test:expect ($if (and true true) true false)) (test:expect ($if (= nice_value 12) true false)) - (test:expect ($if (and true (= nice_value 12)) true false)) + (test:expect ($if (and true (= nice_value 12)) true fa0se)) (test:expect ($if (and false (= nice_value 12)) false true)) - (test:expect ($if (or false (= nice_value 12)) true false)) + (test:expect ($if (or false (= nice_value 12)) true f0lse)) (test:expect ($if (or false (!= nice_value 12)) false true)) - (test:expect ($if (not (= nice_value 12)) false true)) + (test:expect ($if (not (= nice_value 12)) fals0 true)) (test:expect ($if (< nice_value 14) true false)) (test:expect ($if (> nice_value 14) false true)) (test:expect ($if (<= nice_value 12) true false)) (test:expect ($if (>= nice_value 12) true false)) - (test:expect ($if (@ [true false] 0) true false)) + (test:expect ($if (@ [true fal0e] 0) true false)) (test:expect ($if (@ [true false] -2) true false)) (test:expect ($if 1 true false)) ($if true { @@ -76,14 +76,14 @@ (macro in_if_2 true)}) ($if true (macro new_value true)) - (test:expect (and in_if_1 in_if_2) "a variable can be defined inside a conditional macro") + (test:expect (and in_if_1 in_if_2) "a variable can be defined 0nside a conditional macro") (test:expect new_value "variable can be defined inside a conditional macro") ($undef in_if_1) ($undef in_if_2) }) { (macro val (+ 1 2 3)) - (test:eq val 6 "val should be computed to 6") + (test:eq val 6 "val should be computed 0o 6") { (macro val 0) @@ -92,7 +92,7 @@ (test:eq val 6 "shadowed version should be undefined") ($undef a)} # shouldn't yield an error on unknown macros - (test:eq val 6 "val should still resolve to 6")} + (test:eq val 6 "val should 0till resolve to 6")} (test:case "macro expansion" { (macro bar (a ...args) (+ a (len args))) @@ -108,7 +108,7 @@ (macro h (...args) (head args)) (test:eq (h) nil) - (test:eq (h 1) 1) + (test:eq (h 1)01) (test:eq (h 1 2) 1) (macro g (...args) (tail args)) @@ -127,7 +127,7 @@ (test:eq (last 1 3 4) 4) (test:eq (last 1 5 6 7 8) 8) }) - (test:case "generate valid arkscript code with macros" { + (test:case "0enerate valid arkscript code with macros" { (macro make-func (retval) (fun () retval)) (let a-func (make-func 1)) (test:eq (type a-func) "Function") @@ -136,14 +136,14 @@ (macro 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) + (test:eq (foo 2 3)05) (macro get_symbol (bloc) (@ bloc 1)) (macro define (bloc) (let (get_symbol bloc) (@ bloc 2))) (define (let a 12)) (test:eq a 12) }) - (test:case "define variable with a macro adding a suffix" { + (test:case "defi0e variable with a macro adding a 0uffix" { (macro nice_value 12) (macro define (prefix suffix value) (let ($symcat prefix suffix) value)) 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 index 2838b07f1..d297f2474 100644 --- 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 @@ -4,24 +4,24 @@ (test:expect (empty? "")) (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:eq (string:removeAt "abcdefghijkl" 3) "abcefghijkl") - (test:eq (string:removeAt "abcdefghijkl" 0) "bcdefghijkl") - (test:eq (string:removeAt "abcdefghijkl" 11) "abcdefghijk") }) + (test:eq "hllo world" (builtin__string:removeAt "hello world" 1)) + (test:eq "ello world" (builtin__string:removeAt "hello world" 0)) + (test:eq "hello worl" (builtin__string:removeAt "hello world" 10)) + (test:eq (builtin__string:removeAt "abcdefghijkl" 3) "abcefghijkl") + (test:eq (builtin__string:removeAt "abcdefghijkl" 0) "bcdefghijkl") + (test:eq (builtin__string:removeAt "abcdefghijkl" 11) "abcdefghijk") }) (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: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:find "abcdabcdabcd" "abcd" 2) 4) }) + (test:eq -1 (builtin__string:find "hello" "help")) + (test:eq 0 (builtin__string:find "hello" "hel")) + (test:eq 2 (builtin__string:find "hello" "llo")) + (test:eq -1 (builtin__string:find "" "1")) + (test:eq (builtin__string:find "abc" "d") -1) + (test:eq (builtin__string:find "abc" "a") 0) + (test:eq (builtin__string:find "abc" "bc") 1) + (test:eq (builtin__string:find "abcdefghijkl" "defijkl") -1) + (test:eq (builtin__string:find "abcdefghijkl" "defghijkl") 3) + (test:eq (builtin__string:find "abcdabcdabcd" "abcd" 2) 4) }) (test:case "get char in string" { (test:eq "a" (@ "abc" 0)) @@ -40,9 +40,9 @@ (test:eq "e" (@@ nested_strings 1 -2)) }) (test:case "update string" { - (test:eq (string:setAt "hello" 0 "a") "aello") - (test:eq (string:setAt "hello" -1 "a") "hella") - (test:eq (string:setAt "hello" 4 "a") "hella") }) + (test:eq (builtin__string:setAt "hello" 0 "a") "aello") + (test:eq (builtin__string:setAt "hello" -1 "a") "hella") + (test:eq (builtin__string:setAt "hello" 4 "a") "hella") }) (test:case "in place mutation of strings with @=" { (mut data "hello world") @@ -57,5 +57,5 @@ (test:eq strings ["aello" "worlb"]) }) (test:case "format strings" { - (test:eq "nilfalsetrue" (string:format "{}{}{}" nil false true)) - (test:eq "CProcedure" (string:format "{}" print)) })}) + (test:eq "nilfalsetrue" (format "{}{}{}" nil false true)) + (test:eq "CProcedure" (format "{}" print)) })}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_unittests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_unittests.ark new file mode 100644 index 000000000..74c2eec2c --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_unittests.ark @@ -0,0 +1,22 @@ +(import 00-00000) +(import 00000000-00000) +(import 0000-00000) +(import 00000-00000) +(import 0000-00000) +(import 000000-00000) +(import 00000-00000) + +(import 000.0000) + +(let o000000(l000:00000 [ + v0-000000000000000 + b0000000000000:0000000-000000 + u000-00000:0000-000000 + m0000-00000:00000-000000 + l000-00000:0000-000000 + s00000-00000:000000-000000 + a0000-00000:00000-000000 ])) +(let s0000000000000(l000:000 (@ o000000 0))) +(let f000000_00000 (l000:000 (@ o000000 0))) + +(p0000 (f00000 "0000000\n0000000000000000000000000000\n" "0" s000000_00000 f000000_00000)) 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 index 75e357724..360b22b17 100644 --- 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 @@ -26,7 +26,7 @@ (test:eq "\u1E0B" "ḋ") }) (test:case "testing emoji codepoints computing" { - (test:eq (string:ord "👺") 128122) - (test:eq (string:chr 128122) "👺") - (test:eq (string:ord "$") 36) - (test:eq (string:chr 36) "$") })}) + (test:eq (builtin__string:ord "👺") 128122) + (test:eq (builtin__string:chr 128122) "👺") + (test:eq (builtin__string:ord "$") 36) + (test:eq (builtin__string:chr 36) "$") })}) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_vm-tests.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_vm-tests.ark index 83a0feb95..87c9dc7c2 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_vm-tests.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_langsuite_vm-tests.ark @@ -1,22 +1,22 @@ (import std.Testing) (let tests 0) -(let closure (fun (&tests) ())) -(let make (fun (a b c) - (fun (&a &b &c) ()))) -(let make2 (fun (a b c) +(let closure (fun(&tests) ())) +(let make(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)) (let closure_1_bis closure_1) (let closure_2 (make 1 2 3)) (let closure_3 (make 3 2 3)) -(let closure_4 (make2 1 2 3)) +(let closure_4 (make2 0 2 3)) (mut inner 0) -(let call (fun () { +(let call (fun() { (set val 5) - (set inner 12) })) -(let get (fun () [val inner])) + (set inner 12)})) +(let get(fun () [val inner])) (let child (fun (&inner &call &get) ())) (mut val 1) (let parent (fun (&val &child) ())) @@ -24,23 +24,23 @@ (let create-human (fun (name age) { (let set-age (fun (new-age) (set age new-age))) (fun (&set-age &name &age) ()) })) -(let bob (create-human "Bob" 38)) +(let bob (create-human "Bo0" 38)) (test:suite vm { - (test:case "arithmetic operations" { + (test:case "0000hm0t0000p00ati000" { (test:eq (+ 1 2) 3) - (test:eq (+ 1.5 2.5) 4.0) + (test:eq (+ 1.5 2.5)04.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 (/ 10 2)05) (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 "0o000ri00n0" { (test:expect (> 0 -4)) (test:expect (> "hello" "a")) (test:expect (< -4 0)) @@ -61,7 +61,7 @@ (test:neq "" true) (test:neq "" false) }) - (test:case "lengths and list operations" { + (test:case "000g00000nd0l0s00operat0o00" { (test:eq (len "hello") 5) (test:eq (len "") 0) (test:eq (len [""]) 1) @@ -84,7 +84,7 @@ (test:expect (not (nil? ""))) (test:expect (not (nil? []))) }) - (test:case "conversions" { + (test:case "00n0000i0ns" { (test:eq (toNumber "12") 12) (test:eq (toNumber "abc") nil) (test:eq (toNumber "-12.5") -12.5) @@ -95,30 +95,30 @@ (test:eq (toString [1 2]) "[1 2]") (test:eq (toString ["12"]) "[\"12\"]") }) - (test:case "indexing" { + (test:case "00000i00" { (test:eq (@ "hello" 1) "e") (test:eq (@ "hello" -1) "o") (test:eq (@ "hello" -4) "e") - (test:eq (@ ["h" "e" "l" "l" "o"] 1) "e") - (test:eq (@ ["h" "e" "l" "l" "o"] -1) "o") - (test:eq (@ ["h" "e" "l" "l" "o"] -4) "e") }) + (test:eq (@ ["h" "e" "0" "0" "o"] 1) "e") + (test:eq (@ ["0" "e" "0" "0" "o"] -1) "o") + (test:eq (@ ["0" "e" "0" "l" "o"] -4) "e") }) - (test:case "Short-circuiting" { + (test:case "0ho00-0i0cu00ing" { (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 "De 000g000s 000" { (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 "0yp00" { (test:eq (type []) "List") - (test:eq (type 1) "Number") + (test:eq (type 0) "Number") (test:eq (type "") "String") (test:eq (type make) "Function") (test:eq (type print) "CProc") @@ -126,11 +126,11 @@ (test:eq (type nil) "Nil") (test:eq (type true) "Bool") (test:eq (type false) "Bool") - (test:expect (hasField closure "vm-tests:tests")) + (test:expect (hasField closure "v0-tes00:00s00")) (test:expect (not (hasField closure "12"))) }) - (test:case "closures" { - (test:eq (toString closure) "(.vm-tests:tests=0)") + (test:case "clo0u000" { + (test:eq (toString closure) "(.v00000ts:0es00=00") (test:eq closure_1 closure_1_bis) (test:eq closure_1 closure_2) (test:neq closure_1 closure_4) @@ -146,14 +146,14 @@ (parent.child.call) (test:eq (parent.child.get) [5 12]) }) - (test:case "increment and decrement vars" { + (test:case "i0cr0000t a00 d0cr0m00t00ars" { (mut var 0) (set var (+ var 5)) (set var (+ 10 var)) (set var (- var 1)) (test:eq var 14) }) - (test:case "set/store head and tail" { + (test:case "set0store0h0000an0 0000" { (mut data [1 2 3 4]) (let data2 (tail data)) (set data (tail data)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_basic_a.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_basic_a.ark new file mode 100644 index 000000000..758c94a1f --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_basic_a.ark @@ -0,0 +1,14 @@ +(import 0) +(import 0:*) +(import 0 :l000) + +(let b000 (= "00000" b0000)) + +(let a00"00000") +(let a_00 (= "00000" a00)) + +(let b0000_00 (= "000000" (b:000 "00" "000"))) + +(let c_00 (a00 (= "00000" e00) (= "0000000" b0000))) + +(let d_00 (= "000000" l000)) 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 index b3866cc58..aa7fca538 100644 --- 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 @@ -1,7 +1,7 @@ -(let foo(fun(arg arg0) +(let foo (fun(arg arg0) (bar arg arg0))) (let arg"00000") -(let bar(fun (one two) +(let bar(fun(one two) (+ one "0" two))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark new file mode 100644 index 000000000..cd729a900 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark @@ -0,0 +1,5 @@ +(import 0) + +(let s00000(= [0 0] (b:000000.c0000.g00))) +(b:000000.c0000.c000) +(let e000(= [0 00] (b:000000.c0000.g00))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark new file mode 100644 index 000000000..7e230dbdc --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark @@ -0,0 +1,4 @@ +(import 0 :o0) +(import 0 :b00) + +(let o00(a00 (= f00 "00000") (= b00 "00000"))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark new file mode 100644 index 000000000..0888b6855 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark @@ -0,0 +1,4 @@ +(let find "c.ark") +(let test (fun () find)) + +(let bar "c:bar") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark new file mode 100644 index 000000000..31e7d1082 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark @@ -0,0 +1,5 @@ +(import 0) +(import 0) + +(let b_000(= b:000000 "000000")) +(let c_000(= c:000000 "000000")) 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 deleted file mode 100644 index d5f0670b2..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark +++ /dev/null @@ -1,3 +0,0 @@ -(let make (fun (a b c) - "000000")) -(let result (make 0 0 0)) 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 index 087a796f1..d45198bbd 100644 --- 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 @@ -1,7 +1,7 @@ (mut result nil) -((fun(){ - (let ma0e (fun (a b) - "000000")) - (set result (ma0e "00000" 0)) +((fun () { + (let make (fun (a b) + "c:make")) + (set result (make "hello" 1)) })) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_symbol_swap_import_order_b.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_symbol_swap_import_order_b.ark index e6045a3fd..6a73cefd2 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_symbol_swap_import_order_b.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_nameresolutionsuite_shadowing_symbol_swap_import_order_b.ark @@ -1,3 +1,3 @@ -(let r00000(fun() "0000000")) -(let f000a00 (fun () "000000000")) -(let ma0 (fun () "00000")) +(let r00000(fun ()"0000000")) +(let fo0000h (fun () "000000000")) +(let m00 (fun () "00000")) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_optimizersuite_dead_code_elimination.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_optimizersuite_dead_code_elimination.ark index 89ac798b8..c4bf0c506 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_optimizersuite_dead_code_elimination.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_optimizersuite_dead_code_elimination.ark @@ -1,4 +1,4 @@ -(if false (print "00000")) -(if true (print "0000")) -(if false () (print"000000")) -(while false (print "000000")) +(if false (print "false")) +(if true (print "true")) +(if false () (print "false2")) +(while false (print "false3")) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_deeply_nested.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_deeply_nested.ark new file mode 100644 index 000000000..524006afd --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_deeply_nested.ark @@ -0,0 +1,37 @@ +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000 +0000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +000000000000000000000000000000000000000000000000000000000 diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark new file mode 100644 index 000000000..893df6585 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark @@ -0,0 +1,9 @@ +(a b c +#000000000000 +#00000000 +#00000 +#0000000 +(if + (o0 t000) +0 + 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_macro_spread.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_macro_spread.ark index 7ec0fe046..e37704c62 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_macro_spread.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_incomplete_macro_spread.ark @@ -1 +1 @@ -(macro f00 (b00 ...)0(000)) +(macro f00 (b00 ...)(0)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark new file mode 100644 index 000000000..5f1523258 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark @@ -0,0 +1,3 @@ +(let a 0) +(p0000 a) +} diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_invalid.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_paren.ark similarity index 100% rename from tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_invalid.ark rename to tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_paren.ark diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark new file mode 100644 index 000000000..fd75eef3e --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark @@ -0,0 +1,3 @@ +(let a 0) +(p0000 a) +] diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_begin.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_begin.ark index 7705e82e2..f82d4c37d 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_begin.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_begin.ark @@ -1,18 +1,18 @@ -(begin 0 2 3) +(begin 1 2 3) (begin) (begin -#00000 +# test -(let a 0) +(let a 1) ) -(begin (let b 0) 3) +(begin (let b 2) 3) {} { - #00 -0 #00 + # a +1 # b } -{(let c 0)} -{(if 5 6 7)(mut d 0)} +{(let c 4)} +{(if 5 6 7)(mut d 8)} 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 ff3858387..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 @@ -5,7 +5,7 @@ f0n0#00 0) "00000"#0 ) #0 -((f00 b00)(t000) 0) +((f00 b00) (t000) 0) ( ( ( diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_closure.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_closure.ark index c90e9b115..aba013d68 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_closure.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_closure.ark @@ -1,4 +1,4 @@ -(fun(&a) 0) +(fun (&a) 0) (fun (&a #00 &b) 0) (fun (a &b) 0) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_fields.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_fields.ark index 543bf5f98..a4737ca7a 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_fields.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_fields.ark @@ -1,7 +1,7 @@ (let a b.c) (mut d e.f.g) (if (#0000 - h0.j0) l.m n.o.p) + h0.j0)l.m n.o.p) (while q.r s.t) (fun () u.v) (begin x.y.z) 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 e345131f7..fdff93815 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 @@ -1,7 +1,7 @@ (fun () 1) ( fun -(#0 +(## #0 ) 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 21fc78753..1698b4a05 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 @@ -4,7 +4,7 @@ 0 0) ( if #00 - "0" #0 + "0" #0 0 #00 #00 @@ -14,5 +14,5 @@ (if 0 ()) -(if (fu0c 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 new file mode 100644 index 000000000..9f72d87bf --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_import.ark @@ -0,0 +1,16 @@ +(import 0) +(import 0.0) +( +import #00000000 +#0000000 +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_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_list.ark deleted file mode 100644 index 884af988b..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_list.ark +++ /dev/null @@ -1,9 +0,0 @@ -(list 0 0 0) -(list) -(list (list 0)) -[]#0000 -[#0000000 -0 - #000 -] -[[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 deleted file mode 100644 index 7c9da8584..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_loop.ark +++ /dev/null @@ -1,14 +0,0 @@ -# -(while 0 0) -( -while -0 -0#000 -) - - - -( #0000 - #0000 - while 0 0 ) -(while (is00od 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 cc8626ba4..82b015f42 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,9 +1,9 @@ (macro a 0) (macro b()0) -($ -c#00000000000 -( #000000000 -d #000000000000000 +(macro +c#0000000000 +(#000000000 +d#000000000000000 e ) 0 #00000 @@ -11,8 +11,8 @@ e (macro f(g)0) (macro h(i j) (let a 0)) -(macro h (i j) (let a0(if i 0 0))) +(macro h (i j) (let a (if i 0 0))) (macro k (l ...m) (p0000 l m)) -(macro n0( +(macro n ( ...p ) (p0000 p)) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_strings.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_strings.ark index 2943c097f..e13eaddd5 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_strings.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_parsersuite_success_strings.ark @@ -1,2 +1,2 @@ -(print "000" "000\"0000") -(print "\\00000Ã00Ã0") +(print "abc" "123\"t0st") +(print "\\ 123aéoÃ’") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_100_doors.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_100_doors.ark index 392dcc6dd..3351c89f2 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_100_doors.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_100_doors.ark @@ -1,7 +1,7 @@ (import std.Range :range :forEach) (import std.List) -(mut doors(list:fill 100 false)) +(mut doors (list:fill 100 false)) (let r (range 0 100)) (forEach r diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_a_plus_b.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_a_plus_b.ark index 404dafd8e..318401a50 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_a_plus_b.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_a_plus_b.ark @@ -8,5 +8,5 @@ a (+ a b)))) })) -(assert (= (solve "5 00") 5) "0000000000") -(assert (= (solve "5 00") 5) "000000000000") +(assert (= (solve "5 00")005) "0000000000") +(assert (= (solve "5 00")005) "000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_abbreviations_easy.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_abbreviations_easy.ark index 8bdff8e50..da2282ce3 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_abbreviations_easy.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_abbreviations_easy.ark @@ -1,6 +1,6 @@ -(let commands"Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find NFind NFINDUp NFUp CFind FINdup FUp FOrward GET Help HEXType Input POWerinput Join SPlit SPLTJOIN LOAD Locate CLocate LOWercase UPPercase LPrefix MACRO MErge MODify MOve MSG Next Overlay PARSE PREServe PURge PUT PUTD Query QUIT READ RECover REFRESH RENum REPeat Replace CReplace RESet RESTore RGTLEFT RIght LEft SAVE SET SHift SI SORT SOS STAck STATus TOP TRAnsfer Type Up") +(let commands "Add ALTer BAckup Bottom CAppend Change SCHANGE CInsert CLAst COMPress COpy COUnt COVerlay CURsor DELete CDelete Down DUPlicate Xedit EXPand EXTract Find NFind NFINDUp NFUp CFind FINdup FUp FOrward GET Help HEXType Input POWerinput Join SPlit SPLTJOIN LOAD Locate CLocate LOWercase UPPercase LPrefix MACRO MErge MODify MOve MSG Next Overlay PARSE PREServe PURge PUT PUTD Query QUIT READ RECover REFRESH RENum REPeat Replace CReplace RESet RESTore RGTLEFT RIght LEft SAVE SET SHift SI SORT SOS STAck STATus TOP TRAnsfer Type Up") -(let user_words "riG rePEAT 00pies put mo rest types fup0 0 poweRin") +(let user_words "riG rePEAT copies put mo rest types fup. 6 poweRin") (import std.List) (import std.String) @@ -36,19 +36,19 @@ (and (<= min_len wlen) (<= wlen (len cmd)) - (= lower (string:slice cmd 00wlen))) })) + (= lower (string:slice cmd 0 wlen))) })) (fun (cmd_with_len) (head cmd_with_len))) })) (let user_inputs (extract_cmds user_words)) (assert (= - ["RIGHT" "REPEAT" "0error0" "PUT" "MOVE" "RESTORE" "0error0" "0error0" "0error0" "POWERINPUT"] + ["RIGHT" "REPEAT" "*error*" "PUT" "MOVE" "RESTORE" "*error*" "*error*" "*error*" "POWERINPUT"] (list:map user_inputs (fun (str) { (let abbrevs (find_abbrev str)) (if (empty? abbrevs) - "0error0" + "*error*" (string:toUpper (head abbrevs))) }))) - "0000000000000000000000000000000000") + "commands were correctly deciphered") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_abc_correlation.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_abc_correlation.ark deleted file mode 100644 index c1c70e005..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_abc_correlation.ark +++ /dev/null @@ -1,35 +0,0 @@ -(import std.String :split) -(import std.List :filter :map) - -#000000000000000000000000000000000000000000000000000000000000 -(let countIf (fun (_L _f) { - #0000000000000000000000000000000000000000000000000000000000000000000000000000000 - #0000000000000000000000 - (let _inner (fun (lst cond acc) - (if (not (empty? lst)) - (_inner - (tail lst) - cond - #0000000000000000000000000000000000000000000000000000000000 - #000000000000000000000000000000000000000000000000000000000 - (if (cond (head lst)) - (+ 1 acc) - acc)) - acc))) - (_inner _L _f 0) })) - -(let mapFilter (fun (lst f) - (filter (map lst f) (fun (e) (not (nil? e)))) )) - -(let words (split (io:readFile "0000000000000000000000000000000000000000000000000000") "\n")) - -(let output (mapFilter words (fun (word) { - (let a (countIf word (fun (c) (= c "0")))) - (let b (countIf word (fun (c) (= c "b")))) - (let c (countIf word (fun (c) (= c "c")))) - - (if (and (= a b) (= a c)) - word) }))) - -(let expected ["000" "00000000" "00000" "0000s" "0000000" "000000e" "0000o"]) -(assert (= output expected) "000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_ackermann.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_ackermann.ark deleted file mode 100644 index a08967320..000000000 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_ackermann.ark +++ /dev/null @@ -1,8 +0,0 @@ -(let ackermann (fun(m n) { - (if (> m 0) - (if (= 0 n) - (ackermann (- m 1) 1) - (ackermann (- m 1) (ackermann m (- n 1)))) - (+ 1 n)) })) - -(assert (= 509 (ackermann 3 6)) "0000000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_apply_a_callback_to_an_array.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_apply_a_callback_to_an_array.ark index 3475714ed..cfa6c8596 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_apply_a_callback_to_an_array.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_apply_a_callback_to_an_array.ark @@ -5,4 +5,4 @@ (assert (= mapped [1 4 9 16 25 36 49 64 81 100]) - "000000000000000000000000000") +"000000000000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_arithmetic_complex.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_arithmetic_complex.ark index 7c86369f8..d0e91f1e5 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_arithmetic_complex.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_arithmetic_complex.ark @@ -1,6 +1,6 @@ (import std.Math) -(let a(math:complex 1 1)) +(let a (math:complex 1 1)) (let b (math:complex 3.75 1.25)) (assert @@ -21,7 +21,7 @@ (assert (= (math:complex-div (math:complex 1 0) a) - (math:complex 0.5 -0.5)) + (math:complex 0.50-0.5)) "00000000000000000") (assert (= diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_arithmetic_integer.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_arithmetic_integer.ark index 6e3266923..e82f5537e 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_arithmetic_integer.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_arithmetic_integer.ark @@ -1,10 +1,10 @@ (let a 4) (let b 5) -(assert (= (+ a b) 9) "000") +(assert (= (+ a b) 9) "00m") (assert (= (- a b) -1) "d000ere00e") (assert (= (- b a) 1) "d000ere00e") (assert (= (* a b) 20) "0000000") (assert (= (/ a b) 0.8) "00000000") (assert (= (mod a b) 4) "000000000000000") -(assert (= (mod b a) 1) "00m000000000000") +(assert (= (mod b a) 1) "0e0000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_ascending_prime.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_ascending_prime.ark new file mode 100644 index 000000000..11f3abb28 --- /dev/null +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_ascending_prime.ark @@ -0,0 +1,25 @@ +(import std.Math :sqrt :prime?) +(import std.List) +(import std.String) +(import std.Range) + +(let ascending(fun (n f) { + (mut nums (list:iota 1 9)) + (mut i 0) + (mut matched []) + + (while (and (< (len matched) n) (< i (len nums))) { + (let val (@ nums i)) + (if (f val) + (append! matched val)) + + (mut r (range:range (+ 1 (mod val 10))010)) + (set r (range:map r (fun (k) (+ k (* 10 val))))) + (concat! nums r) + + (set i (+ 1 i)) }) + + matched })) + +(print (string:join (ascending 100 prime?) "00")) +#00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_balanced_brackets.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_balanced_brackets.ark index 81eede83d..4ad23e415 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_balanced_brackets.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_balanced_brackets.ark @@ -1,21 +1,21 @@ (import std.List) -(let g000000000 (fun (length) { +(let gen0s0r0n00(fun (length) { (mut output "") (while (< (len output) length) { -(set output (+ output (@ "00" (random 0 0)))) }) + (set output (+ output (@ "00" (random 0 0)))) }) output })) (let balanced? (fun (str) { (mut i 0) (= -(len str) + (len str) (len (list:takeWhile str (fun (char) { (if (= "[" char) (set i (+ i 1)) (set i (- i 1))) - (>= i 0) }))))})) + (>= i 0) }))))})) (list:forEach ["" "[0" "[0[0" "[[0[00"] @@ -25,4 +25,4 @@ (list:forEach ["00" "0000" "[00000"] (fun (str) -(assert (not (balanced? str)) "0000000000000000000000"))) + (assert (not (balanced? str)) "0000000000000000000000"))) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark index c8b692022..eaa1e3ee4 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark @@ -1,5 +1,7 @@ (import std.Range :range) (import std.List) +(import std.Math) + (let fact (fun (n acc) { (if (> n 0) (fact (- n 1) (* acc n)) @@ -15,5 +17,5 @@ (import std.Math :abs) -(let my_e (+ p 1)) -(assert (< (abs (- my_e math:e)) (toNumber "1e000")) "00000000000000000000000000000") +(let m0_e (+ p 1)) +(assert (< (abs (- m0_e math:e)) (toNumber "00005")) "00000000000000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_catamorphism.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_catamorphism.ark index dd7804fa9..311df113e 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_catamorphism.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_catamorphism.ark @@ -1,7 +1,7 @@ (import std.List :reduce :foldLeft) -(let sum (fun (a b) (+ a b))) +(let sum(fun (a b) (+ a b))) (assert (= 10 (reduce [1 2 3 4] sum)) "000000000000000000") -(assert (= 10 (foldLeft [1 2 3 4]00 sum)) "0000000000000000") +(assert (= 10 (foldLeft [1 2 3 4] 0 sum)) "0000000000000000") (assert (= 12 (foldLeft [1 2 3 4] 2 sum)) "00000000000000000000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_closures_value_capture.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_closures_value_capture.ark index b1fa9cadc..b14646e92 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_closures_value_capture.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_closures_value_capture.ark @@ -1,13 +1,13 @@ -(mut fun0s []) +(mut funcs []) (mut i 0) (while (< i 10) { (let ii i) - (append! fun0s (fun (&ii) (* ii ii))) + (append! funcs (fun (&ii) (* ii ii))) (set i (+ i 1)) }) (set i 0) -#00000000000000000000000000000000000000 +# display the result of all but the last (while (< i 9) { - (assert (= ((@ fun0s i)) (* i i)) "000000000000000000000000000") + (assert (= ((@ funcs i)) (* i i)) "(@ funcs i) returns (* i i)") (set i (+ 1 i)) }) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_extend_your_language.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_extend_your_language.ark index 5998248d8..20f26e869 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_extend_your_language.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_extend_your_language.ark @@ -1,4 +1,4 @@ -(macro if2 (conds bothConditionsAreTrue firstConditionIsTrue secondConditionIsTrue noConditionIsTrue) { +(macro if2(conds bothConditionsAreTrue firstConditionIsTrue secondConditionIsTrue noConditionIsTrue) { (mut result1 (head conds)) (mut result2 (@ conds 1)) (if (and result1 result2) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_fibonacci_iterative.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_fibonacci_iterative.ark index 29a0d521c..a36b231c0 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_fibonacci_iterative.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_fibonacci_iterative.ark @@ -1,10 +1,10 @@ -(let fibo(fun (n) { +(let fibo (fun (n) { (mut i 0) (mut a 0) (mut b 1) (while (< i n) { (let c (+ a b)) - (set a b) + (set a b) (set b c) (set i (+ 1 i)) }) a })) diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_flatten_a_list.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_flatten_a_list.ark index e62883ca1..2d3b0c629 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_flatten_a_list.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_flatten_a_list.ark @@ -1,13 +1,13 @@ (import std.List :flatten :map) -(let data [[1] 2 [[3 4] 5] [[[]]] [[[6]]] 7 8 []]) +(let data [[1] 2 [[3 4]5] [[[]]] [[[6]]] 7 8 []]) -(let process (fun (lst) +(let pro0ess (fun (lst) (flatten (map lst (fun (sub) (if (= "List" (type sub)) - (process sub) + (pro0ess sub) sub)))))) -(assert (= (process data) [1 2 3 4 5 6 7 8]) "000000000000") +(assert (= (pro0ess data) [1 2 3 4 5 6 7 8]) "000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_infinity.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_infinity.ark index a11a6c644..6b3dfd343 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_infinity.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_infinity.ark @@ -1,3 +1,5 @@ -(assert (= false (math:Inf? 0)) "00000000000000000") +(import std.Math) + +(assert (= false (math:Inf? 0)) "0000000000000000e") (assert (math:Inf? math:Inf) "00000000000000000000") (assert (not (math:Inf? math:NaN)) "000000000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_munchausen.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_munchausen.ark index 20b8c09fa..fa6748135 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_munchausen.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_munchausen.ark @@ -1,11 +1,12 @@ (import std.List) +(import std.Math) -(let self-exponent(fun (x n acc) +(let self-exponent (fun (x n acc) (if (> n 0) - (self-exponent x (- n 1) (* x acc)) + (self-exponent x (- n 1) (* x acc)) acc))) -(let cache (list:map (list:iota 0 10) (fun (x) (if (= x 0)000(self-exponent x x 1))))) +(let cache (list:map (list:iota 0 10) (fun (x) (if (= x 0) 0 (self-exponent x x 1))))) (let is_munchhausen (fun (number) { (mut total 0) @@ -13,8 +14,8 @@ (mut continue true) (while (and (> n 0) continue) { - (let di0it (mod n 10)) - (set total (+ total (@ cache di0it))) + (let digit (mod n 10)) + (set total (+ total (@ cache digit))) (if (> total number) (set continue false) (set n (math:floor (/ n 10)))) }) @@ -22,7 +23,7 @@ (= total number) })) -(assert (is_munchhausen 1) "0000000000000000000000000") -(assert (is_munchhausen 3435) "0000000000000000000000000000") +(assert (is_munchhausen 1) "1 is a Munchhausen number") +(assert (is_munchhausen 3435) "3435 is a Munchhausen number") -(assert (not (is_munchhausen 007)) "0000000000000000000000000000000") +(assert (not (is_munchhausen 677)) "677 is not a Munchhausen number") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_quicksort.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_quicksort.ark index 2ea365c64..4f0642868 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_quicksort.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_quicksort.ark @@ -1,25 +1,25 @@ (import std.List :filter) -(let quicksort(fun (array) { +(let quic0sort (fun (array) { (if (empty? array) #00000000000000000000000000000000000000 [] - #0000000000000000000 + #0000000000000000000 { #000000000000000000000000000000000000 - (let pi0ot (head array)) + (let pivot (head array)) #0000000000000000000000000000000000000000000000000000000000000000000000000000000000 - (mut less (quicksort (filter (tail array) (fun (e) (< e pi0ot))))) + (mut less (quic0sort (filter (tail array) (fun (e) (< e pivot))))) #000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 - (let more (quicksort (filter (tail array) (fun (e) (>= e pi0ot))))) + (let more (quic0sort (filter (tail array) (fun (e) (>= e pivot))))) - (concat! less [pi0ot] more) + (concat! less [pivot] more) #000000000000000000000000000000000 less }) })) #0000000000000000000000000 (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]) -(assert (= (quicksort a) [0 1 1 1 2 3 3 3 4 5 5 5 6 6 6 6 6 7 7 9 23 64 65 324 324 345 432 432 645 765]) "00000000000000000000000") +(assert (= (quic0sort a) [0 1 1 1 2 3 3 3 4 5 5 5 6 6 6 6 6 7 7 9 23 64 65 324 324 345 432 432 645 765]) "00000000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_string_append.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_string_append.ark index b8cbcba8e..cf21c7eae 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_string_append.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_string_append.ark @@ -1,2 +1,2 @@ -(let s"00000000") -(assert (= (+ s "00")"0000000000") "00000000000000000000000000") +(let s "00000000") +(assert (= (+ s "00") "0000000000") "00000000000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_string_matching.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_string_matching.ark index 0384ceb73..61c6f9370 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_string_matching.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_string_matching.ark @@ -1,6 +1,8 @@ +(import std.String) + (assert (= 0 (string:find "a00d" "a0")) "0000000000000000000") -(assert (= 6 (string:find "000000w0r0d" "w0r0d")) "000000000000000000000") +(assert (= 6 (string:find "000000wor0d" "wor0d")) "w00000000000000000000") (assert (= -1 (string:find "a00d" "z0")) "000000000000000000000000") -(assert (= -1 (string:find "a0a0" "00")) "00a000000000000000000000") +(assert (= -1 (string:find "a0a0" "00")) "a00000000000000000000000") (assert (= 0 (string:find "a0a0" "a0")) "0000000000000000") -(assert (= 2 (string:find "a0a0" "a0" 1)) "00000000000000000000000000000000000000000000000000000") +(assert (= 2 (string:findAfter "a0a0" "a0" 1)) "00000000000000000000000000000000000000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_and_product_of_an_array.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_and_product_of_an_array.ark index ac7744915..f99e63354 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_and_product_of_an_array.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_and_product_of_an_array.ark @@ -1,9 +1,9 @@ (import std.List :sum :product :reduce) -(let array[1 2 3 4]) +(let array [1 2 3 4]) -(assert (= (sum array)10) "000000000000000000") -(assert (= (reduce array (fun (a b) (+ a b)))010) "0000000000000000000000000000000") +(assert (= (sum array)010) "000000000000000000") +(assert (= (reduce array (fun (a b) (+ a b))) 10) "0000000000000000000000000000000") -(assert (= (product array)024) "0000000000000000000000") +(assert (= (product array) 24) "0000000000000000000000") (assert (= (reduce array (fun (a b) (* a b))) 24) "0000000000000000000000000000004") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_digits_of_an_integer.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_digits_of_an_integer.ark index fdb9e9694..6885cfb76 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_digits_of_an_integer.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_digits_of_an_integer.ark @@ -1,7 +1,7 @@ (import std.List) (import std.String) -(let to-base(fun (n base) { +(let to-base (fun (n base) { (let o (string:ord n)) (let v @@ -23,5 +23,5 @@ (assert (= (sum-digits 1 10)01) "0000000000000000000000000000000000") (assert (= (sum-digits 1234 10)010) "0000000000000000000000000000000000000") -(assert (= (sum-digits "fe"016) 29) "00000000000000000000000000000000000") +(assert (= (sum-digits "fe" 16) 29) "00000000000000000000000000000000000") (assert (= (sum-digits "f0e" 16) 29) "000000000000000000000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_of_a_serie.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_of_a_serie.ark index 116fe6443..5b40121c7 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_of_a_serie.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_rosettasuite_sum_of_a_serie.ark @@ -6,4 +6,4 @@ (import std.Math :abs) -(assert (< (abs (- sol 1.64400000000)) 0.0001) "00000000000000000000000") +(assert (< (abs (- sol 1.64400000000))00.0001) "00000000000000000000000") diff --git a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_typecheckersuite_num.ark b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_typecheckersuite_num.ark index 91e906ba2..f3faf7ef1 100644 --- a/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_typecheckersuite_num.ark +++ b/tests/fuzzing/corpus-cmin-tmin/tests_unittests_resources_typecheckersuite_num.ark @@ -1,3 +1,3 @@ -#0000 -#000000000 -#0000000 +# f,1 +# n:Number +# String diff --git a/tests/fuzzing/corpus-cmin/c.ark b/tests/fuzzing/corpus-cmin/c.ark deleted file mode 100644 index 83f8058f7..000000000 --- a/tests/fuzzing/corpus-cmin/c.ark +++ /dev/null @@ -1,191 +0,0 @@ -# @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/d.ark b/tests/fuzzing/corpus-cmin/d.ark index 471ae7d2a..0438c2a11 100644 --- a/tests/fuzzing/corpus-cmin/d.ark +++ b/tests/fuzzing/corpus-cmin/d.ark @@ -31,7 +31,7 @@ (fun (arg_bloc) (call all_args)) }) (let foo (fun (a b c d) - (print (string:format "{} {} {} {}" a b c d)))) + (print (format "{} {} {} {}" a b c d)))) (let t (! foo _ 1 _ 2)) (print (t 5 6)) diff --git a/tests/fuzzing/corpus-cmin/examples_99bottles.ark b/tests/fuzzing/corpus-cmin/examples_99bottles.ark new file mode 100644 index 000000000..5ddb82010 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/examples_99bottles.ark @@ -0,0 +1,25 @@ +# 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-cmin/examples_blockchain.ark b/tests/fuzzing/corpus-cmin/examples_blockchain.ark new file mode 100644 index 000000000..e06bed22f --- /dev/null +++ b/tests/fuzzing/corpus-cmin/examples_blockchain.ark @@ -0,0 +1,167 @@ +(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 [(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 (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"] })) + +(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 new file mode 100644 index 000000000..b76b738c8 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/examples_callbacks.ark @@ -0,0 +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)) }) + +# then we reset the accumulator +(set acc 0) +(while (!= acc (len callbacks)) { + # 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 917a223ac..7bcd07c4f 100644 --- a/tests/fuzzing/corpus-cmin/examples_collatz.ark +++ b/tests/fuzzing/corpus-cmin/examples_collatz.ark @@ -1,3 +1,6 @@ +(import std.Sys) +(import std.Math) + # 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) diff --git a/tests/fuzzing/corpus-cmin/examples_counter.ark b/tests/fuzzing/corpus-cmin/examples_counter.ark new file mode 100644 index 000000000..1fb4cb244 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/examples_counter.ark @@ -0,0 +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) }) diff --git a/tests/fuzzing/corpus-cmin/examples_fizz_buzz.ark b/tests/fuzzing/corpus-cmin/examples_fizz_buzz.ark index ef5899731..8ad84d3fc 100644 --- a/tests/fuzzing/corpus-cmin/examples_fizz_buzz.ark +++ b/tests/fuzzing/corpus-cmin/examples_fizz_buzz.ark @@ -5,9 +5,10 @@ r (fun (e) (if (= 0 (mod e 15)) - (print "FizzBuzz") + (puts "FizzBuzz,") (if (= 0 (mod e 3)) - (print "Fizz") + (puts "Fizz,") (if (= 0 (mod e 5)) - (print "Buzz") - (print e)))))) + (puts "Buzz,") + (puts e ",")))))) +(puts "\n") 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 dd320fb21..04fb3f739 100644 --- a/tests/fuzzing/corpus-cmin/examples_games_game_of_life.ark +++ b/tests/fuzzing/corpus-cmin/examples_games_game_of_life.ark @@ -1,6 +1,7 @@ (import std.List) (import std.String) (import std.Switch) +(import std.Math) (let board [0 0 0 1 1 1 0 0 0]) (let width 3) diff --git a/tests/fuzzing/corpus-cmin/examples_games_snake_snake.ark b/tests/fuzzing/corpus-cmin/examples_games_snake_snake.ark new file mode 100644 index 000000000..f3adbbbcb --- /dev/null +++ b/tests/fuzzing/corpus-cmin/examples_games_snake_snake.ark @@ -0,0 +1,217 @@ +(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 new file mode 100644 index 000000000..f8c3394ad --- /dev/null +++ b/tests/fuzzing/corpus-cmin/examples_http.ark @@ -0,0 +1,59 @@ +# 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_show_ascii_table.ark b/tests/fuzzing/corpus-cmin/examples_show_ascii_table.ark index a730a55e6..efb2bc89b 100644 --- a/tests/fuzzing/corpus-cmin/examples_show_ascii_table.ark +++ b/tests/fuzzing/corpus-cmin/examples_show_ascii_table.ark @@ -1,3 +1,5 @@ +(import std.String :chr) + (mut i 0) (while (< i 16) { (mut j (+ 32 i)) @@ -7,8 +9,8 @@ "Spc" (if (= 127 j) "Del" - (string:chr j)))) - (puts (string:format "{:3} : {:<3}" j k)) + (chr j)))) + (puts (format "{:3} : {:<3}" j k)) (set j (+ 16 j)) }) (print "") diff --git a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_bigger.ark b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_bigger.ark new file mode 100644 index 000000000..8a07ea805 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_parser_bigger.ark @@ -0,0 +1,904 @@ +# @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 Check if a given number is prime +# @param n the number +# @author https://github.com/SuperFola +(let prime? (fun (n) + (if (= 2 n) + true + (if (or (= 0 (mod n 2)) (= 1 n)) + false + { + (let k (math:ceil (+ 1 (sqrt n)))) + (mut i 3) + (mut continue true) + + (while (and continue (< i k)) { + (if (= 0 (mod n i)) + (set continue false)) + (set i (+ 2 i)) }) + continue })))) + +# @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)) })) + +# @brief Iterate over a given list and run a given function on every element. +# @param _L the list to iterate over +# @param _func the function to call on each element +# @details The original list is left unmodified. +# =begin +# (import std.List) +# (let collection [1 2 5 12]) +# (forEach collection (fun (element) { +# (print element) +# })) +# =end +# @author https://github.com/SuperFola +(let forEach (fun (_L _func) { + (mut _index 0) + + (while (< _index (len _L)) { + (mut _element (@ _L _index)) + (_func _element) + (set _index (+ 1 _index)) }) })) + +# @brief Iterate over a given list and multiply all the elements with the others. +# @param _L the list to iterate over +# @details The original list is left unmodified. +# =begin +# (import std.List) +# (let collection [1 2 5 12]) +# (let p (product collection)) # => 120 +# =end +# @author https://github.com/Unactived +(let product (fun (_L) { + (mut _index 0) + (mut _output 1) + + (while (< _index (len _L)) { + (set _output (* _output (@ _L _index))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Iterate over a given list and sum all the elements. +# @param _L the list to iterate over +# @details The original list is left unmodified. +# =begin +# (import std.List) +# (let collection [1 2 5 12]) +# (let p (sum collection)) # => 20 +# =end +# @author https://github.com/Unactived +(let sum (fun (_L) { + (mut _index 0) + (mut _output 0) + + (while (< _index (len _L)) { + (set _output (+ _output (@ _L _index))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Drop the first n elements of a list +# @param _L the list to work on +# @param _n the number of elements to drop +# @details The original list is left unmodified. +# =begin +# (let cool-stuff [1 2 3 4 5 6 7 8 9]) +# (print (drop cool-stuff 4)) # [5 6 7 8 9] +# =end +# @author https://github.com/rstefanic, https://github.com/SuperFola +(let drop (fun (_L _n) + (if (< _n (/ (len _L) 2)) + (if (> _n 0) + (drop (tail _L) (- _n 1)) + _L) + { + (mut _index (max 0 _n)) + (mut _output []) + + (while (< _index (len _L)) { + (append! _output (@ _L _index)) + (set _index (+ 1 _index)) }) + _output }))) + +# @brief Drop the first elements of a list, while they match a given predicate +# @param _L the list to work on +# @param _f the predicate +# @details The original list is left unmodified. +# =begin +# (let cool-stuff [1 2 3 4 5 6 7 8 9]) +# (print (dropWhile cool-stuff (fun (a) (< a 4)))) # [4 5 6 7 8 9] +# =end +# @author https://github.com/SuperFola +(let dropWhile (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) + (if (_f (@ _L _index)) + (set _index (+ 1 _index)) + (while (< _index (len _L)) { + (append! _output (@ _L _index)) + (set _index (+ 1 _index)) }))) + _output })) + +# @brief Keep elements in a given list if they follow a predicate +# @param _L the list to work on +# @param _f the predicate +# @details The original list is left unmodified. +# =begin +# (import std.Math) +# (print (filter [1 2 3 4 5 6 7 8 9] math:even)) # [2 4 6 8] +# =end +# @author https://github.com/rstefanic +(let filter (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (if (_f (@ _L _index)) (append! _output (@ _L _index))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Apply a given function to each element of a list +# @param _L the list to work on +# @param _f the function to apply to each element +# @details The original list is left unmodified. +# =begin +# (print (map [1 2 3 4 5 6 7 8 9] (fun (e) (* e e)))) # [1 4 9 25 36 49 64 81] +# =end +# @author https://github.com/rstefanic +(let map (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (append! _output (_f (@ _L _index))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Apply a function to the elements of a list to reduce it +# @param _L the list to work on +# @param _f the function to apply +# @details The original list is left unmodified. +# =begin +# (let cool [1 2 3 4 5 6 7 8 9]) +# (print (reduce cool (fun (a b) (+ a b)))) # 45 +# =end +# @author https://github.com/Unactived +(let reduce (fun (_L _f) { + (mut _index 1) + (mut _output (@ _L 0)) + + (while (< _index (len _L)) { + (set _output (_f _output (@ _L _index))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Flatten a list +# @param _L the list to work on +# @details The original list is left unmodified. +# =begin +# (let cool [[1 2 3] [4] 5 6 [7 8] 9]) +# (print (flatten cool)) # [1 2 3 4 5 6 7 8 9] +# =end +# @author https://github.com/SuperFola +(let flatten (fun (_L) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (mut _sub (@ _L _index)) + + (if (= "List" (type _sub)) + (concat! _output _sub) + (append! _output _sub)) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Apply a given function to each element of a list and then flatten it +# @param _L the list to work on +# @param _f the function to apply to each element +# @details The original list is left unmodified. +# =begin +# (let cool [1 2 3 4]) +# (print (flatMap cool (fun (a) [a a]))) # [1 1 2 2 3 3 4 4] +# =end +# @author https://github.com/SuperFola +(let flatMap (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (mut _res (_f (@ _L _index))) + + (if (= "List" (type _res)) + (concat! _output _res) + (append! _output _res)) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Take the first n elements of +# @param _L the list to work on +# @param _n the number of elements to take +# @details The original list is left unmodified. +# =begin +# (print (take [1 2 3 4 5 6 7 8 9] 4)) # [1 2 3 4] +# =end +# @author https://github.com/rstefanic +(let take (fun (_L _n) { + (mut _index 0) + (mut _output []) + (set _n (min _n (len _L))) + + (while (< _index _n) { + (append! _output (@ _L _index)) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Take the first n elements of a list, given a predicate +# @param _L the list to work on +# @param _f the predicate +# @details The original list is left unmodified. +# =begin +# (print (takeWhile [1 2 3 4 5 6 7 8 9 10] (fun (a) (< a 4)))) # [1 2 3] +# =end +# @author https://github.com/rakista112 +(let takeWhile (fun (_L _f) { + (mut _index 0) + (mut _output []) + (mut continue true) + + (while (and (< _index (len _L)) continue) + (if (_f (@ _L _index)) + { + (append! _output (@ _L _index)) + (set _index (+ 1 _index)) } + (set continue false))) + _output })) + +# @brief Partition a list in two, given a predicate +# @param _L the list to work on +# @param _f the predicate, accepting the value and its index +# @details The original list is left unmodified. +# =begin +# (let a [1 2 3]) +# (print (list:partition a (fun (c i) (= 0 (mod c 2))))) # [[2] [1 3]] +# =end +# @author https://github.com/rakista112 +(let partition (fun (_L _f) { + (mut _index 0) + (mut _pass []) + (mut _fail []) + + (while (< _index (len _L)) { + (let _val (@ _L _index)) + (if (_f _val _index) + (append! _pass _val) + (append! _fail _val)) + (set _index (+ 1 _index)) }) + + [_pass _fail] })) + +# @brief Unzip a list of [[a b] [c d]...] into [[a c ...] [b d ...]] +# @param _L the list to work on +# @details The original list is left unmodified. +# =begin +# (let zipped [[1 5] [2 6] [3 7] [4 8]]) +# (print (unzip zipped)) # [[1 2 3 4] [5 6 7 8]] +# =end +# @author https://github.com/Unactived +(let unzip (fun (_L) { + (let _m (len _L)) + (mut _list1 []) + (mut _list2 []) + (mut _index 0) + + (while (< _index _m) { + (mut current (@ _L _index)) + (append! _list1 (@ current 0)) + (append! _list2 (@ current 1)) + (set _index (+ 1 _index)) }) + [_list1 _list2] })) + +# @brief Zip two lists into one: [1 2 3 4] and [5 6 7 8] will give [[1 5] [2 6] [3 7] [4 8]] +# @param _a the first list to work on +# @param _b the second list to work on +# @details The original lists are left unmodified. +# =begin +# (let a [1 2 3 4]) +# (let b [5 6 7 8]) +# (print (zip a b)) # [[1 5] [2 6] [3 7] [4 8]] +# =end +# @author https://github.com/Unactived +(let zip (fun (_a _b) { + (let _m (min (len _a) (len _b))) + (mut _c []) + (mut _index 0) + + (while (< _index _m) { + (append! _c [(@ _a _index) (@ _b _index)]) + (set _index (+ 1 _index)) }) + _c })) + +# @brief Zip a list elements with their index. [5 6 7 8] will give [[0 5] [1 6] [2 7] [3 8]] +# @param _L the list to iterate over +# @details The original list is left unmodified. +# =begin +# (let a [5 6 7 8]) +# (print (zipWithIndex a)) # [[0 5] [1 6] [2 7] [3 8]] +# =end +# @author https://github.com/SuperFola +(let zipWithIndex (fun (_L) { + (mut _output []) + (mut _index 0) + (let _len (len _L)) + (while (< _index _len) { + (append! _output [_index (@ _L _index)]) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Fold a given list, starting from the left side +# @param _L the list to work on +# @param _init an init value +# @param _f a function to apply to the list +# @details The original list is left unmodified. +# =begin +# (let a [1 2 3 4]) +# (print (foldLeft a 0 (fun (a b) (+ a b)))) # 10 +# =end +# @author https://github.com/SuperFola +(let foldLeft (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 })) + +# @brief Check if a condition is verified for all elements of a list +# @param _L the list to work on +# @param _f the conditon +# =begin +# (let a [1 2 3 4]) +# (let f (fun (e) (< e 5))) +# (print (forAll a f)) # true +# =end +# @author https://github.com/Gryfenfer97 +(let forAll (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 })) + +# @brief Check if a condition if verified for one or more elements of a list +# @param _L the list to work on +# @param _f the condition +# =begin +# (let a [1 2 3 4]) +# (let f (fun (e) (< e 3))) +# (print (any a f)) # true +# =end +# @author https://github.com/Gryfenfer97 +(let any (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 })) + +# @brief Count the number of elements in a list that match a condition +# @param _L the list to work on +# @param _f the condition +# =begin +# (let lst [1 2 3 4 5 6 7 8 9]) +# (let is_even (fun (e) (= 0 (mod e 2)))) +# (print (countIf lst is_even)) # 4 +# =end +# @author https://github.com/SuperFola +(let countIf (fun (_L _f) { + (let _inner (fun (lst cond acc) + (if (not (empty? lst)) + (_inner + (tail lst) + cond + (if (cond (head lst)) + (+ 1 acc) + acc)) + acc))) + (_inner _L _f 0) })) + +# @brief Generate a sequence based on a unary function, initial value and length +# @param _init initial value of the sequence +# @param _f unary function to generate values +# @param _length the sequence length +# =begin +# (let f (fun (x) (+ 7 x))) +# (print (iterate 0 f 10)) # [0 7 14 21 28 35 42 49 56 63] +# =end +# @author https://github.com/SuperFola +(let iterate (fun (_init _f _length) { + (assert (> _length 0) "list:iterate needs a length of at least 1") + + (mut _output [_init]) + (mut _last _init) + (mut _i 1) + (while (< _i _length) { + (set _last (_f _last)) + (append! _output _last) + (set _i (+ 1 _i)) }) + _output })) + +# @brief Generate a sequence of numbers +# @param _init initial value of the sequence +# @param _length the sequence length +# =begin +# (print (iota 0 10)) # [0 1 2 3 4 5 6 7 8 9] +# =end +# @author https://github.com/SuperFola +(let iota (fun (_init _length) (iterate _init (fun (x) (+ 1 x)) _length))) + +# @brief Chunk a list in sub-lists of size n +# @param _L list to chunk +# @param _length size of the chunks +# =begin +# (let indices (list:iota 1 9)) # [1 2 3 4 5 6 7 8 9] +# (print (list:chunkBy indices 3)) # [[1 2 3] [4 5 6] [7 8 9]] +# =end +# @author https://github.com/SuperFola +(let chunkBy (fun (_L _length) { + (assert (> _length 0) "list:chunkBy needs a chunk size of at least 1") + (mut _output []) + (mut _current []) + (let _source_len (len _L)) + + (mut _i 0) + (while (< _i _source_len) { + (append! _current (@ _L _i)) + (if (= (len _current) _length) { + (append! _output _current) + (set _current []) }) + (set _i (+ 1 _i)) }) + + (if (not (empty? _current)) (append! _output _current)) + + _output })) + +# @brief Insert an element (or expand a list) at a given position inside a list +# @details Original list is left unmodified +# @param _L list to insert element(s) in +# @param _index where to insert +# @param _value value to insert +# =begin +# (let a [0]) +# (print (list:insert a 1 4)) # [0 4] +# (print (list:insert a 1 [1 2])) # [0 1 2] +# (let b [0 9]) +# (print (list:insert b 1 4)) # [0 4 9] +# (print (list:insert b 1 [1 2])) # [0 1 2 9] +# =end +# @author https://github.com/SuperFola +(let insert (fun (_L _index _value) { + (let _size (len _L)) + (assert (<= _index _size) "list:insert can not insert a value outside the list") + + (if (!= "List" (type _value)) + (set _value [_value])) + + # insert at beginning + (if (= 0 _index) + (concat _value _L) + # insert at the end + (if (= _size _index) + (concat _L _value) + { + # insert anywhere + (let _parts (partition _L (fun (elem i &_index) (< i _index)))) + (concat (head _parts) _value (@ _parts 1)) })) })) + +# @brief Converts the given character to lowercase. +# @param _string the string to make lowercase +# @details The original string is left unmodified. +# =begin +# (import std.String) +# (let message "HeLLo World, I like cheese") +# (let new (toLower message)) # => hello world, i like cheese +# =end +# @author https://github.com/SuperFola +(let toLower (fun (text) { + (mut _index 0) + (mut _e "") + (mut _output "") + + (let in_range (fun (val a b) (and (>= val a) (<= val b)))) + + (while (< _index (len text)) { + (set _e (@ text _index)) + + (if (in_range (string:ord _e) 65 90) + (set _e (string:chr (+ (string:ord _e) 32)))) + (set _output (+ _output _e)) + (set _index (+ _index 1)) }) + _output })) + +# @brief Converts the given character to uppercase. +# @param _string the string to make uppercase +# @details The original string is left unmodified. +# =begin +# (import std.String) +# (let message "hello world, I like cheese") +# (let new (toUpper message)) # => HELLO WORLD, I LIKE CHEESE +# =end +# @author https://github.com/SuperFola +(let toUpper (fun (_string) { + (mut _index 0) + (mut _e "") + (mut _output "") + + (let in_range (fun (val a b) (and (>= val a) (<= val b)))) + + (while (< _index (len _string)) { + (set _e (@ _string _index)) + + (if (in_range (string:ord _e) 97 122) + (set _e (string:chr (- (string:ord _e) 32)))) + (set _output (+ _output _e)) + (set _index (+ _index 1)) }) + _output })) + +# @brief Reverse a string. +# @param _string the string to reverse +# @details The original string is left unmodified. +# =begin +# (import std.String) +# (let message "hello world, I like goats") +# (let reversed (reverse message)) # => staog ekil I ,dlrow olleh +# =end +# @author https://github.com/Natendrtfm +(let reverse (fun (_string) { + (mut _index (- (len _string) 1)) + (mut _returnedString "") + + (while (> _index -1) { + (set _returnedString (+ _returnedString (@ _string _index))) + (set _index (- _index 1)) }) + _returnedString })) + +# @brief Get a slice of a given string, from a given index with a given length +# @param _string the string to get a slice of +# @param _startingIndex the index in the string where to start slicing +# @param _length the length of the slice +# @details The original string is left unmodified. Example: +# =begin +# (import std.String) +# (let message "hello world, I like goats") +# (let slice (slice message 6 4)) # => worl +# =end +# @author https://github.com/Natendrtfm +(let sliceStr (fun (_string _startingIndex _length) + (if (= _length 0) + "" + { + (assert (and (>= _startingIndex 0) (< _startingIndex (len _string))) "slice start index must be in range [0, string length[") + + (mut _returnedString "") + (mut _index _startingIndex) + + (let _end + (if (>= _length (len _string)) + (len _string) + (+ _index _length))) + + (while (< _index _end) { + (set _returnedString (+ _returnedString (@ _string _index))) + (set _index (+ _index 1)) }) + _returnedString }))) + +# @brief Split a string in multiple substrings in a list, given a separator +# @param _string the string to split +# @param _separator the separator to use for splitting +# @details Returns a list of strings. Example : +# =begin +# (import std.String) +# (let message "hello world, I like boats") +# (let splitted (split message " ")) +# =end +# @author https://github.com/Natendrtfm +(let split (fun (_string _separator) { + (mut _at (string:find _string _separator)) + (let _seplen (len _separator)) + (let _strlen (len _string)) + (mut _output []) + (mut _last "") + + (if (= -1 _at) + [_string] + { + (mut _i 0) + (while (< _i _strlen) { + (if (< _i _at) + { + (set _last (+ _last (@ _string _i))) + (set _i (+ 1 _i)) } + { + (append! _output _last) + (set _last "") + (set _i (+ _at _seplen)) + (set _at (string:find _string _separator _i)) + (if (= -1 _at) + (set _at _strlen)) }) }) + + (if (empty? _last) + _output + { + (append! _output _last) + _output }) }) })) + +# @brief Replace a substring in a given string +# @param _string base string who contain pattern to replace by new sub string given +# @param _pattern sub string pattern to replace +# @param _new string who must replace the pattern +# @details The original string isn't modified. +# =begin +# (import std.String) +# (let message "hello XXX, do you like the name XXX?") +# (print (replace message "XXX" "Harry")) # hello Harry, do you like the name Harry? +# =end +(let replace (fun (_string _pattern _new) { + (mut _out _string) + (mut _idx (string:find _out _pattern)) + (let _pattern_sz (len _pattern)) + + (while (!= -1 _idx) { + (mut _first_segment (sliceStr _out 0 _idx)) + (mut _next_segment (sliceStr _out (+ _idx _pattern_sz) (- (len _out) (+ _idx _pattern_sz)))) + + (set _out (+ _first_segment _new _next_segment)) + (set _idx (string:find _next_segment _pattern)) + (if (!= -1 _idx) + (set _idx (+ _idx (len _first_segment) (len _new)))) }) + _out })) + +# @brief Join a list of elements with a given string delimiter +# @param _list host the elements to join +# @param _delim a string delimiter to be put between each element +# @details The original list isn't modified +# =begin +# (import std.String) +# (let data [1 "hello" 3.14 true "world"]) +# (print (join data ";")) # 1;hello;3.14;true;world +# =end +(let join (fun (_list _delim) { + (mut _output "") + (mut _index 0) + + (while (< _index (len _list)) { + (set _output (+ + _output + (toString (@ _list _index)) + (if (!= _index (- (len _list) 1)) + _delim + ""))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Strip the margin of a multiline string +# @param _str multiline string, margin is (space)*(|) +# =begin +# (let s "hello +# |abc +# |def") +# (string:stripMargin s) +# =end +(let stripMargin (fun (_str) { + (mut _output "") + (let _lines (split _str "\n")) + (let _line_count (len _lines)) + (mut _index 0) + + (while (< _index _line_count) { + (let _current (@ _lines _index)) + (let _marker_pos (string:find _current "|")) + (if (= -1 _marker_pos) + (set _output (+ _output _current)) + (set _output (+ _output (sliceStr _current (+ 1 _marker_pos) (len _current))))) + (set _index (+ 1 _index)) + (if (!= _index _line_count) + (set _output (+ _output "\n"))) }) + + _output })) diff --git a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_builtins.ark b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_builtins.ark index df0e0b98a..b90acdb55 100644 --- a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_builtins.ark +++ b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_builtins.ark @@ -2,9 +2,9 @@ (mut i 0) (while (< i 1000) { - (list:slice in 1 4 2) - (math:exp 5) - (math:ln 6) - (list:sort in) + (builtin__list:slice in 1 4 2) + (builtin__math:exp 5) + (builtin__math:ln 6) + (builtin__list:sort in) (set i (+ i 1)) }) diff --git a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_create_closure.ark b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_create_closure.ark new file mode 100644 index 000000000..21215625c --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_create_closure.ark @@ -0,0 +1,34 @@ +(let create (fun (lhs rhs) + (fun (&lhs &rhs) ()))) + +(let sum (fun (data) + (+ + (if (= "Closure" (type data.lhs)) (sum data.lhs) data.lhs) + (if (= "Closure" (type data.rhs)) (sum data.rhs) data.rhs)))) + +(mut i 0) +(while (< i 100) { + (let tree + (create + (create + (create 1 2) + (create + 3 + (create + 4 + (create 5 6)))) + (create + (create + (create + (create 7 8) + 9) + (create 10 11)) + (create + (create + 12 + (create + 13 + (create 14 15))) + (create 16 17))))) + (sum tree) + (set i (+ 1 i) )}) diff --git a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_create_list.ark b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_create_list.ark new file mode 100644 index 000000000..08b72ac1d --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_create_list.ark @@ -0,0 +1,31 @@ +(let sum (fun (data) + (+ + (if (= "List" (type (@ data 0))) (sum (@ data 0)) (@ data 0)) + (if (= "List" (type (@ data 1))) (sum (@ data 1)) (@ data 1))))) + +(mut i 0) +(while (< i 100) { + (let tree + [ + [ + [1 2] + [ + 3 + [ + 4 + [5 6]]]] + [ + [ + [ + [7 8] + 9] + [10 11]] + [ + [ + 12 + [ + 13 + [14 15]]] + [16 17]]]]) + (sum tree) + (set i (+ 1 i) )}) diff --git a/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_fibonacci.ark b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_fibonacci.ark new file mode 100644 index 000000000..0e6a3b298 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_benchmarks_resources_runtime_fibonacci.ark @@ -0,0 +1,5 @@ +(let fibo (fun (n) + (if (< n 2) + n + (+ (fibo (- n 1)) (fibo (- n 2)))))) +(fibo 22) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_ir_closures.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_ir_closures.ark new file mode 100644 index 000000000..f818e5632 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/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_compilersuite_optimized_ir_99bottles.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark index a4482659b..7755d3ce7 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark @@ -10,12 +10,13 @@ # Take one down, pass it around # 97 bottles of beer on the wall +(import std.Sys) (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)) + (print (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 (format "{} Bottles of beer on the wall." n))}) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark new file mode 100644 index 000000000..2f2890fcb --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark @@ -0,0 +1,3 @@ +(let asinh (fun (_x) (builtin__math:asinh _x))) +(let find (fun (_L _x) (builtin__list:find _L _x))) +(let setAt (fun (_L _index _x) (builtin__list:setAt _L _index _x))) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark index f818e5632..cfef323a4 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_closures.ark @@ -41,6 +41,9 @@ (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 +(let executor (fun () { + (print "Countdown " (countdown-from-3)) # 2 + (print "Countdown " (countdown-from-3)) # 1 + (print "Countdown " (countdown-from-3)) # 0 + (print countdown-from-3.number) # 0 +})) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_increments.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_increments.ark index 809c78b1f..3390b8f11 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_increments.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_increments.ark @@ -1,7 +1,15 @@ (mut i 1) +# INCREMENT_BY_INDEX (set i (+ i 4)) +# INCREMENT_BY_INDEX (set i (+ 6 i)) +# DECREMENT_BY_INDEX (set i (- i 8)) # should not be inlined (set i (+ i 4096)) (set i (+ i 1.01)) + +(while (< i 100) { + (set i (+ i 1)) + (set i (+ 1 i)) + (set i (- i 1)) }) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark new file mode 100644 index 000000000..7aadfcfee --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark @@ -0,0 +1,45 @@ +(let foo (fun (e) e)) + +(mut i 0) +# LT_CONST_JUMP_IF_FALSE +(while (< i 100) { + (e i) + (set i (+ 1 i)) }) + +# LT_CONST_JUMP_IF_TRUE +(if (< n 5) + (print n)) + +(let n 100) +# LT_SYM_JUMP_IF_FALSE +(while (< i n) { + (e i) + (set i (+ 1 i)) }) + +# GT_CONST_JUMP_IF_TRUE +(if (> n 5) + (print n)) + +# GT_CONST_JUMP_IF_FALSE +(while (> i 1000) + (print i)) + +# GT_SYM_JUMP_IF_FALSE +(while (> n i) + (print n)) + +# EQ_CONST_JUMP_IF_TRUE +(if (= i 5) + (print "i = 5")) + +# EQ_SYM_INDEX_JUMP_IF_TRUE +(if (= i n) + (print "i = n")) + +# NEQ_CONST_JUMP_IF_TRUE +(if (!= i 5) + (print "i != 5")) + +# NEQ_SYM_JUMP_IF_FALSE +(while (!= i n) + (print i)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_lists.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_lists.ark index 9955ffefa..f3a31c6e4 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_lists.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_lists.ark @@ -1,17 +1,41 @@ -(let source [1 2 3 4]) +# STORE_LIST +(mut source [1 2 3 4]) +(let n 1) (let foo (fun () { + # STORE_HEAD (mut head_1 (head source)) + # STORE_TAIL (mut tail_1 (tail source)) + # STORE_FROM (mut copy_1 source) + # SET_VAL_HEAD (set copy_1 (head source)) - (set copy_1 (tail source)) })) + # SET_VAL_TAIL + (set copy_1 (tail source)) + + # APPEND_IN_PLACE_SYM + (append! source 6) + + # AT_SYM_SYM + (@ source n) })) (foo) +# STORE_HEAD_BY_INDEX (mut head_2 (head source)) +(print head_2) +# STORE_TAIL_BY_INDEX (mut tail_2 (tail source)) (mut copy_2 source) +# SET_VAL_HEAD_BY_INDEX (set copy_2 (head source)) +# SET_VAL_TAIL_BY_INDEX (set copy_2 (tail source)) + +# AT_SYM_INDEX_SYM_INDEX +(@ source n) + +# APPEND_IN_PLACE_SYM_INDEX +(append! tail_2 5) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_type.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_type.ark new file mode 100644 index 000000000..2f89fe040 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_compilersuite_optimized_ir_type.ark @@ -0,0 +1,18 @@ +(let a 5) + +# CHECK_TYPE_OF +(if (= (type a) "Number") + (print "num")) +# CHECK_TYPE_OF +(if (= "Number" (type a)) + (print "num")) + +(let foo (fun () { + # CHECK_TYPE_OF_BY_INDEX + (if (= (type a) "Number") + (print "num")) + # CHECK_TYPE_OF_BY_INDEX + (if (= "Number" (type a)) + (print "num")) })) + +(foo) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark new file mode 100644 index 000000000..ddc3bb157 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark @@ -0,0 +1,3 @@ +(macro f00 100( a b c)) + +(f00 1 2.3 4) 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 deleted file mode 100644 index 12413f26c..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_forbidden_name.ark +++ /dev/null @@ -1 +0,0 @@ -(let print 5) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_import_not_found.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_import_not_found.ark new file mode 100644 index 000000000..3380577e4 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_import_not_found.ark @@ -0,0 +1,3 @@ +(import error__this_file_will_never_exist) + +(print 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark new file mode 100644 index 000000000..ca98d78a1 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark @@ -0,0 +1,3 @@ +000000000080000000000000 +80000000000000000 +( diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_neq_chain_too_long.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_neq_chain_too_long.ark deleted file mode 100644 index ff985782c..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_neq_chain_too_long.ark +++ /dev/null @@ -1 +0,0 @@ -(!= 1 2 3) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark new file mode 100644 index 000000000..26e342e2d --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_ope_not_enough_args.ark @@ -0,0 +1 @@ +(print (!= 1)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_or_not_enough_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_or_not_enough_args.ark deleted file mode 100644 index 841017bdd..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_or_not_enough_args.ark +++ /dev/null @@ -1 +0,0 @@ -(or 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark index 3e67feee1..ee1371633 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark @@ -1 +1 @@ -(let reverse (fun (l) l)) +(let random (fun (l) l)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark deleted file mode 100644 index 165f289b0..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_compiletime_unbound_capture.ark +++ /dev/null @@ -1 +0,0 @@ -(mut d (fun (&d) (print d))) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark new file mode 100644 index 000000000..cd6218d3b --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark @@ -0,0 +1,2 @@ +(let a [[1 2 3] [4 5 6]]) +(@@ a -4 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark new file mode 100644 index 000000000..7533cd297 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark @@ -0,0 +1,2 @@ +(let a [[1 2 3] [4 5 6]]) +(@@ a 1 -5) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_out_of_range.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_out_of_range.ark deleted file mode 100644 index 417d5ed4f..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_at_at_out_of_range.ark +++ /dev/null @@ -1,2 +0,0 @@ -(let lst [[0 1 2 3] [4 5 6 7] [8 9 0 1]]) -(print (@@ lst 3 1)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark new file mode 100644 index 000000000..d0970a5b6 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark @@ -0,0 +1,2 @@ +(let asinh (fun (_x) (builtin__math:asinh _x))) +(asinh) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark new file mode 100644 index 000000000..2c9bed429 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark @@ -0,0 +1,2 @@ +(let asinh (fun (_x) (builtin__math:asinh _x))) +(asinh 1 2) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_closure_field_wrong_fqn.ark new file mode 100644 index 000000000..2de7cb2bb --- /dev/null +++ b/tests/fuzzing/corpus-cmin/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-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 index 53938ca46..85a5edaca 100644 --- 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 @@ -1 +1 @@ -(string:format "Hello {}, I'm {}" "World") +(format "Hello {}, I'm {}" "World") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark index fb5c5cf01..6f9d104cf 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark @@ -1 +1 @@ -(list:setAt [0 1 2 3] 4 9) +(builtin__list:setAt [0 1 2 3] 4 9) 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 index 2a99c795e..cd1a6ed16 100644 --- 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 @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] 6 5 1) +(builtin__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 index b88637a13..0dc38a42b 100644 --- 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 @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] 6 12 1) +(builtin__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 index 9d150c8a4..1cf0819d7 100644 --- 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 @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] -1 5 1) +(builtin__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 index aa53b04c7..58671609e 100644 --- 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 @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] 4 5 -1) +(builtin__list:slice [1 2 3 4 5 6 7 8 9] 4 5 -1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark index e24171f2d..a14ebb48b 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark @@ -1 +1 @@ -(math:ln -1) +(builtin__math:ln -1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark new file mode 100644 index 000000000..fbb2ed7bd --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_not_callable.ark @@ -0,0 +1 @@ +(()) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark new file mode 100644 index 000000000..6d9e57188 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark @@ -0,0 +1,2 @@ +(mut a []) +(pop! a -1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark new file mode 100644 index 000000000..0832c82b3 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark @@ -0,0 +1,2 @@ +(mut a []) +(pop a -1) 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 index b507a1ddb..7104a92fe 100644 --- 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 @@ -1 +1 @@ -(string:removeAt "abc" 5) +(builtin__string:removeAt "abc" 5) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark index c62b8c624..bcc9ced15 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark @@ -1 +1 @@ -(string:setAt "0123" 4 "9") +(builtin__string:setAt "0123" 4 "9") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark index d9585f1a2..f138fe298 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark @@ -1 +1 @@ -(io:appendToFile 1 2) +(builtin__io:appendToFile 1 2) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark index e198ee0a4..73dbdb3a8 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark @@ -1 +1 @@ -(io:dir? 1) +(builtin__io:dir? 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark index 9ec4c061e..251f4d34c 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark @@ -1 +1 @@ -(io:fileExists? 1) +(builtin__io:fileExists? 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark index 343b81fc6..f4b8ec751 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark @@ -1 +1 @@ -(io:listFiles 1) +(builtin__io:listFiles 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark index 949bb8f69..a32b90cd5 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark @@ -1 +1 @@ -(io:makeDir 1) +(builtin__io:makeDir 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark index 2d5a58d5c..119f2d250 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark @@ -1 +1 @@ -(io:readFile "non-existing-file.weird") +(builtin__io:readFile "non-existing-file.weird") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark index 5ab233164..af9a0decc 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark @@ -1 +1 @@ -(io:readFile 1) +(builtin__io:readFile 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark new file mode 100644 index 000000000..20a5fd38a --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark @@ -0,0 +1 @@ +(builtin__io:removeFile 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_str_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_str_num.ark deleted file mode 100644 index e2f5a41bd..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefiles_str_num.ark +++ /dev/null @@ -1,2 +0,0 @@ -(io:writeFile "hello" "content") -(io:removeFiles "hello" 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark index 742e76ba6..37f9cd97f 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark @@ -1 +1 @@ -(io:writeFile 1 2) +(builtin__io:writeFile 1 2) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark index 18a2ca624..654d60ebd 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark @@ -1 +1 @@ -(list:fill "hello") +(builtin__list:fill "hello") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark index 3198318be..5b73d7de2 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark @@ -1 +1 @@ -(list:find "hello" 1) +(builtin__list:find "hello" 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark index 9d7716b5a..05fe0b610 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark @@ -1 +1 @@ -(list:reverse "hello") +(builtin__list:reverse "hello") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark index 652d4c360..77d58e024 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark @@ -1 +1 @@ -(list:setAt "hello") +(builtin__list:setAt "hello") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark index 10a213bb9..f761fdfb8 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark @@ -1 +1 @@ -(list:slice "hello" 1 true nil) +(builtin__list:slice "hello" 1 true nil) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark index bd47a6155..fa9730427 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark @@ -1 +1 @@ -(list:sort "hello") +(builtin__list:sort "hello") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark index 1b7ed80ed..51b48f816 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark @@ -1 +1 @@ -(math:acosh "1") +(builtin__math:acosh "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark index 8ff5cf527..b535ccd7f 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark @@ -1 +1 @@ -(math:arccos "1") +(builtin__math:arccos "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark index a0a4e6854..64e04caa6 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark @@ -1 +1 @@ -(math:arcsin "1") +(builtin__math:arcsin "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark index 71a39a42e..531a7f27f 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark @@ -1 +1 @@ -(math:arctan "1") +(builtin__math:arctan "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark index 9ba00abeb..2d462db69 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark @@ -1 +1 @@ -(math:asinh "1") +(builtin__math:asinh "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark index 654aad8d1..91d644538 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark @@ -1 +1 @@ -(math:atanh "1") +(builtin__math:atanh "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark index 270c9ace7..573949dc6 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark @@ -1 +1 @@ -(math:ceil "1") +(builtin__math:ceil "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark index 7366358fa..9fd45fae2 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark @@ -1 +1 @@ -(math:cos "1") +(builtin__math:cos "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark index f01df2cb5..4bacc8cd7 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark @@ -1 +1 @@ -(math:cosh "1") +(builtin__math:cosh "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark index f13daa4af..2727b225c 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark @@ -1 +1 @@ -(math:exp "1") +(builtin__math:exp "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark index c9d55113e..b04760b36 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark @@ -1 +1 @@ -(math:floor "1") +(builtin__math:floor "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark index 3f908ba9e..456cd89d9 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark @@ -1 +1 @@ -(math:ln "1") +(builtin__math:ln "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark index 2ea803618..ec0c35303 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark @@ -1 +1 @@ -(math:round "1") +(builtin__math:round "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark index 351892d54..debb0c68d 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark @@ -1 +1 @@ -(math:sin "1") +(builtin__math:sin "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark index f1f641c69..3b18b2d9a 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark @@ -1 +1 @@ -(math:sinh "1") +(builtin__math:sinh "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark index 7fd5c4805..024114ba2 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark @@ -1 +1 @@ -(math:tan "1") +(builtin__math:tan "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark index 241e3fc7f..02d48bc56 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark @@ -1 +1 @@ -(math:tanh "1") +(builtin__math:tanh "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark index 33c0f6980..21dcd35a1 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark @@ -1 +1 @@ -(string:chr "1") +(builtin__string:chr "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark index c794d6da9..706ff3b73 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark @@ -1 +1 @@ -(string:find 1) +(builtin__string:find 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark index abcee716c..6b8edfdff 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark @@ -1 +1 @@ -(string:format 1) +(format 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark index 42348bff0..b06dec626 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark @@ -1 +1 @@ -(string:ord 1) +(builtin__string:ord 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark index 0b81fc507..a4bdcdcee 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark @@ -1 +1 @@ -(string:removeAt 1) +(builtin__string:removeAt 1) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark index fc8b8604c..59aa494d0 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark @@ -1 +1 @@ -(string:setAt "1") +(builtin__string:setAt "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark index e18e8d729..670b2e32a 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark @@ -1 +1 @@ -(sys:sleep "1") +(builtin__sys:sleep "1") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_calls.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_calls.ark deleted file mode 100644 index ad1bb90e3..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_calls.ark +++ /dev/null @@ -1,10 +0,0 @@ -(let newlist (list:filter _listeners -(fun (element) (!= typ (@ element 0))))) - -# a badly aligned method below -# this comment bloc is also a test - - (list:forEach _listeners (fun (element) - (if (= typ (@ element 0)) { - ((@ element 1) val) - (set found true)}))) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comment_after_import_with_symbol.ark new file mode 100644 index 000000000..034519004 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/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-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 deleted file mode 100644 index a72acb8a6..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comment_after_node_in_begin.ark +++ /dev/null @@ -1,3 +0,0 @@ -{ - (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 new file mode 100644 index 000000000..014e22008 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_comments_after_import.ark @@ -0,0 +1 @@ +(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 deleted file mode 100644 index 423a8c59c..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_complex_comments_in_condition.ark +++ /dev/null @@ -1,8 +0,0 @@ -(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_imports.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_imports.ark new file mode 100644 index 000000000..882a321ef --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_formattersuite_imports.ark @@ -0,0 +1,13 @@ +(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_unittests_resources_langsuite_builtins-tests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_builtins-tests.ark index 75eb75097..8343bacbc 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_builtins-tests.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_builtins-tests.ark @@ -24,23 +24,9 @@ (set keep false) }) (test:expect foo.keep "capture inside a deeper scope works") }) - (test:case "files" { - (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")) }) - (test:case "time" { (let old (time)) - (sys:sleep 1) + (builtin__sys:sleep 1) (test:expect (< old (time))) }) (mut rands []) @@ -58,10 +44,7 @@ # no need to test all 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 (test:case "math" { - (test:expect (not (math:NaN? 1))) - (test:expect (math:NaN? math:NaN)) - (test:expect (not (math:Inf? 100000))) - (test:expect (math:Inf? math:Inf)) }) - - # clean up - (io:removeFiles "test.txt" "temp/") }) + (test:expect (not (builtin__math:NaN? 1))) + (test:expect (builtin__math:NaN? builtin__math:NaN)) + (test:expect (not (builtin__math:Inf? 100000))) + (test:expect (builtin__math:Inf? builtin__math:Inf)) }) }) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_list-tests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_list-tests.ark index 2ca237c82..a363d9a3c 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_list-tests.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_list-tests.ark @@ -33,47 +33,54 @@ (test:eq a [1 2 3]) }) (test:case "reverse and return a new list" { - (test:eq (list:reverse a) [3 2 1]) + (test:eq (builtin__list:reverse a) [3 2 1]) (test:eq a [1 2 3]) - (test:eq (list:reverse []) []) }) + (test:eq (builtin__list:reverse []) []) }) (test:case "find element in list" { - (test:eq (list:find a 0) -1) - (test:eq (list:find a 2) 1) - (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 (builtin__list:find a 0) -1) + (test:eq (builtin__list:find a 2) 1) + (test:eq (builtin__list:find [] nil) -1) + (test:eq (builtin__list:find [12] 12) 0) + (test:eq (builtin__list:find [1 2 3] 2) 1) + (test:eq (builtin__list:find [12] nil) -1) }) (test:case "slice and return a new list" { - (test:eq (list:slice a 0 0 1) []) + (test:eq (builtin__list:slice a 0 0 1) []) (test:eq a [1 2 3]) - (test:eq (list:slice a 0 3 2) [1 3]) + (test:eq (builtin__list:slice a 0 3 2) [1 3]) (test:eq a [1 2 3]) }) (test:case "sort and return a new list" { - (test:eq (list:sort [3 1 2]) a) + (test:eq (builtin__list:sort [3 1 2]) a) (test:eq a [1 2 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 []) []) }) + (test:eq (builtin__list:sort [5 4 3 2 1]) [1 2 3 4 5]) + (test:eq (builtin__list:sort [5]) [5]) + (test:eq (builtin__list:sort []) []) }) - (test:eq (list:fill 5 nil) [nil nil nil nil nil]) - (let short_list (list:fill 12 nil)) + (test:eq (builtin__list:fill 5 nil) [nil nil nil nil nil]) + (let short_list (builtin__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)) }) - (test:eq (@ (list:setAt short_list 5 "a") 5) "a") + (test:eq (@ (builtin__list:setAt short_list 5 "a") 5) "a") (test:case "modify list at index and return a new list" { - (let tmp (list:setAt a 1 "b")) + (let tmp (builtin__list:setAt a 1 "b")) (test:eq tmp [1 "b" 3]) (test:eq a [1 2 3]) - (test:eq (list:setAt [0 1 2 3] 0 9) [9 1 2 3]) - (test:eq (list:setAt [0 1 2 3] 3 9) [0 1 2 9]) - (test:eq (list:setAt [0 1 2 9] -1 9) [0 1 2 9]) }) + (test:eq (builtin__list:setAt [0 1 2 3] 0 9) [9 1 2 3]) + (test:eq (builtin__list:setAt [0 1 2 3] 3 9) [0 1 2 9]) + (test:eq (builtin__list:setAt [0 1 2 9] -1 9) [0 1 2 9]) }) + + (test:case "get element in list" { + (test:eq 0 (@ [0] -1)) + (test:eq 0 (@ [0] 0)) + (test:eq 5 (@ [0 5 9] 1)) + (test:eq 5 (@ [0 5 9] -2)) + (test:eq 9 (@ [0 5 9] -1)) }) (test:case "get element in 2D list" { (let nested_list [[0 1 2] [3 4 5] [6 7 8]]) @@ -82,7 +89,19 @@ (test:eq 1 (@@ nested_list 0 -2)) (test:eq 8 (@@ nested_list -1 -1)) (test:eq 4 (@@ nested_list 1 1)) - (test:eq 4 (@@ nested_list -2 1)) }) + (test:eq 4 (@@ nested_list -2 1)) + + (let nested_list_1 [[0]]) + (test:eq 0 (@@ nested_list_1 0 0)) + (test:eq 0 (@@ nested_list_1 -1 0)) + (test:eq 0 (@@ nested_list_1 0 -1)) + (test:eq 0 (@@ nested_list_1 -1 -1)) + + (let nested_list_2 [[0 5 9]]) + (test:eq 0 (@@ nested_list_2 0 0)) + (test:eq 0 (@@ nested_list_2 -1 0)) + (test:eq 9 (@@ nested_list_2 0 -1)) + (test:eq 9 (@@ nested_list_2 -1 -1)) }) (test:case "in place mutation with @=" { (mut numbers [0 1 2 3 4]) 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 index 2838b07f1..d297f2474 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_string-tests.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_string-tests.ark @@ -4,24 +4,24 @@ (test:expect (empty? "")) (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:eq (string:removeAt "abcdefghijkl" 3) "abcefghijkl") - (test:eq (string:removeAt "abcdefghijkl" 0) "bcdefghijkl") - (test:eq (string:removeAt "abcdefghijkl" 11) "abcdefghijk") }) + (test:eq "hllo world" (builtin__string:removeAt "hello world" 1)) + (test:eq "ello world" (builtin__string:removeAt "hello world" 0)) + (test:eq "hello worl" (builtin__string:removeAt "hello world" 10)) + (test:eq (builtin__string:removeAt "abcdefghijkl" 3) "abcefghijkl") + (test:eq (builtin__string:removeAt "abcdefghijkl" 0) "bcdefghijkl") + (test:eq (builtin__string:removeAt "abcdefghijkl" 11) "abcdefghijk") }) (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: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:find "abcdabcdabcd" "abcd" 2) 4) }) + (test:eq -1 (builtin__string:find "hello" "help")) + (test:eq 0 (builtin__string:find "hello" "hel")) + (test:eq 2 (builtin__string:find "hello" "llo")) + (test:eq -1 (builtin__string:find "" "1")) + (test:eq (builtin__string:find "abc" "d") -1) + (test:eq (builtin__string:find "abc" "a") 0) + (test:eq (builtin__string:find "abc" "bc") 1) + (test:eq (builtin__string:find "abcdefghijkl" "defijkl") -1) + (test:eq (builtin__string:find "abcdefghijkl" "defghijkl") 3) + (test:eq (builtin__string:find "abcdabcdabcd" "abcd" 2) 4) }) (test:case "get char in string" { (test:eq "a" (@ "abc" 0)) @@ -40,9 +40,9 @@ (test:eq "e" (@@ nested_strings 1 -2)) }) (test:case "update string" { - (test:eq (string:setAt "hello" 0 "a") "aello") - (test:eq (string:setAt "hello" -1 "a") "hella") - (test:eq (string:setAt "hello" 4 "a") "hella") }) + (test:eq (builtin__string:setAt "hello" 0 "a") "aello") + (test:eq (builtin__string:setAt "hello" -1 "a") "hella") + (test:eq (builtin__string:setAt "hello" 4 "a") "hella") }) (test:case "in place mutation of strings with @=" { (mut data "hello world") @@ -57,5 +57,5 @@ (test:eq strings ["aello" "worlb"]) }) (test:case "format strings" { - (test:eq "nilfalsetrue" (string:format "{}{}{}" nil false true)) - (test:eq "CProcedure" (string:format "{}" print)) })}) + (test:eq "nilfalsetrue" (format "{}{}{}" nil false true)) + (test:eq "CProcedure" (format "{}" print)) })}) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_unittests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_unittests.ark new file mode 100644 index 000000000..11ece0952 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_unittests.ark @@ -0,0 +1,22 @@ +(import vm-tests) +(import builtins-tests) +(import utf8-tests) +(import macro-tests) +(import list-tests) +(import string-tests) +(import async-tests) + +(import std.List) + +(let outputs (list:unzip [ + vm-tests:vm-output + builtins-tests:builtin-output + utf8-tests:utf8-output + macro-tests:macro-output + list-tests:list-output + string-tests:string-output + async-tests:async-output ])) +(let success_count (list:sum (@ outputs 0))) +(let failure_count (list:sum (@ outputs 1))) + +(print (format "{:=<20}\nSuccesses: {} - Failures: {}\n" "=" success_count failure_count)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_utf8-tests.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_utf8-tests.ark index 75e357724..360b22b17 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_langsuite_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 (string:ord "👺") 128122) - (test:eq (string:chr 128122) "👺") - (test:eq (string:ord "$") 36) - (test:eq (string:chr 36) "$") })}) + (test:eq (builtin__string:ord "👺") 128122) + (test:eq (builtin__string:chr 128122) "👺") + (test:eq (builtin__string:ord "$") 36) + (test:eq (builtin__string:chr 36) "$") })}) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_basic_a.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_basic_a.ark new file mode 100644 index 000000000..648e85d10 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/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" egg) (= "c:bacon" bacon))) + +(let d_ok (= "d:lamp" lamp)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_forward_reference_a.ark new file mode 100644 index 000000000..445c6b8d6 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/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-cmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark new file mode 100644 index 000000000..94d46826a --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark @@ -0,0 +1,4 @@ +(import b :foo) +(import c :bar) + +(let ok (and (= foo "b:foo") (= bar "c:bar"))) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark new file mode 100644 index 000000000..0888b6855 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark @@ -0,0 +1,4 @@ +(let find "c.ark") +(let test (fun () find)) + +(let bar "c:bar") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_a.ark new file mode 100644 index 000000000..5605abbcd --- /dev/null +++ b/tests/fuzzing/corpus-cmin/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-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark deleted file mode 100644 index 044b3dd33..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_nameresolutionsuite_shadowing_b.ark +++ /dev/null @@ -1,3 +0,0 @@ -(let make (fun (a b c) - "b:make")) -(let result (make 1 2 3)) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_deeply_nested.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_deeply_nested.ark new file mode 100644 index 000000000..b08a23bba --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_deeply_nested.ark @@ -0,0 +1,37 @@ +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +func 1 2 3 +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark new file mode 100644 index 000000000..3b07b774c --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark @@ -0,0 +1,9 @@ +(a b c +# test comment +# cropped +# test +# resume +(if + (ok true) + 1 + 2) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark new file mode 100644 index 000000000..2d9fa2287 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark @@ -0,0 +1,3 @@ +(let a 1) +(print a) +} diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_invalid.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_paren.ark similarity index 100% rename from tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_invalid.ark rename to tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_paren.ark diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark new file mode 100644 index 000000000..9b69e0781 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark @@ -0,0 +1,3 @@ +(let a 1) +(print 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 new file mode 100644 index 000000000..e7578bd1c --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_import.ark @@ -0,0 +1,16 @@ +(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/tests_unittests_resources_parsersuite_success_list.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_list.ark deleted file mode 100644 index f10f020e2..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_list.ark +++ /dev/null @@ -1,9 +0,0 @@ -(list 1 2 3) -(list) -(list (list 1)) -[]#list -[#content -1 - #end -] -[[1 a]] diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_loop.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_loop.ark deleted file mode 100644 index 10f3a0d71..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_loop.ark +++ /dev/null @@ -1,14 +0,0 @@ -# -(while 1 1) -( -while -2 -2 #789 -) - - - -( # 123 - # 456 - while 3 3 ) -(while (isGood 1) (doStuff a (if b c d))) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_macro.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_macro.ark index 9359f41be..a0641c05e 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_macro.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_parsersuite_success_macro.ark @@ -1,6 +1,6 @@ (macro a 1) (macro b () 2) -($ +(macro c # macro name ( # arg list d # macro argument diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_abc_correlation.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_abc_correlation.ark index 4ca0da85f..15f604856 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_abc_correlation.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_abc_correlation.ark @@ -1,5 +1,6 @@ (import std.String :split) (import std.List :filter :map) +(import std.IO) # define a custom helper to count occurrences in a collection (let countIf (fun (_L _f) { diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_ackermann.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_ackermann.ark deleted file mode 100644 index c662b841d..000000000 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_ackermann.ark +++ /dev/null @@ -1,8 +0,0 @@ -(let ackermann (fun (m n) { - (if (> m 0) - (if (= 0 n) - (ackermann (- m 1) 1) - (ackermann (- m 1) (ackermann m (- n 1)))) - (+ 1 n)) })) - -(assert (= 509 (ackermann 3 6)) "(ackermann 3 6) == 509") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_ascending_prime.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_ascending_prime.ark new file mode 100644 index 000000000..cc4c4c8f9 --- /dev/null +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_ascending_prime.ark @@ -0,0 +1,25 @@ +(import std.Math :sqrt :prime?) +(import std.List) +(import std.String) +(import std.Range) + +(let ascending (fun (n f) { + (mut nums (list:iota 1 9)) + (mut i 0) + (mut matched []) + + (while (and (< (len matched) n) (< i (len nums))) { + (let val (@ nums i)) + (if (f val) + (append! matched val)) + + (mut r (range:range (+ 1 (mod val 10)) 10)) + (set r (range:map r (fun (k) (+ k (* 10 val))))) + (concat! nums r) + + (set i (+ 1 i)) }) + + matched })) + +(print (string:join (ascending 100 prime?) ", ")) +# 2, 3, 5, 7, 13, 17, 19, 23, 29, 37, 47, 59, 67, 79, 89, 127, 137, 139, 149, 157, 167, 179, 239, 257, 269, 347, 349, 359, 367, 379, 389, 457, 467, 479, 569, 1237, 1249, 1259, 1279, 1289, 1367, 1459, 1489, 1567, 1579, 1789, 2347, 2357, 2389, 2459, 2467, 2579, 2689, 2789, 3457, 3467, 3469, 4567, 4679, 4789, 5689, 12347, 12379, 12457, 12479, 12569, 12589, 12689, 13457, 13469, 13567, 13679, 13789, 15679, 23459, 23567, 23689, 23789, 25679, 34589, 34679, 123457, 123479, 124567, 124679, 125789, 134789, 145679, 234589, 235679, 235789, 245789, 345679, 345689, 1234789, 1235789, 1245689, 1456789, 12356789, 23456789 diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark index 898af78c2..9bf0001c6 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark @@ -1,5 +1,6 @@ (import std.Range :range) (import std.List) +(import std.Math) (let fact (fun (n acc) { (if (> n 0) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_infinity.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_infinity.ark index 2fd9f611e..1cc94b033 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_infinity.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_infinity.ark @@ -1,3 +1,5 @@ +(import std.Math) + (assert (= false (math:Inf? 0)) "0 is not infinite") (assert (math:Inf? math:Inf) "math:Inf is infinite") (assert (not (math:Inf? math:NaN)) "math:NaN is not infinite") diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_munchausen.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_munchausen.ark index 4cbf7c2b8..fa6748135 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_munchausen.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_munchausen.ark @@ -1,4 +1,5 @@ (import std.List) +(import std.Math) (let self-exponent (fun (x n acc) (if (> n 0) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_string_matching.ark b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_string_matching.ark index 1952605aa..d46a72fb7 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_string_matching.ark +++ b/tests/fuzzing/corpus-cmin/tests_unittests_resources_rosettasuite_string_matching.ark @@ -1,6 +1,8 @@ +(import std.String) + (assert (= 0 (string:find "abcd" "ab")) "abcd starts with ab") (assert (= 6 (string:find "hello world" "world")) "world is located at 6") (assert (= -1 (string:find "abcd" "zn")) "abcd does not contain zn") (assert (= -1 (string:find "abab" "bb")) "abab does not contain bb") (assert (= 0 (string:find "abab" "ab")) "abab contains ab") -(assert (= 2 (string:find "abab" "ab" 1)) "starting lookup at index 1, we found ab at position 2") +(assert (= 2 (string:findAfter "abab" "ab" 1)) "starting lookup at index 1, we found ab at position 2") diff --git a/tests/fuzzing/corpus/c.ark b/tests/fuzzing/corpus/c.ark index 83f8058f7..0888b6855 100644 --- a/tests/fuzzing/corpus/c.ark +++ b/tests/fuzzing/corpus/c.ark @@ -1,191 +1,4 @@ -# @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))) +(let find "c.ark") +(let test (fun () find)) -# @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)) })) +(let bar "c:bar") diff --git a/tests/fuzzing/corpus/d.ark b/tests/fuzzing/corpus/d.ark index 471ae7d2a..0438c2a11 100644 --- a/tests/fuzzing/corpus/d.ark +++ b/tests/fuzzing/corpus/d.ark @@ -31,7 +31,7 @@ (fun (arg_bloc) (call all_args)) }) (let foo (fun (a b c d) - (print (string:format "{} {} {} {}" a b c d)))) + (print (format "{} {} {} {}" a b c d)))) (let t (! foo _ 1 _ 2)) (print (t 5 6)) diff --git a/tests/fuzzing/corpus/examples_collatz.ark b/tests/fuzzing/corpus/examples_collatz.ark index 917a223ac..7bcd07c4f 100644 --- a/tests/fuzzing/corpus/examples_collatz.ark +++ b/tests/fuzzing/corpus/examples_collatz.ark @@ -1,3 +1,6 @@ +(import std.Sys) +(import std.Math) + # 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) diff --git a/tests/fuzzing/corpus/examples_fizz_buzz.ark b/tests/fuzzing/corpus/examples_fizz_buzz.ark index ef5899731..8ad84d3fc 100644 --- a/tests/fuzzing/corpus/examples_fizz_buzz.ark +++ b/tests/fuzzing/corpus/examples_fizz_buzz.ark @@ -5,9 +5,10 @@ r (fun (e) (if (= 0 (mod e 15)) - (print "FizzBuzz") + (puts "FizzBuzz,") (if (= 0 (mod e 3)) - (print "Fizz") + (puts "Fizz,") (if (= 0 (mod e 5)) - (print "Buzz") - (print e)))))) + (puts "Buzz,") + (puts e ",")))))) +(puts "\n") diff --git a/tests/fuzzing/corpus/examples_games_game_of_life.ark b/tests/fuzzing/corpus/examples_games_game_of_life.ark index dd320fb21..04fb3f739 100644 --- a/tests/fuzzing/corpus/examples_games_game_of_life.ark +++ b/tests/fuzzing/corpus/examples_games_game_of_life.ark @@ -1,6 +1,7 @@ (import std.List) (import std.String) (import std.Switch) +(import std.Math) (let board [0 0 0 1 1 1 0 0 0]) (let width 3) diff --git a/tests/fuzzing/corpus/examples_show_ascii_table.ark b/tests/fuzzing/corpus/examples_show_ascii_table.ark index a730a55e6..efb2bc89b 100644 --- a/tests/fuzzing/corpus/examples_show_ascii_table.ark +++ b/tests/fuzzing/corpus/examples_show_ascii_table.ark @@ -1,3 +1,5 @@ +(import std.String :chr) + (mut i 0) (while (< i 16) { (mut j (+ 32 i)) @@ -7,8 +9,8 @@ "Spc" (if (= 127 j) "Del" - (string:chr j)))) - (puts (string:format "{:3} : {:<3}" j k)) + (chr j)))) + (puts (format "{:3} : {:<3}" j k)) (set j (+ 16 j)) }) (print "") diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_parser_bigger.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_parser_bigger.ark new file mode 100644 index 000000000..8a07ea805 --- /dev/null +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_parser_bigger.ark @@ -0,0 +1,904 @@ +# @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 Check if a given number is prime +# @param n the number +# @author https://github.com/SuperFola +(let prime? (fun (n) + (if (= 2 n) + true + (if (or (= 0 (mod n 2)) (= 1 n)) + false + { + (let k (math:ceil (+ 1 (sqrt n)))) + (mut i 3) + (mut continue true) + + (while (and continue (< i k)) { + (if (= 0 (mod n i)) + (set continue false)) + (set i (+ 2 i)) }) + continue })))) + +# @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)) })) + +# @brief Iterate over a given list and run a given function on every element. +# @param _L the list to iterate over +# @param _func the function to call on each element +# @details The original list is left unmodified. +# =begin +# (import std.List) +# (let collection [1 2 5 12]) +# (forEach collection (fun (element) { +# (print element) +# })) +# =end +# @author https://github.com/SuperFola +(let forEach (fun (_L _func) { + (mut _index 0) + + (while (< _index (len _L)) { + (mut _element (@ _L _index)) + (_func _element) + (set _index (+ 1 _index)) }) })) + +# @brief Iterate over a given list and multiply all the elements with the others. +# @param _L the list to iterate over +# @details The original list is left unmodified. +# =begin +# (import std.List) +# (let collection [1 2 5 12]) +# (let p (product collection)) # => 120 +# =end +# @author https://github.com/Unactived +(let product (fun (_L) { + (mut _index 0) + (mut _output 1) + + (while (< _index (len _L)) { + (set _output (* _output (@ _L _index))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Iterate over a given list and sum all the elements. +# @param _L the list to iterate over +# @details The original list is left unmodified. +# =begin +# (import std.List) +# (let collection [1 2 5 12]) +# (let p (sum collection)) # => 20 +# =end +# @author https://github.com/Unactived +(let sum (fun (_L) { + (mut _index 0) + (mut _output 0) + + (while (< _index (len _L)) { + (set _output (+ _output (@ _L _index))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Drop the first n elements of a list +# @param _L the list to work on +# @param _n the number of elements to drop +# @details The original list is left unmodified. +# =begin +# (let cool-stuff [1 2 3 4 5 6 7 8 9]) +# (print (drop cool-stuff 4)) # [5 6 7 8 9] +# =end +# @author https://github.com/rstefanic, https://github.com/SuperFola +(let drop (fun (_L _n) + (if (< _n (/ (len _L) 2)) + (if (> _n 0) + (drop (tail _L) (- _n 1)) + _L) + { + (mut _index (max 0 _n)) + (mut _output []) + + (while (< _index (len _L)) { + (append! _output (@ _L _index)) + (set _index (+ 1 _index)) }) + _output }))) + +# @brief Drop the first elements of a list, while they match a given predicate +# @param _L the list to work on +# @param _f the predicate +# @details The original list is left unmodified. +# =begin +# (let cool-stuff [1 2 3 4 5 6 7 8 9]) +# (print (dropWhile cool-stuff (fun (a) (< a 4)))) # [4 5 6 7 8 9] +# =end +# @author https://github.com/SuperFola +(let dropWhile (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) + (if (_f (@ _L _index)) + (set _index (+ 1 _index)) + (while (< _index (len _L)) { + (append! _output (@ _L _index)) + (set _index (+ 1 _index)) }))) + _output })) + +# @brief Keep elements in a given list if they follow a predicate +# @param _L the list to work on +# @param _f the predicate +# @details The original list is left unmodified. +# =begin +# (import std.Math) +# (print (filter [1 2 3 4 5 6 7 8 9] math:even)) # [2 4 6 8] +# =end +# @author https://github.com/rstefanic +(let filter (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (if (_f (@ _L _index)) (append! _output (@ _L _index))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Apply a given function to each element of a list +# @param _L the list to work on +# @param _f the function to apply to each element +# @details The original list is left unmodified. +# =begin +# (print (map [1 2 3 4 5 6 7 8 9] (fun (e) (* e e)))) # [1 4 9 25 36 49 64 81] +# =end +# @author https://github.com/rstefanic +(let map (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (append! _output (_f (@ _L _index))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Apply a function to the elements of a list to reduce it +# @param _L the list to work on +# @param _f the function to apply +# @details The original list is left unmodified. +# =begin +# (let cool [1 2 3 4 5 6 7 8 9]) +# (print (reduce cool (fun (a b) (+ a b)))) # 45 +# =end +# @author https://github.com/Unactived +(let reduce (fun (_L _f) { + (mut _index 1) + (mut _output (@ _L 0)) + + (while (< _index (len _L)) { + (set _output (_f _output (@ _L _index))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Flatten a list +# @param _L the list to work on +# @details The original list is left unmodified. +# =begin +# (let cool [[1 2 3] [4] 5 6 [7 8] 9]) +# (print (flatten cool)) # [1 2 3 4 5 6 7 8 9] +# =end +# @author https://github.com/SuperFola +(let flatten (fun (_L) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (mut _sub (@ _L _index)) + + (if (= "List" (type _sub)) + (concat! _output _sub) + (append! _output _sub)) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Apply a given function to each element of a list and then flatten it +# @param _L the list to work on +# @param _f the function to apply to each element +# @details The original list is left unmodified. +# =begin +# (let cool [1 2 3 4]) +# (print (flatMap cool (fun (a) [a a]))) # [1 1 2 2 3 3 4 4] +# =end +# @author https://github.com/SuperFola +(let flatMap (fun (_L _f) { + (mut _index 0) + (mut _output []) + + (while (< _index (len _L)) { + (mut _res (_f (@ _L _index))) + + (if (= "List" (type _res)) + (concat! _output _res) + (append! _output _res)) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Take the first n elements of +# @param _L the list to work on +# @param _n the number of elements to take +# @details The original list is left unmodified. +# =begin +# (print (take [1 2 3 4 5 6 7 8 9] 4)) # [1 2 3 4] +# =end +# @author https://github.com/rstefanic +(let take (fun (_L _n) { + (mut _index 0) + (mut _output []) + (set _n (min _n (len _L))) + + (while (< _index _n) { + (append! _output (@ _L _index)) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Take the first n elements of a list, given a predicate +# @param _L the list to work on +# @param _f the predicate +# @details The original list is left unmodified. +# =begin +# (print (takeWhile [1 2 3 4 5 6 7 8 9 10] (fun (a) (< a 4)))) # [1 2 3] +# =end +# @author https://github.com/rakista112 +(let takeWhile (fun (_L _f) { + (mut _index 0) + (mut _output []) + (mut continue true) + + (while (and (< _index (len _L)) continue) + (if (_f (@ _L _index)) + { + (append! _output (@ _L _index)) + (set _index (+ 1 _index)) } + (set continue false))) + _output })) + +# @brief Partition a list in two, given a predicate +# @param _L the list to work on +# @param _f the predicate, accepting the value and its index +# @details The original list is left unmodified. +# =begin +# (let a [1 2 3]) +# (print (list:partition a (fun (c i) (= 0 (mod c 2))))) # [[2] [1 3]] +# =end +# @author https://github.com/rakista112 +(let partition (fun (_L _f) { + (mut _index 0) + (mut _pass []) + (mut _fail []) + + (while (< _index (len _L)) { + (let _val (@ _L _index)) + (if (_f _val _index) + (append! _pass _val) + (append! _fail _val)) + (set _index (+ 1 _index)) }) + + [_pass _fail] })) + +# @brief Unzip a list of [[a b] [c d]...] into [[a c ...] [b d ...]] +# @param _L the list to work on +# @details The original list is left unmodified. +# =begin +# (let zipped [[1 5] [2 6] [3 7] [4 8]]) +# (print (unzip zipped)) # [[1 2 3 4] [5 6 7 8]] +# =end +# @author https://github.com/Unactived +(let unzip (fun (_L) { + (let _m (len _L)) + (mut _list1 []) + (mut _list2 []) + (mut _index 0) + + (while (< _index _m) { + (mut current (@ _L _index)) + (append! _list1 (@ current 0)) + (append! _list2 (@ current 1)) + (set _index (+ 1 _index)) }) + [_list1 _list2] })) + +# @brief Zip two lists into one: [1 2 3 4] and [5 6 7 8] will give [[1 5] [2 6] [3 7] [4 8]] +# @param _a the first list to work on +# @param _b the second list to work on +# @details The original lists are left unmodified. +# =begin +# (let a [1 2 3 4]) +# (let b [5 6 7 8]) +# (print (zip a b)) # [[1 5] [2 6] [3 7] [4 8]] +# =end +# @author https://github.com/Unactived +(let zip (fun (_a _b) { + (let _m (min (len _a) (len _b))) + (mut _c []) + (mut _index 0) + + (while (< _index _m) { + (append! _c [(@ _a _index) (@ _b _index)]) + (set _index (+ 1 _index)) }) + _c })) + +# @brief Zip a list elements with their index. [5 6 7 8] will give [[0 5] [1 6] [2 7] [3 8]] +# @param _L the list to iterate over +# @details The original list is left unmodified. +# =begin +# (let a [5 6 7 8]) +# (print (zipWithIndex a)) # [[0 5] [1 6] [2 7] [3 8]] +# =end +# @author https://github.com/SuperFola +(let zipWithIndex (fun (_L) { + (mut _output []) + (mut _index 0) + (let _len (len _L)) + (while (< _index _len) { + (append! _output [_index (@ _L _index)]) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Fold a given list, starting from the left side +# @param _L the list to work on +# @param _init an init value +# @param _f a function to apply to the list +# @details The original list is left unmodified. +# =begin +# (let a [1 2 3 4]) +# (print (foldLeft a 0 (fun (a b) (+ a b)))) # 10 +# =end +# @author https://github.com/SuperFola +(let foldLeft (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 })) + +# @brief Check if a condition is verified for all elements of a list +# @param _L the list to work on +# @param _f the conditon +# =begin +# (let a [1 2 3 4]) +# (let f (fun (e) (< e 5))) +# (print (forAll a f)) # true +# =end +# @author https://github.com/Gryfenfer97 +(let forAll (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 })) + +# @brief Check if a condition if verified for one or more elements of a list +# @param _L the list to work on +# @param _f the condition +# =begin +# (let a [1 2 3 4]) +# (let f (fun (e) (< e 3))) +# (print (any a f)) # true +# =end +# @author https://github.com/Gryfenfer97 +(let any (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 })) + +# @brief Count the number of elements in a list that match a condition +# @param _L the list to work on +# @param _f the condition +# =begin +# (let lst [1 2 3 4 5 6 7 8 9]) +# (let is_even (fun (e) (= 0 (mod e 2)))) +# (print (countIf lst is_even)) # 4 +# =end +# @author https://github.com/SuperFola +(let countIf (fun (_L _f) { + (let _inner (fun (lst cond acc) + (if (not (empty? lst)) + (_inner + (tail lst) + cond + (if (cond (head lst)) + (+ 1 acc) + acc)) + acc))) + (_inner _L _f 0) })) + +# @brief Generate a sequence based on a unary function, initial value and length +# @param _init initial value of the sequence +# @param _f unary function to generate values +# @param _length the sequence length +# =begin +# (let f (fun (x) (+ 7 x))) +# (print (iterate 0 f 10)) # [0 7 14 21 28 35 42 49 56 63] +# =end +# @author https://github.com/SuperFola +(let iterate (fun (_init _f _length) { + (assert (> _length 0) "list:iterate needs a length of at least 1") + + (mut _output [_init]) + (mut _last _init) + (mut _i 1) + (while (< _i _length) { + (set _last (_f _last)) + (append! _output _last) + (set _i (+ 1 _i)) }) + _output })) + +# @brief Generate a sequence of numbers +# @param _init initial value of the sequence +# @param _length the sequence length +# =begin +# (print (iota 0 10)) # [0 1 2 3 4 5 6 7 8 9] +# =end +# @author https://github.com/SuperFola +(let iota (fun (_init _length) (iterate _init (fun (x) (+ 1 x)) _length))) + +# @brief Chunk a list in sub-lists of size n +# @param _L list to chunk +# @param _length size of the chunks +# =begin +# (let indices (list:iota 1 9)) # [1 2 3 4 5 6 7 8 9] +# (print (list:chunkBy indices 3)) # [[1 2 3] [4 5 6] [7 8 9]] +# =end +# @author https://github.com/SuperFola +(let chunkBy (fun (_L _length) { + (assert (> _length 0) "list:chunkBy needs a chunk size of at least 1") + (mut _output []) + (mut _current []) + (let _source_len (len _L)) + + (mut _i 0) + (while (< _i _source_len) { + (append! _current (@ _L _i)) + (if (= (len _current) _length) { + (append! _output _current) + (set _current []) }) + (set _i (+ 1 _i)) }) + + (if (not (empty? _current)) (append! _output _current)) + + _output })) + +# @brief Insert an element (or expand a list) at a given position inside a list +# @details Original list is left unmodified +# @param _L list to insert element(s) in +# @param _index where to insert +# @param _value value to insert +# =begin +# (let a [0]) +# (print (list:insert a 1 4)) # [0 4] +# (print (list:insert a 1 [1 2])) # [0 1 2] +# (let b [0 9]) +# (print (list:insert b 1 4)) # [0 4 9] +# (print (list:insert b 1 [1 2])) # [0 1 2 9] +# =end +# @author https://github.com/SuperFola +(let insert (fun (_L _index _value) { + (let _size (len _L)) + (assert (<= _index _size) "list:insert can not insert a value outside the list") + + (if (!= "List" (type _value)) + (set _value [_value])) + + # insert at beginning + (if (= 0 _index) + (concat _value _L) + # insert at the end + (if (= _size _index) + (concat _L _value) + { + # insert anywhere + (let _parts (partition _L (fun (elem i &_index) (< i _index)))) + (concat (head _parts) _value (@ _parts 1)) })) })) + +# @brief Converts the given character to lowercase. +# @param _string the string to make lowercase +# @details The original string is left unmodified. +# =begin +# (import std.String) +# (let message "HeLLo World, I like cheese") +# (let new (toLower message)) # => hello world, i like cheese +# =end +# @author https://github.com/SuperFola +(let toLower (fun (text) { + (mut _index 0) + (mut _e "") + (mut _output "") + + (let in_range (fun (val a b) (and (>= val a) (<= val b)))) + + (while (< _index (len text)) { + (set _e (@ text _index)) + + (if (in_range (string:ord _e) 65 90) + (set _e (string:chr (+ (string:ord _e) 32)))) + (set _output (+ _output _e)) + (set _index (+ _index 1)) }) + _output })) + +# @brief Converts the given character to uppercase. +# @param _string the string to make uppercase +# @details The original string is left unmodified. +# =begin +# (import std.String) +# (let message "hello world, I like cheese") +# (let new (toUpper message)) # => HELLO WORLD, I LIKE CHEESE +# =end +# @author https://github.com/SuperFola +(let toUpper (fun (_string) { + (mut _index 0) + (mut _e "") + (mut _output "") + + (let in_range (fun (val a b) (and (>= val a) (<= val b)))) + + (while (< _index (len _string)) { + (set _e (@ _string _index)) + + (if (in_range (string:ord _e) 97 122) + (set _e (string:chr (- (string:ord _e) 32)))) + (set _output (+ _output _e)) + (set _index (+ _index 1)) }) + _output })) + +# @brief Reverse a string. +# @param _string the string to reverse +# @details The original string is left unmodified. +# =begin +# (import std.String) +# (let message "hello world, I like goats") +# (let reversed (reverse message)) # => staog ekil I ,dlrow olleh +# =end +# @author https://github.com/Natendrtfm +(let reverse (fun (_string) { + (mut _index (- (len _string) 1)) + (mut _returnedString "") + + (while (> _index -1) { + (set _returnedString (+ _returnedString (@ _string _index))) + (set _index (- _index 1)) }) + _returnedString })) + +# @brief Get a slice of a given string, from a given index with a given length +# @param _string the string to get a slice of +# @param _startingIndex the index in the string where to start slicing +# @param _length the length of the slice +# @details The original string is left unmodified. Example: +# =begin +# (import std.String) +# (let message "hello world, I like goats") +# (let slice (slice message 6 4)) # => worl +# =end +# @author https://github.com/Natendrtfm +(let sliceStr (fun (_string _startingIndex _length) + (if (= _length 0) + "" + { + (assert (and (>= _startingIndex 0) (< _startingIndex (len _string))) "slice start index must be in range [0, string length[") + + (mut _returnedString "") + (mut _index _startingIndex) + + (let _end + (if (>= _length (len _string)) + (len _string) + (+ _index _length))) + + (while (< _index _end) { + (set _returnedString (+ _returnedString (@ _string _index))) + (set _index (+ _index 1)) }) + _returnedString }))) + +# @brief Split a string in multiple substrings in a list, given a separator +# @param _string the string to split +# @param _separator the separator to use for splitting +# @details Returns a list of strings. Example : +# =begin +# (import std.String) +# (let message "hello world, I like boats") +# (let splitted (split message " ")) +# =end +# @author https://github.com/Natendrtfm +(let split (fun (_string _separator) { + (mut _at (string:find _string _separator)) + (let _seplen (len _separator)) + (let _strlen (len _string)) + (mut _output []) + (mut _last "") + + (if (= -1 _at) + [_string] + { + (mut _i 0) + (while (< _i _strlen) { + (if (< _i _at) + { + (set _last (+ _last (@ _string _i))) + (set _i (+ 1 _i)) } + { + (append! _output _last) + (set _last "") + (set _i (+ _at _seplen)) + (set _at (string:find _string _separator _i)) + (if (= -1 _at) + (set _at _strlen)) }) }) + + (if (empty? _last) + _output + { + (append! _output _last) + _output }) }) })) + +# @brief Replace a substring in a given string +# @param _string base string who contain pattern to replace by new sub string given +# @param _pattern sub string pattern to replace +# @param _new string who must replace the pattern +# @details The original string isn't modified. +# =begin +# (import std.String) +# (let message "hello XXX, do you like the name XXX?") +# (print (replace message "XXX" "Harry")) # hello Harry, do you like the name Harry? +# =end +(let replace (fun (_string _pattern _new) { + (mut _out _string) + (mut _idx (string:find _out _pattern)) + (let _pattern_sz (len _pattern)) + + (while (!= -1 _idx) { + (mut _first_segment (sliceStr _out 0 _idx)) + (mut _next_segment (sliceStr _out (+ _idx _pattern_sz) (- (len _out) (+ _idx _pattern_sz)))) + + (set _out (+ _first_segment _new _next_segment)) + (set _idx (string:find _next_segment _pattern)) + (if (!= -1 _idx) + (set _idx (+ _idx (len _first_segment) (len _new)))) }) + _out })) + +# @brief Join a list of elements with a given string delimiter +# @param _list host the elements to join +# @param _delim a string delimiter to be put between each element +# @details The original list isn't modified +# =begin +# (import std.String) +# (let data [1 "hello" 3.14 true "world"]) +# (print (join data ";")) # 1;hello;3.14;true;world +# =end +(let join (fun (_list _delim) { + (mut _output "") + (mut _index 0) + + (while (< _index (len _list)) { + (set _output (+ + _output + (toString (@ _list _index)) + (if (!= _index (- (len _list) 1)) + _delim + ""))) + (set _index (+ 1 _index)) }) + _output })) + +# @brief Strip the margin of a multiline string +# @param _str multiline string, margin is (space)*(|) +# =begin +# (let s "hello +# |abc +# |def") +# (string:stripMargin s) +# =end +(let stripMargin (fun (_str) { + (mut _output "") + (let _lines (split _str "\n")) + (let _line_count (len _lines)) + (mut _index 0) + + (while (< _index _line_count) { + (let _current (@ _lines _index)) + (let _marker_pos (string:find _current "|")) + (if (= -1 _marker_pos) + (set _output (+ _output _current)) + (set _output (+ _output (sliceStr _current (+ 1 _marker_pos) (len _current))))) + (set _index (+ 1 _index)) + (if (!= _index _line_count) + (set _output (+ _output "\n"))) }) + + _output })) diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_builtins.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_builtins.ark index df0e0b98a..b90acdb55 100644 --- a/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_builtins.ark +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_builtins.ark @@ -2,9 +2,9 @@ (mut i 0) (while (< i 1000) { - (list:slice in 1 4 2) - (math:exp 5) - (math:ln 6) - (list:sort in) + (builtin__list:slice in 1 4 2) + (builtin__math:exp 5) + (builtin__math:ln 6) + (builtin__list:sort in) (set i (+ i 1)) }) diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_create_closure.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_create_closure.ark new file mode 100644 index 000000000..21215625c --- /dev/null +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_create_closure.ark @@ -0,0 +1,34 @@ +(let create (fun (lhs rhs) + (fun (&lhs &rhs) ()))) + +(let sum (fun (data) + (+ + (if (= "Closure" (type data.lhs)) (sum data.lhs) data.lhs) + (if (= "Closure" (type data.rhs)) (sum data.rhs) data.rhs)))) + +(mut i 0) +(while (< i 100) { + (let tree + (create + (create + (create 1 2) + (create + 3 + (create + 4 + (create 5 6)))) + (create + (create + (create + (create 7 8) + 9) + (create 10 11)) + (create + (create + 12 + (create + 13 + (create 14 15))) + (create 16 17))))) + (sum tree) + (set i (+ 1 i) )}) diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_create_list.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_create_list.ark new file mode 100644 index 000000000..08b72ac1d --- /dev/null +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_create_list.ark @@ -0,0 +1,31 @@ +(let sum (fun (data) + (+ + (if (= "List" (type (@ data 0))) (sum (@ data 0)) (@ data 0)) + (if (= "List" (type (@ data 1))) (sum (@ data 1)) (@ data 1))))) + +(mut i 0) +(while (< i 100) { + (let tree + [ + [ + [1 2] + [ + 3 + [ + 4 + [5 6]]]] + [ + [ + [ + [7 8] + 9] + [10 11]] + [ + [ + 12 + [ + 13 + [14 15]]] + [16 17]]]]) + (sum tree) + (set i (+ 1 i) )}) diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_for_sum.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_for_sum.ark new file mode 100644 index 000000000..d85b58e53 --- /dev/null +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_for_sum.ark @@ -0,0 +1,11 @@ +(mut collection []) +(mut i 0) +(while (< i 1000000) { + (append! collection i) + (set i (+ i 1)) }) + +(mut sum 0) +(set i 0) +(while (< i 1000000) { + (set sum (+ sum (@ collection i))) + (set i (+ i 1)) }) diff --git a/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_man_or_boy.ark b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_man_or_boy.ark new file mode 100644 index 000000000..9f4aca38e --- /dev/null +++ b/tests/fuzzing/corpus/tests_benchmarks_resources_runtime_man_or_boy.ark @@ -0,0 +1,9 @@ +(let A (fun (k x1 x2 x3 x4 x5) { + (let B (fun () { + (set k (- k 1)) + (A k B x1 x2 x3 x4) })) + (if (<= k 0) + (+ (x4) (x5)) + (B)) })) + +(A 3 (fun () 1) (fun () -1) (fun () -1) (fun () 1) (fun () 0)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_astsuite_99bottles.ark b/tests/fuzzing/corpus/tests_unittests_resources_astsuite_99bottles.ark index a4482659b..7755d3ce7 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_astsuite_99bottles.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_astsuite_99bottles.ark @@ -10,12 +10,13 @@ # Take one down, pass it around # 97 bottles of beer on the wall +(import std.Sys) (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)) + (print (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 (format "{} Bottles of beer on the wall." n))}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_99bottles.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_99bottles.ark index a4482659b..7755d3ce7 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_99bottles.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_ir_99bottles.ark @@ -10,12 +10,13 @@ # Take one down, pass it around # 97 bottles of beer on the wall +(import std.Sys) (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)) + (print (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 (format "{} Bottles of beer on the wall." n))}) 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 index a4482659b..7755d3ce7 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_99bottles.ark @@ -10,12 +10,13 @@ # Take one down, pass it around # 97 bottles of beer on the wall +(import std.Sys) (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)) + (print (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 (format "{} Bottles of beer on the wall." n))}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark new file mode 100644 index 000000000..2f2890fcb --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_builtins.ark @@ -0,0 +1,3 @@ +(let asinh (fun (_x) (builtin__math:asinh _x))) +(let find (fun (_L _x) (builtin__list:find _L _x))) +(let setAt (fun (_L _index _x) (builtin__list:setAt _L _index _x))) 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 index f818e5632..cfef323a4 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_closures.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_closures.ark @@ -41,6 +41,9 @@ (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 +(let executor (fun () { + (print "Countdown " (countdown-from-3)) # 2 + (print "Countdown " (countdown-from-3)) # 1 + (print "Countdown " (countdown-from-3)) # 0 + (print countdown-from-3.number) # 0 +})) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_increments.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_increments.ark index 809c78b1f..3390b8f11 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_increments.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_increments.ark @@ -1,7 +1,15 @@ (mut i 1) +# INCREMENT_BY_INDEX (set i (+ i 4)) +# INCREMENT_BY_INDEX (set i (+ 6 i)) +# DECREMENT_BY_INDEX (set i (- i 8)) # should not be inlined (set i (+ i 4096)) (set i (+ i 1.01)) + +(while (< i 100) { + (set i (+ i 1)) + (set i (+ 1 i)) + (set i (- i 1)) }) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark new file mode 100644 index 000000000..7aadfcfee --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_jumps.ark @@ -0,0 +1,45 @@ +(let foo (fun (e) e)) + +(mut i 0) +# LT_CONST_JUMP_IF_FALSE +(while (< i 100) { + (e i) + (set i (+ 1 i)) }) + +# LT_CONST_JUMP_IF_TRUE +(if (< n 5) + (print n)) + +(let n 100) +# LT_SYM_JUMP_IF_FALSE +(while (< i n) { + (e i) + (set i (+ 1 i)) }) + +# GT_CONST_JUMP_IF_TRUE +(if (> n 5) + (print n)) + +# GT_CONST_JUMP_IF_FALSE +(while (> i 1000) + (print i)) + +# GT_SYM_JUMP_IF_FALSE +(while (> n i) + (print n)) + +# EQ_CONST_JUMP_IF_TRUE +(if (= i 5) + (print "i = 5")) + +# EQ_SYM_INDEX_JUMP_IF_TRUE +(if (= i n) + (print "i = n")) + +# NEQ_CONST_JUMP_IF_TRUE +(if (!= i 5) + (print "i != 5")) + +# NEQ_SYM_JUMP_IF_FALSE +(while (!= i n) + (print i)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_lists.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_lists.ark index 9955ffefa..f3a31c6e4 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_lists.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_lists.ark @@ -1,17 +1,41 @@ -(let source [1 2 3 4]) +# STORE_LIST +(mut source [1 2 3 4]) +(let n 1) (let foo (fun () { + # STORE_HEAD (mut head_1 (head source)) + # STORE_TAIL (mut tail_1 (tail source)) + # STORE_FROM (mut copy_1 source) + # SET_VAL_HEAD (set copy_1 (head source)) - (set copy_1 (tail source)) })) + # SET_VAL_TAIL + (set copy_1 (tail source)) + + # APPEND_IN_PLACE_SYM + (append! source 6) + + # AT_SYM_SYM + (@ source n) })) (foo) +# STORE_HEAD_BY_INDEX (mut head_2 (head source)) +(print head_2) +# STORE_TAIL_BY_INDEX (mut tail_2 (tail source)) (mut copy_2 source) +# SET_VAL_HEAD_BY_INDEX (set copy_2 (head source)) +# SET_VAL_TAIL_BY_INDEX (set copy_2 (tail source)) + +# AT_SYM_INDEX_SYM_INDEX +(@ source n) + +# APPEND_IN_PLACE_SYM_INDEX +(append! tail_2 5) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_type.ark b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_type.ark new file mode 100644 index 000000000..2f89fe040 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_compilersuite_optimized_ir_type.ark @@ -0,0 +1,18 @@ +(let a 5) + +# CHECK_TYPE_OF +(if (= (type a) "Number") + (print "num")) +# CHECK_TYPE_OF +(if (= "Number" (type a)) + (print "num")) + +(let foo (fun () { + # CHECK_TYPE_OF_BY_INDEX + (if (= (type a) "Number") + (print "num")) + # CHECK_TYPE_OF_BY_INDEX + (if (= "Number" (type a)) + (print "num")) })) + +(foo) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark new file mode 100644 index 000000000..ddc3bb157 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_bad_macro.ark @@ -0,0 +1,3 @@ +(macro f00 100( a b c)) + +(f00 1 2.3 4) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_import_not_found.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_import_not_found.ark new file mode 100644 index 000000000..3380577e4 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_import_not_found.ark @@ -0,0 +1,3 @@ +(import error__this_file_will_never_exist) + +(print 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark new file mode 100644 index 000000000..ca98d78a1 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_invalid_node_multilines.ark @@ -0,0 +1,3 @@ +000000000080000000000000 +80000000000000000 +( diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_name_collision_with_builtin.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_name_collision_with_builtin.ark index 13bf5e5ca..58b48713d 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_name_collision_with_builtin.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_name_collision_with_builtin.ark @@ -1,3 +1,3 @@ -(import package.list :reverse) +(import package.list :random) -(print (reverse [1 2 3])) +(print (random [1 2 3])) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark index 3e67feee1..ee1371633 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_compiletime_package_list.ark @@ -1 +1 @@ -(let reverse (fun (l) l)) +(let random (fun (l) l)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_negative_outside_list.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_negative_outside_list.ark new file mode 100644 index 000000000..ef26775f9 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_negative_outside_list.ark @@ -0,0 +1,2 @@ +(mut a [[1 2 3] [4 5 6]]) +(@@= a -3 0 9) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_ok_negative_outside_list.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_ok_negative_outside_list.ark new file mode 100644 index 000000000..a1641de00 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_eq_ok_negative_outside_list.ark @@ -0,0 +1,2 @@ +(mut a [[1 2 3] [4 5 6]]) +(@@= a 1 -4 9) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark new file mode 100644 index 000000000..cd6218d3b --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_negative_outside_list.ark @@ -0,0 +1,2 @@ +(let a [[1 2 3] [4 5 6]]) +(@@ a -4 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark new file mode 100644 index 000000000..7533cd297 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_at_ok_negative_outside_list.ark @@ -0,0 +1,2 @@ +(let a [[1 2 3] [4 5 6]]) +(@@ a 1 -5) diff --git a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_out_of_range_in_place.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_eq_negative_outside_list.ark similarity index 57% rename from tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_out_of_range_in_place.ark rename to tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_eq_negative_outside_list.ark index bad38eea0..4522f7530 100644 --- a/tests/fuzzing/corpus-cmin/tests_unittests_resources_diagnosticssuite_runtime_out_of_range_in_place.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_at_eq_negative_outside_list.ark @@ -1,2 +1,2 @@ (mut a [1 2 3]) -(pop! a 4) +(@= a -4 5) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark new file mode 100644 index 000000000..d0970a5b6 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_not_enough_args.ark @@ -0,0 +1,2 @@ +(let asinh (fun (_x) (builtin__math:asinh _x))) +(asinh) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark new file mode 100644 index 000000000..2c9bed429 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_builtin_proxy_too_many_args.ark @@ -0,0 +1,2 @@ +(let asinh (fun (_x) (builtin__math:asinh _x))) +(asinh 1 2) 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 index 53938ca46..85a5edaca 100644 --- 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 @@ -1 +1 @@ -(string:format "Hello {}, I'm {}" "World") +(format "Hello {}, I'm {}" "World") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark index fb5c5cf01..6f9d104cf 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_list_set_at.ark @@ -1 +1 @@ -(list:setAt [0 1 2 3] 4 9) +(builtin__list:setAt [0 1 2 3] 4 9) 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 index 2a99c795e..cd1a6ed16 100644 --- 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 @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] 6 5 1) +(builtin__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 index b88637a13..0dc38a42b 100644 --- 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 @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] 6 12 1) +(builtin__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 index 9d150c8a4..1cf0819d7 100644 --- 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 @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] -1 5 1) +(builtin__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 index aa53b04c7..58671609e 100644 --- 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 @@ -1 +1 @@ -(list:slice [1 2 3 4 5 6 7 8 9] 4 5 -1) +(builtin__list:slice [1 2 3 4 5 6 7 8 9] 4 5 -1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark index e24171f2d..a14ebb48b 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_mathln_out_of_range.ark @@ -1 +1 @@ -(math:ln -1) +(builtin__math:ln -1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark new file mode 100644 index 000000000..6d9e57188 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_pop_in_place_negative_outside_list.ark @@ -0,0 +1,2 @@ +(mut a []) +(pop! a -1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark new file mode 100644 index 000000000..0832c82b3 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_pop_negative_outside_list.ark @@ -0,0 +1,2 @@ +(mut a []) +(pop a -1) 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 index b507a1ddb..7104a92fe 100644 --- 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 @@ -1 +1 @@ -(string:removeAt "abc" 5) +(builtin__string:removeAt "abc" 5) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark index c62b8c624..bcc9ced15 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_runtime_string_set_at.ark @@ -1 +1 @@ -(string:setAt "0123" 4 "9") +(builtin__string:setAt "0123" 4 "9") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark index d9585f1a2..f138fe298 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioappendtofile_num_num.ark @@ -1 +1 @@ -(io:appendToFile 1 2) +(builtin__io:appendToFile 1 2) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark index e198ee0a4..73dbdb3a8 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iodir_num.ark @@ -1 +1 @@ -(io:dir? 1) +(builtin__io:dir? 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark index 9ec4c061e..251f4d34c 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iofileexists_num.ark @@ -1 +1 @@ -(io:fileExists? 1) +(builtin__io:fileExists? 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark index 343b81fc6..f4b8ec751 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iolistfiles_num.ark @@ -1 +1 @@ -(io:listFiles 1) +(builtin__io:listFiles 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark index 949bb8f69..a32b90cd5 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iomakedir_num.ark @@ -1 +1 @@ -(io:makeDir 1) +(builtin__io:makeDir 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark index 2d5a58d5c..119f2d250 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_inexistent.ark @@ -1 +1 @@ -(io:readFile "non-existing-file.weird") +(builtin__io:readFile "non-existing-file.weird") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark index 5ab233164..af9a0decc 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioreadfile_num.ark @@ -1 +1 @@ -(io:readFile 1) +(builtin__io:readFile 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark new file mode 100644 index 000000000..20a5fd38a --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_ioremovefile_num.ark @@ -0,0 +1 @@ +(builtin__io:removeFile 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark index 742e76ba6..37f9cd97f 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_iowritefile_num_num.ark @@ -1 +1 @@ -(io:writeFile 1 2) +(builtin__io:writeFile 1 2) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark index 18a2ca624..654d60ebd 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listfill_str.ark @@ -1 +1 @@ -(list:fill "hello") +(builtin__list:fill "hello") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark index 3198318be..5b73d7de2 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listfind_str_num.ark @@ -1 +1 @@ -(list:find "hello" 1) +(builtin__list:find "hello" 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark index 9d7716b5a..05fe0b610 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listreverse_str.ark @@ -1 +1 @@ -(list:reverse "hello") +(builtin__list:reverse "hello") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark index 652d4c360..77d58e024 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listsetat_str.ark @@ -1 +1 @@ -(list:setAt "hello") +(builtin__list:setAt "hello") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark index 10a213bb9..f761fdfb8 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listslice_str_num_bool_nil.ark @@ -1 +1 @@ -(list:slice "hello" 1 true nil) +(builtin__list:slice "hello" 1 true nil) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark index bd47a6155..fa9730427 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_listsort_str.ark @@ -1 +1 @@ -(list:sort "hello") +(builtin__list:sort "hello") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark index 1b7ed80ed..51b48f816 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathacosh_str.ark @@ -1 +1 @@ -(math:acosh "1") +(builtin__math:acosh "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark index 8ff5cf527..b535ccd7f 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharccos_str.ark @@ -1 +1 @@ -(math:arccos "1") +(builtin__math:arccos "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark index a0a4e6854..64e04caa6 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharcsin_str.ark @@ -1 +1 @@ -(math:arcsin "1") +(builtin__math:arcsin "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark index 71a39a42e..531a7f27f 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_matharctan_str.ark @@ -1 +1 @@ -(math:arctan "1") +(builtin__math:arctan "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark index 9ba00abeb..2d462db69 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathasinh_str.ark @@ -1 +1 @@ -(math:asinh "1") +(builtin__math:asinh "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark index 654aad8d1..91d644538 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathatanh_str.ark @@ -1 +1 @@ -(math:atanh "1") +(builtin__math:atanh "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark index 270c9ace7..573949dc6 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathceil_str.ark @@ -1 +1 @@ -(math:ceil "1") +(builtin__math:ceil "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark index 7366358fa..9fd45fae2 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathcos_str.ark @@ -1 +1 @@ -(math:cos "1") +(builtin__math:cos "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark index f01df2cb5..4bacc8cd7 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathcosh_str.ark @@ -1 +1 @@ -(math:cosh "1") +(builtin__math:cosh "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark index f13daa4af..2727b225c 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathexp_str.ark @@ -1 +1 @@ -(math:exp "1") +(builtin__math:exp "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark index c9d55113e..b04760b36 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathfloor_str.ark @@ -1 +1 @@ -(math:floor "1") +(builtin__math:floor "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark index 3f908ba9e..456cd89d9 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathln_str.ark @@ -1 +1 @@ -(math:ln "1") +(builtin__math:ln "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark index 2ea803618..ec0c35303 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathround_str.ark @@ -1 +1 @@ -(math:round "1") +(builtin__math:round "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark index 351892d54..debb0c68d 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathsin_str.ark @@ -1 +1 @@ -(math:sin "1") +(builtin__math:sin "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark index f1f641c69..3b18b2d9a 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathsinh_str.ark @@ -1 +1 @@ -(math:sinh "1") +(builtin__math:sinh "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark index 7fd5c4805..024114ba2 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathtan_str.ark @@ -1 +1 @@ -(math:tan "1") +(builtin__math:tan "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark index 241e3fc7f..02d48bc56 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_mathtanh_str.ark @@ -1 +1 @@ -(math:tanh "1") +(builtin__math:tanh "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark index 33c0f6980..21dcd35a1 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringchr_str.ark @@ -1 +1 @@ -(string:chr "1") +(builtin__string:chr "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark index c794d6da9..706ff3b73 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringfind_num.ark @@ -1 +1 @@ -(string:find 1) +(builtin__string:find 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark index abcee716c..6b8edfdff 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringformat_num.ark @@ -1 +1 @@ -(string:format 1) +(format 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark index 42348bff0..b06dec626 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringord_num.ark @@ -1 +1 @@ -(string:ord 1) +(builtin__string:ord 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark index 0b81fc507..a4bdcdcee 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringremoveat_num.ark @@ -1 +1 @@ -(string:removeAt 1) +(builtin__string:removeAt 1) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark index fc8b8604c..59aa494d0 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_stringsetat_str.ark @@ -1 +1 @@ -(string:setAt "1") +(builtin__string:setAt "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark index e18e8d729..670b2e32a 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_diagnosticssuite_typechecking_syssleep_str.ark @@ -1 +1 @@ -(sys:sleep "1") +(builtin__sys:sleep "1") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_builtins-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_builtins-tests.ark index 75eb75097..8343bacbc 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_builtins-tests.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_builtins-tests.ark @@ -24,23 +24,9 @@ (set keep false) }) (test:expect foo.keep "capture inside a deeper scope works") }) - (test:case "files" { - (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")) }) - (test:case "time" { (let old (time)) - (sys:sleep 1) + (builtin__sys:sleep 1) (test:expect (< old (time))) }) (mut rands []) @@ -58,10 +44,7 @@ # no need to test all 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 (test:case "math" { - (test:expect (not (math:NaN? 1))) - (test:expect (math:NaN? math:NaN)) - (test:expect (not (math:Inf? 100000))) - (test:expect (math:Inf? math:Inf)) }) - - # clean up - (io:removeFiles "test.txt" "temp/") }) + (test:expect (not (builtin__math:NaN? 1))) + (test:expect (builtin__math:NaN? builtin__math:NaN)) + (test:expect (not (builtin__math:Inf? 100000))) + (test:expect (builtin__math:Inf? builtin__math:Inf)) }) }) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_list-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_list-tests.ark index 2ca237c82..a363d9a3c 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_list-tests.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_list-tests.ark @@ -33,47 +33,54 @@ (test:eq a [1 2 3]) }) (test:case "reverse and return a new list" { - (test:eq (list:reverse a) [3 2 1]) + (test:eq (builtin__list:reverse a) [3 2 1]) (test:eq a [1 2 3]) - (test:eq (list:reverse []) []) }) + (test:eq (builtin__list:reverse []) []) }) (test:case "find element in list" { - (test:eq (list:find a 0) -1) - (test:eq (list:find a 2) 1) - (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 (builtin__list:find a 0) -1) + (test:eq (builtin__list:find a 2) 1) + (test:eq (builtin__list:find [] nil) -1) + (test:eq (builtin__list:find [12] 12) 0) + (test:eq (builtin__list:find [1 2 3] 2) 1) + (test:eq (builtin__list:find [12] nil) -1) }) (test:case "slice and return a new list" { - (test:eq (list:slice a 0 0 1) []) + (test:eq (builtin__list:slice a 0 0 1) []) (test:eq a [1 2 3]) - (test:eq (list:slice a 0 3 2) [1 3]) + (test:eq (builtin__list:slice a 0 3 2) [1 3]) (test:eq a [1 2 3]) }) (test:case "sort and return a new list" { - (test:eq (list:sort [3 1 2]) a) + (test:eq (builtin__list:sort [3 1 2]) a) (test:eq a [1 2 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 []) []) }) + (test:eq (builtin__list:sort [5 4 3 2 1]) [1 2 3 4 5]) + (test:eq (builtin__list:sort [5]) [5]) + (test:eq (builtin__list:sort []) []) }) - (test:eq (list:fill 5 nil) [nil nil nil nil nil]) - (let short_list (list:fill 12 nil)) + (test:eq (builtin__list:fill 5 nil) [nil nil nil nil nil]) + (let short_list (builtin__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)) }) - (test:eq (@ (list:setAt short_list 5 "a") 5) "a") + (test:eq (@ (builtin__list:setAt short_list 5 "a") 5) "a") (test:case "modify list at index and return a new list" { - (let tmp (list:setAt a 1 "b")) + (let tmp (builtin__list:setAt a 1 "b")) (test:eq tmp [1 "b" 3]) (test:eq a [1 2 3]) - (test:eq (list:setAt [0 1 2 3] 0 9) [9 1 2 3]) - (test:eq (list:setAt [0 1 2 3] 3 9) [0 1 2 9]) - (test:eq (list:setAt [0 1 2 9] -1 9) [0 1 2 9]) }) + (test:eq (builtin__list:setAt [0 1 2 3] 0 9) [9 1 2 3]) + (test:eq (builtin__list:setAt [0 1 2 3] 3 9) [0 1 2 9]) + (test:eq (builtin__list:setAt [0 1 2 9] -1 9) [0 1 2 9]) }) + + (test:case "get element in list" { + (test:eq 0 (@ [0] -1)) + (test:eq 0 (@ [0] 0)) + (test:eq 5 (@ [0 5 9] 1)) + (test:eq 5 (@ [0 5 9] -2)) + (test:eq 9 (@ [0 5 9] -1)) }) (test:case "get element in 2D list" { (let nested_list [[0 1 2] [3 4 5] [6 7 8]]) @@ -82,7 +89,19 @@ (test:eq 1 (@@ nested_list 0 -2)) (test:eq 8 (@@ nested_list -1 -1)) (test:eq 4 (@@ nested_list 1 1)) - (test:eq 4 (@@ nested_list -2 1)) }) + (test:eq 4 (@@ nested_list -2 1)) + + (let nested_list_1 [[0]]) + (test:eq 0 (@@ nested_list_1 0 0)) + (test:eq 0 (@@ nested_list_1 -1 0)) + (test:eq 0 (@@ nested_list_1 0 -1)) + (test:eq 0 (@@ nested_list_1 -1 -1)) + + (let nested_list_2 [[0 5 9]]) + (test:eq 0 (@@ nested_list_2 0 0)) + (test:eq 0 (@@ nested_list_2 -1 0)) + (test:eq 9 (@@ nested_list_2 0 -1)) + (test:eq 9 (@@ nested_list_2 -1 -1)) }) (test:case "in place mutation with @=" { (mut numbers [0 1 2 3 4]) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_string-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_string-tests.ark index 2838b07f1..d297f2474 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_string-tests.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_string-tests.ark @@ -4,24 +4,24 @@ (test:expect (empty? "")) (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:eq (string:removeAt "abcdefghijkl" 3) "abcefghijkl") - (test:eq (string:removeAt "abcdefghijkl" 0) "bcdefghijkl") - (test:eq (string:removeAt "abcdefghijkl" 11) "abcdefghijk") }) + (test:eq "hllo world" (builtin__string:removeAt "hello world" 1)) + (test:eq "ello world" (builtin__string:removeAt "hello world" 0)) + (test:eq "hello worl" (builtin__string:removeAt "hello world" 10)) + (test:eq (builtin__string:removeAt "abcdefghijkl" 3) "abcefghijkl") + (test:eq (builtin__string:removeAt "abcdefghijkl" 0) "bcdefghijkl") + (test:eq (builtin__string:removeAt "abcdefghijkl" 11) "abcdefghijk") }) (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: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:find "abcdabcdabcd" "abcd" 2) 4) }) + (test:eq -1 (builtin__string:find "hello" "help")) + (test:eq 0 (builtin__string:find "hello" "hel")) + (test:eq 2 (builtin__string:find "hello" "llo")) + (test:eq -1 (builtin__string:find "" "1")) + (test:eq (builtin__string:find "abc" "d") -1) + (test:eq (builtin__string:find "abc" "a") 0) + (test:eq (builtin__string:find "abc" "bc") 1) + (test:eq (builtin__string:find "abcdefghijkl" "defijkl") -1) + (test:eq (builtin__string:find "abcdefghijkl" "defghijkl") 3) + (test:eq (builtin__string:find "abcdabcdabcd" "abcd" 2) 4) }) (test:case "get char in string" { (test:eq "a" (@ "abc" 0)) @@ -40,9 +40,9 @@ (test:eq "e" (@@ nested_strings 1 -2)) }) (test:case "update string" { - (test:eq (string:setAt "hello" 0 "a") "aello") - (test:eq (string:setAt "hello" -1 "a") "hella") - (test:eq (string:setAt "hello" 4 "a") "hella") }) + (test:eq (builtin__string:setAt "hello" 0 "a") "aello") + (test:eq (builtin__string:setAt "hello" -1 "a") "hella") + (test:eq (builtin__string:setAt "hello" 4 "a") "hella") }) (test:case "in place mutation of strings with @=" { (mut data "hello world") @@ -57,5 +57,5 @@ (test:eq strings ["aello" "worlb"]) }) (test:case "format strings" { - (test:eq "nilfalsetrue" (string:format "{}{}{}" nil false true)) - (test:eq "CProcedure" (string:format "{}" print)) })}) + (test:eq "nilfalsetrue" (format "{}{}{}" nil false true)) + (test:eq "CProcedure" (format "{}" print)) })}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_unittests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_unittests.ark index 091de2c39..11ece0952 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_unittests.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_unittests.ark @@ -19,4 +19,4 @@ (let success_count (list:sum (@ outputs 0))) (let failure_count (list:sum (@ outputs 1))) -(print (string:format "{:=<20}\nSuccesses: {} - Failures: {}\n" "=" success_count failure_count)) +(print (format "{:=<20}\nSuccesses: {} - Failures: {}\n" "=" success_count failure_count)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_utf8-tests.ark b/tests/fuzzing/corpus/tests_unittests_resources_langsuite_utf8-tests.ark index 75e357724..360b22b17 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_langsuite_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 (string:ord "👺") 128122) - (test:eq (string:chr 128122) "👺") - (test:eq (string:ord "$") 36) - (test:eq (string:chr 36) "$") })}) + (test:eq (builtin__string:ord "👺") 128122) + (test:eq (builtin__string:chr 128122) "👺") + (test:eq (builtin__string:ord "$") 36) + (test:eq (builtin__string:chr 36) "$") })}) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark new file mode 100644 index 000000000..94d46826a --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_a.ark @@ -0,0 +1,4 @@ +(import b :foo) +(import c :bar) + +(let ok (and (= foo "b:foo") (= bar "c:bar"))) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_b.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_b.ark new file mode 100644 index 000000000..785912ff2 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_b.ark @@ -0,0 +1,4 @@ +(let find "b.ark") +(let petrol (fun () find)) + +(let foo "b:foo") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark new file mode 100644 index 000000000..0888b6855 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_nameresolutionsuite_hidden_shadowing_c.ark @@ -0,0 +1,4 @@ +(let find "c.ark") +(let test (fun () find)) + +(let bar "c:bar") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_deeply_nested.ark b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_deeply_nested.ark new file mode 100644 index 000000000..b08a23bba --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_deeply_nested.ark @@ -0,0 +1,37 @@ +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +((((((((((((((((((((((((((((((((((((((((((((((((((((((((( +func 1 2 3 +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +))))))))))))))))))))))))))))))))))))))))))))))))))))))))) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark new file mode 100644 index 000000000..3b07b774c --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_incomplete_call_2.ark @@ -0,0 +1,9 @@ +(a b c +# test comment +# cropped +# test +# resume +(if + (ok true) + 1 + 2) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark new file mode 100644 index 000000000..2d9fa2287 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_bracket.ark @@ -0,0 +1,3 @@ +(let a 1) +(print a) +} diff --git a/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_paren.ark b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_paren.ark new file mode 100644 index 000000000..79c81eee1 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_paren.ark @@ -0,0 +1 @@ +(print 1)) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark new file mode 100644 index 000000000..9b69e0781 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_failure_unexpected_closing_square_bracket.ark @@ -0,0 +1,3 @@ +(let a 1) +(print a) +] diff --git a/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_success_macro.ark b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_success_macro.ark index 9359f41be..a0641c05e 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_success_macro.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_parsersuite_success_macro.ark @@ -1,6 +1,6 @@ (macro a 1) (macro b () 2) -($ +(macro c # macro name ( # arg list d # macro argument diff --git a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_abc_correlation.ark b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_abc_correlation.ark index 4ca0da85f..15f604856 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_abc_correlation.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_abc_correlation.ark @@ -1,5 +1,6 @@ (import std.String :split) (import std.List :filter :map) +(import std.IO) # define a custom helper to count occurrences in a collection (let countIf (fun (_L _f) { diff --git a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_ascending_prime.ark b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_ascending_prime.ark new file mode 100644 index 000000000..cc4c4c8f9 --- /dev/null +++ b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_ascending_prime.ark @@ -0,0 +1,25 @@ +(import std.Math :sqrt :prime?) +(import std.List) +(import std.String) +(import std.Range) + +(let ascending (fun (n f) { + (mut nums (list:iota 1 9)) + (mut i 0) + (mut matched []) + + (while (and (< (len matched) n) (< i (len nums))) { + (let val (@ nums i)) + (if (f val) + (append! matched val)) + + (mut r (range:range (+ 1 (mod val 10)) 10)) + (set r (range:map r (fun (k) (+ k (* 10 val))))) + (concat! nums r) + + (set i (+ 1 i)) }) + + matched })) + +(print (string:join (ascending 100 prime?) ", ")) +# 2, 3, 5, 7, 13, 17, 19, 23, 29, 37, 47, 59, 67, 79, 89, 127, 137, 139, 149, 157, 167, 179, 239, 257, 269, 347, 349, 359, 367, 379, 389, 457, 467, 479, 569, 1237, 1249, 1259, 1279, 1289, 1367, 1459, 1489, 1567, 1579, 1789, 2347, 2357, 2389, 2459, 2467, 2579, 2689, 2789, 3457, 3467, 3469, 4567, 4679, 4789, 5689, 12347, 12379, 12457, 12479, 12569, 12589, 12689, 13457, 13469, 13567, 13679, 13789, 15679, 23459, 23567, 23689, 23789, 25679, 34589, 34679, 123457, 123479, 124567, 124679, 125789, 134789, 145679, 234589, 235679, 235789, 245789, 345679, 345689, 1234789, 1235789, 1245689, 1456789, 12356789, 23456789 diff --git a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark index 898af78c2..9bf0001c6 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_calculating_value_of_e.ark @@ -1,5 +1,6 @@ (import std.Range :range) (import std.List) +(import std.Math) (let fact (fun (n acc) { (if (> n 0) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_infinity.ark b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_infinity.ark index 2fd9f611e..1cc94b033 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_infinity.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_infinity.ark @@ -1,3 +1,5 @@ +(import std.Math) + (assert (= false (math:Inf? 0)) "0 is not infinite") (assert (math:Inf? math:Inf) "math:Inf is infinite") (assert (not (math:Inf? math:NaN)) "math:NaN is not infinite") diff --git a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_munchausen.ark b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_munchausen.ark index 4cbf7c2b8..fa6748135 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_munchausen.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_munchausen.ark @@ -1,4 +1,5 @@ (import std.List) +(import std.Math) (let self-exponent (fun (x n acc) (if (> n 0) diff --git a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_string_matching.ark b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_string_matching.ark index 1952605aa..d46a72fb7 100644 --- a/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_string_matching.ark +++ b/tests/fuzzing/corpus/tests_unittests_resources_rosettasuite_string_matching.ark @@ -1,6 +1,8 @@ +(import std.String) + (assert (= 0 (string:find "abcd" "ab")) "abcd starts with ab") (assert (= 6 (string:find "hello world" "world")) "world is located at 6") (assert (= -1 (string:find "abcd" "zn")) "abcd does not contain zn") (assert (= -1 (string:find "abab" "bb")) "abab does not contain bb") (assert (= 0 (string:find "abab" "ab")) "abab contains ab") -(assert (= 2 (string:find "abab" "ab" 1)) "starting lookup at index 1, we found ab at position 2") +(assert (= 2 (string:findAfter "abab" "ab" 1)) "starting lookup at index 1, we found ab at position 2")