summaryrefslogtreecommitdiff
path: root/test-suite/tests
AgeCommit message (Collapse)AuthorFilesLines
2014-01-27array-contents returns root for empty arrays with empty rootDaniel Llorens1-0/+5
This fixes a compiler issue where (uniform-array->bytevector #2f64()) failed because of the stricter definition of uniform-vector? on this branch. Perhaps it would be better if uniform-array->bytevector didn't require a contiguous argument. * libguile/arrays.c: (scm_array_contents): return the root regardless of the value of SCM_I_ARRAY_DIMS (ra)->inc. * test-suite/tests/arrays.test: check.
2014-01-27Fix compilation bugs with some kinds of typed arraysDaniel Llorens1-1/+9
* module/language/glil/compile-assembly.scm: pass (array-contents x) to uniform-array->bytevector instead of x, when x is a typed array. * test-suite/tests/arrays.test: test an instance of the above that failed in Guile 2.0.9.
2014-01-27Preallocate index list in scm_array_index_map_xDaniel Llorens1-1/+9
* libguile/array-map.c - (scm_array_index_map_x): preallocate the index list instead of constructing it on each rank-1 iteration. - (ramap, rafe): use SCM_I_ARRAY_V just once.
2014-01-27Fix scm_ramapc bugs with 0-inc arraysDaniel Llorens1-20/+30
* libguile/array-map.c: (scm_ramapc): Cannot flag empty on the product inc * dim * dim ... Check every dim. * test-suite/tests/ramap.test: Tests the 0-inc, non empty case for both array-map! and array-copy!.
2014-01-27Fix corner cases of scm_ramapcDaniel Llorens1-2/+60
* libguile/array-map.c - (scm_ramapc): mismatched axes limit unrollk (kroll). Reorganize the function to do all checking as we go. - (scm_ra_matchp): unused; remove. - (find_unrollk): inlined in scm_ramapc; remove. - (klen): inlined in scm_ramapc; remove. - (rafill): n is size_t. - (racp): n is size_t. Use n and not i0end to bound the loop. - (ramap): Use n and not i0end to bound the loop. This is needed for the rank 0 case to work with the new scm_ramapc, as inc may be set to 0 in that case. - (rafe): idem. * test-suite/tests/ramap.test - check that size mismatch prevents unrolling (matching behavior III) with both array-copy! and array-map!. - check that non-contiguous stride in non-ref args prevents unrolling (rank 2, discontinuous) with both array-copy! and array-map!. - check rank 0 cases with array-for-each, array-map!.
2014-01-27Rewrite scm_ramapc()Daniel Llorens1-1/+8
* libguile/array-map.c - (cind): replace by cindk, that operates only on the unrolled index set. - (klen): new function. - (make1array): take extra inc argument. - (scm_ramapc): rewrite to unroll as many axes as possible instead of just all or one. - (AREF): lbnd is known to be 0: remove. - (ASET): v is known to come from SCM_I_ARRAY_V; assume base, inc, lbnd. - (racp): use ssize_t instead of long for the indices. - (scm_array_index_map_x): build the index list at the last-but-one axis, then set the car of the last element, instead of building the list at the last axis. * test-suite/tests/ramap.test - add array-map! test with offset arguments.
2014-01-27Check more cases of array-contentsDaniel Llorens1-1/+11
* libguile/arrays.c: (scm_array_contents): fix comment. * test-suite/tests/arrays.test: add cases that depend on correct setting of CONTIGUOUS_FLAG.
2014-01-27Check the documented matching behavior of array-map!/copy!Daniel Llorens2-45/+67
* test-suite/tests/arrays.test: move array-copy! tests to ramap.test. * test-suite/tests/ramap.test: check the dissimilar matching behavior of array-copy! and array-map! with arguments of different size.
2014-01-27Fix compilation errors when reading arrays at the replDaniel Llorens1-0/+63
* compile-assembly.scm - vector-fold2: handle rank 1 arrays, since this is called with the result of array-contents which need not be a vector. - dump-constants: fix uses of vector-fold2. Replace vector-length on result of array-contents by array-length. * libguile/arrays.c - scm_array_contents: branch cases not on scm_is_generalized_vector but on SCM_I_ARRAYP. Thus lbnd!=0, which could happen with scm_is_generalized_vector, never appears in the output. * test-suite/tests/arrays.test - tests for array-contents.
2014-01-27Fix array map functions with empty argumentsDaniel Llorens1-9/+52
* libguile/array-map.c - scm_ra_matchp: look for empty axes and return new case 5 if so. Use array handles to remove the SCM_I_ARRAYP / not branch. - scm_ramapc: Heed case 5. * test-suite/tests/ramap.test - test empty arguments for array-copy! and array-for-each. Note those that failed in 2.0.9.
2014-01-27Fix empty array bug in array-index-map!Daniel Llorens1-5/+23
* libguile/array-map.c: (scm_array_index_map_x): bail out if any one of the axes is empty. * test-suite/tests/ramap.test: add tests for empty array-case of array-index-map!. The 'f64 case with not-last emtpy axis is broken in 2.0.9.
2014-01-27Test that typed-array? returns #f with non-array argumentDaniel Llorens1-1/+7
* test-suite/tests/arrays.test: ditto.
2014-01-27Identify scm_is_vector with scm_is_simple_vectorDaniel Llorens2-1/+56
This patch fixes the bug (vector-ref #1@1(1 2 3) 1) => 2. * libguile/vectors.c: (scm_is_vector): just as scm_is_simple_vector. * libguile/filesys.c, libguile/random.c, libguile/stime.c, libguile/trees.c, libguile/validate.h: use scm_is_vector instead of scm_is_simple_vector. * libguile/sort.c - scm_restricted_vector_sort_x: use scm_array_handle_writable_elements instead of scm_vector_writable_elements, to work with non-vector rank-1 array objects. - scm_sort_x: check for scm_is_array instead of scm_is_vector. Rank check is in restricted_vector_sort_x. - scm_sort: ditto. - scm_stable_sort_x: like scm_restricted_vector_sort_x. - scm_stable_sort: like scm_sort. * test-suite/tests/arrays.test: fix header. * test-suite/tests/random.test: new coverage test covering random:normal-vector! * test-suite/Makefile.am: include random.test in make check.
2014-01-27For uniform vectors SCM_I_ARRAYP can't be trueDaniel Llorens1-22/+36
This fixes an inconsistency where uniform-vector? of a shared array could be true but -ref operations failed to account correctly for lbnd. * libguile/uniform.c - scm_is_uniform_vector: SCM_I_ARRAYP disqualifies obj as uniform vector. - scm_c_uniform_vector_length: lbnd is known 0, so don't use it. - scm_c_uniform_vector_ref: lbnd/base/inc are known to be 0/0/1. - scm_c_uniform_vector_set_x!: idem. - scm_uniform_vector_writable_elements: check uvec's type. * test-suite/tests/arrays.test - group the exception types at the top. - check that uniform-vector functions do not accept general arrays.
2014-01-27Reorder arrays.testDaniel Llorens1-152/+152
* test-suite/tests/arrays.test: dependence reordering: first sanity, then make-array, then array-equal?, then make-shared-array, shared-array-root, then the rest, many of which use make-shared-array.
2014-01-27Don't use scm_is_generalized_vector in transpose-arrayDaniel Llorens1-0/+13
* libguile/arrays.c (scm_transpose_array) - Use scm_c_array_rank(), which contains an implicit is_array test. - Handle the rank 0 case. * test-suite/tests/arrays.test - Add test for rank 0 case. - Add failure test for non array argument.
2014-01-27Tests for transpose-arrayDaniel Llorens1-0/+32
* test-suite/tests/arrays.test: test transpose-array for ranks 1, 2, 3.
2014-01-27Tests for shared-array-rootDaniel Llorens1-0/+29
* test-suite/tests/arrays.test: check shared-array-root against make-shared-array, array-contents.
2014-01-27Don't use generalized-vector functions in uniform.cDaniel Llorens1-4/+20
* libguile/uniform.c - (scm_is_uniform_vector): replace scm_is_generalized_vector and scm_generalized_vector_get_handle by scm_is_array and manual rank check. - (scm_c_uniform_vector_length): inline length computation. This removes a redundant rank check. - (scm_c_uniform_vector_ref): inline impl->vref use. This removes a redundant rank check. - (scm_c_uniform_vector_set): inline impl->vset use. This removes a redundant rank check. - (scm_uniform_vector_writable_elements): replace scm_generalized_vector_get_handle by scm_array_get_handle. * test-suite/test/arrays.test - rename uniform-vector-ref block to uniform-vector. - exercise uniform-vector-length and shared arrays remaining uniform.
2014-01-27Tests for array-copy!, empty caseDaniel Llorens1-22/+34
* test-suite/tests/ramap.test: test array-copy! with empty destination. Fix uses of constant array as destination.
2014-01-21Merge branch 'stable-2.0'Mark H Weaver4-6/+36
Conflicts: libguile/read.c test-suite/tests/web-response.test
2014-01-18Add support for content-dispositionAndy Wingo1-1/+3
* module/web/http.scm ("Content-Disposition"): Add a parser and serializer. Defined in RFC2616 section 19.5.1. * test-suite/tests/web-http.test ("entity headers"): New test case.
2014-01-17Arrange so that 'file-encoding' does not truncate the encoding name.Ludovic Courtès1-2/+8
Fixes <http://bugs.gnu.org/16463>. Reported by Sree Harsha Totakura <sreeharsha@totakura.in>. * libguile/read.c (ENCODING_NAME_MAX_SIZE): New macro. (SCM_ENCODING_SEARCH_SIZE): Change to 500 + ENCODING_NAME_MAX_SIZE. (scm_i_scan_for_encoding): Return NULL if there's less than ENCODING_NAME_MAX_SIZE bytes once "coding: *" has been read. * test-suite/tests/coding.test ("line comment")["http://bugs.gnu.org/16463"]: New test.
2014-01-15web: Don't throw if a response is longer than its Content-Length says.Ludovic Courtès1-2/+4
* module/web/response.scm (make-delimited-input-port): Read at most LEN bytes from PORT, instead of trying to read more and returning an error if more is available. Try again when 'get-bytevector-n!' return zero. * test-suite/tests/web-response.test (example-1): Add garbage after the body itself.
2014-01-15Custom binary input ports sanity-check the return value of 'read!'.Ludovic Courtès1-0/+9
* libguile/r6rs-ports.c (cbip_fill_input): Throw an exception when C_OCTETS is greater than what was requested. * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary input port 'read!' returns too much"]: New test.
2014-01-15Document that we support srfi-46 and add it to %cond-expand-features.Mark H Weaver1-2/+15
* module/ice-9/boot-9.scm (%cond-expand-features): Add srfi-46. * doc/ref/srfi-modules.texi (SRFI-0): Add srfi-46 to the list of core features. (SRFI-46): New node. * doc/ref/api-macros.texi (Syntax Rules): Mention that the custom ellipsis identifier support is specified by SRFI-46. * test-suite/tests/syntax.test ("syntax-rules"): Add ellipsis hygiene test from SRFI-46.
2014-01-14Merge branch 'stable-2.0'Mark H Weaver1-0/+5
2014-01-14print: In R7RS |...| symbols, print most graphic characters unescaped.Mark H Weaver1-0/+5
* libguile/print.c (print_r7rs_extended_symbol): Print any unicode graphic character other than '|' or '\' unescaped. Escape any spacing character other than ASCII space.
2014-01-14Merge branch 'stable-2.0'Mark H Weaver2-1/+60
Conflicts: libguile/print.c libguile/read.c test-suite/tests/print.test
2014-01-14print: Support R7RS |...| symbol notation.Mark H Weaver1-1/+55
* libguile/print.c (scm_print_opts): Add 'r7rs-symbols' print option. (symbol_has_extended_read_syntax): If the 'r7rs-symbols' option is enabled, then disallow '|' and '\' from bare symbols. (print_extended_symbol): Use 'scm_lfwrite' and 'scm_putc' instead of 'display_string' and 'display_character' when printing ASCII literals. (print_r7rs_extended_symbol): New static function. (scm_i_print_symbol_name): If the 'r7rs-symbols' option is enabled, use 'print_r7rs_extended_symbol' instead of 'print_extended_symbol'. * libguile/private-options.h (SCM_PRINT_R7RS_SYMBOLS_P): New macro. (SCM_N_PRINT_OPTIONS): Increment. * doc/ref/api-evaluation.texi (Scheme Write): Mention 'r7rs-symbols' print option. * test-suite/tests/print.test ("write"): Add tests.
2014-01-14read: Support R7RS |...| symbol notation.Mark H Weaver1-0/+5
* libguile/private-options.h (SCM_R7RS_SYMBOLS_P): New macro. (SCM_N_READ_OPTIONS): Increment. * libguile/read.c (scm_read_opts): Add entry for 'r7rs-symbols'. (t_read_opts): Add field for 'r7rs_symbols_p'. (scm_read_string_like_syntax): New function based on earlier 'scm_read_string' that handles either string literals or R7RS quoted symbols (delimited by vertical bars), depending on the value of 'chr'. (scm_read_string): Reimplement based on 'scm_read_string_like_syntax'. (scm_read_r7rs_symbol): New static function. * doc/ref/api-data.texi (Symbol Read Syntax): Briefly describe the R7RS symbol syntax, mention the 'r7rs-symbols' read option, and give some examples. * doc/ref/api-evaluation.texi (Scheme Read): Mention the 'r7rs-symbols' read option. * test-suite/tests/reader.test ("reading"): Add test.
2014-01-14Merge branch 'stable-2.0'Mark H Weaver1-1/+17
Conflicts: libguile/chars.c libguile/read.c test-suite/tests/reader.test
2014-01-14Recognize 'escape' character name, per R7RS.Mark H Weaver1-0/+4
* libguile/chars.c (scm_r7rs_charnames, scm_r7rs_charnums): New static constants. (SCM_N_R7RS_CHARNAMES): New macro. (scm_i_charname, scm_i_charname_to_char): Adapt to new R7RS char names. * doc/ref/api-data.texi (Characters): Document #\escape. * test-suite/tests/reader.test ("reading"): Add test.
2014-01-14read: Accept "\|" in string literals.Mark H Weaver1-0/+4
* libguile/read.c (scm_read_string): Accept "\|" in string literals. * doc/ref/api-data.texi (String Syntax): Add "\|" to the list of supported backslash escapes. * test-suite/tests/reader.test ("reading"): Add test.
2014-01-14read: Support R7RS '#true' and '#false' syntax for booleans.Mark H Weaver1-1/+10
* libguile/read.c (try_read_ci_chars): New static function. (scm_read_boolean, scm_read_array): Use 'try_read_ci_chars'. * doc/ref/api-data.texi (Booleans): Update docs. * test-suite/tests/reader.test ("reading"): Add tests.
2014-01-14Merge branch 'stable-2.0'Mark H Weaver4-5/+171
Conflicts: libguile/hash.c module/ice-9/psyntax-pp.scm module/ice-9/psyntax.scm test-suite/tests/r6rs-ports.test
2014-01-13'port-position' works on CBIPs that do not support 'set-port-position!'.Ludovic Courtès1-1/+10
* libguile/r6rs-ports.c (cbp_seek)[WHENCE == SEEK_CUR]: Break out of the switch statement when OFFSET is zero. Pass 'scm_wrong_type_arg_msg' a phrase suitable for use after "expecting". * test-suite/tests/r6rs-ports.test ("7.2.7 Input Ports")["custom binary input port supports `port-position', not `set-port-position!'"]: New test.
2014-01-12Fix 'exact-integer?' comment in numbers.test.Mark H Weaver1-1/+1
* test-suite/tests/numbers.test: Fix 'exact-integer?' comment.
2014-01-12Fix hashing of empty vectors.Mark H Weaver1-2/+13
Fixes a bug introduced in cc1cd04f8111c306cf48b93e131d5c1765c808a3 "Fix hashing of vectors to run in bounded time." * libguile/hash.c (scm_hasher): Avoid division by zero. * test-suite/tests/hash.test ("hash"): Add tests.
2014-01-09Implement R7RS 'syntax-error'.Mark H Weaver1-0/+41
* module/ice-9/psyntax.scm (syntax-error): New macro. (syntax-rules): Handle 'syntax-error' templates specially for improved error reporting. * module/ice-9/psyntax-pp.scm: Regenerate. * doc/ref/api-macros.texi (Syntax Rules): Add new subsection "Reporting Syntax Errors in Macros". * test-suite/tests/syntax.test: Add tests.
2014-01-09psyntax: custom ellipses using 'with-ellipsis' or R7RS syntax-rules.Mark H Weaver1-1/+105
* module/ice-9/psyntax.scm (binding-type): Update the header comment to mention the new 'ellipsis' binding type. (macros-only-env): Preserve ellipsis bindings. (ellipsis?): Add 'r' and 'mod' as arguments. Search the lexical environment for an ellipsis binding, and use it. (gen-syntax): Adapt to the additional arguments of 'ellipsis?'. (with-ellipsis): New core syntax. (convert-pattern): Add unary 'ellipsis?' procedure as an argument. (gen-clause): Adapt to the additional arguments of 'ellipsis?'. Pass unary 'ellipsis?' procedure to 'convert-pattern'. (syntax-case): Adapt to the additional arguments of 'ellipsis?'. (syntax-local-binding): Support new 'ellipsis' binding type. (syntax-rules): Add support for a custom ellipsis identifier as the first operand, as per R7RS. Collect common code within new local procedure 'expand-syntax-rules'. * module/ice-9/psyntax-pp.scm: Regenerate. * module/ice-9/local-eval.scm (analyze-identifiers): Add support for 'ellipsis' binding type. * doc/ref/api-macros.texi (Syntax Rules): Add docs for R7RS custom ellipsis syntax. Use @dots{}. (Syntax Case): Add docs for 'with-ellipsis'. Use @dots{}. (Syntax Transformer Helpers): Update to include new 'ellipsis' binding type. * test-suite/tests/syntax.test: Add tests.
2014-01-09Merge branch 'stable-2.0'Mark H Weaver4-4/+112
Conflicts: module/system/vm/traps.scm test-suite/tests/peval.test
2014-01-08Fix 'string-copy!' to work properly with overlapping src/dest.Mark H Weaver1-3/+12
* libguile/srfi-13.c (scm_string_copy_x): Fix to work properly with overlapping src/dest. * test-suite/tests/srfi-13.test ("string-copy!"): Add tests.
2014-01-08Implement 'exact-integer?' and 'scm_is_exact_integer'.Mark H Weaver1-0/+28
* libguile/numbers.c (scm_exact_integer_p, scm_is_exact_integer): New procedures. (scm_integer_p): Improve docstring. * libguile/numbers.h (scm_exact_integer_p, scm_is_exact_integer): New prototypes. * doc/ref/api-data.texi (Integers): Add docs. * test-suite/tests/numbers.test ("exact-integer?"): Add tests.
2014-01-07Fix inlining of tail list to apply.Ian Price1-1/+15
Fixes <http://bugs.gnu.org/15533>. * module/language/tree-il/peval.scm (peval): Final list argument to `apply' should not be inlined if it is mutable. * test-suite/tests/peval.test ("partial evaluation"): Add test.
2013-12-16Revert "Fix bound-identifier=? to compare binding names, not just symbolic ↵Mark H Weaver1-5/+0
names." This reverts commit 70c74b847680d3b239e591afa2e99c51a712980c.
2013-12-15Fix bound-identifier=? to compare binding names, not just symbolic names.Mark H Weaver1-0/+5
Fixes <http://bugs.gnu.org/16158>. * module/ice-9/psyntax.scm (bound-id=?): Use 'id-var-name' to compare binding names (gensyms), not just symbolic names. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syntax.test: Add test.
2013-12-13syntax-case: fix error reporting for misplaced ellipses.Mark H Weaver1-0/+57
Reported by taylanbayirli@gmail.com (Taylan Ulrich B.). * module/ice-9/psyntax.scm (cvt*): Use 'syntax-case' to destructure the pattern tail, instead of 'pair?', 'car', and 'cdr'. (gen-clause): When checking for errors, check for misplaced ellipsis before duplicate pattern variables, to improve the error message in case of multiple misplaced ellipses. * module/ice-9/psyntax-pp.scm: Regenerate. * test-suite/tests/syntax.test: Add tests.
2013-12-05vm: Gracefully handle stack overflows.Ludovic Courtès1-1/+14
Fixes <http://lists.gnu.org/archive/html/guile-user/2013-12/msg00017.html>. Reported by rvclayton@verizon.net (R. Clayton). * libguile/vm.c (reinstate_stack_reserve): New function. (vm_error_stack_overflow): Install it as an unwind handler. * test-suite/tests/control.test ("the-vm")["stack overflow reinstates stack reserve"]: New test.
2013-12-02Rename "RTL" to "bytecode"Andy Wingo4-42/+42
"RTL" didn't make any sense, and now that there's no other bytecode to disambiguate against, just call it bytecode. * module/Makefile.am: * module/ice-9/eval-string.scm: * module/language/bytecode.scm: * module/language/bytecode/spec.scm: * module/language/cps/arities.scm: * module/language/cps/compile-bytecode.scm: * module/language/cps/compile-rtl.scm: * module/language/cps/contification.scm: * module/language/cps/elide-values.scm: * module/language/cps/primitives.scm: * module/language/cps/reify-primitives.scm: * module/language/cps/spec.scm: * module/language/cps/specialize-primcalls.scm: * module/language/rtl.scm: * module/language/rtl/spec.scm: * module/scripts/compile.scm: * module/system/base/compile.scm: * module/system/repl/common.scm: * module/system/vm/assembler.scm: * module/system/vm/debug.scm: * module/system/vm/disassembler.scm: * module/system/vm/dwarf.scm: * test-suite/tests/cross-compilation.test: * test-suite/tests/dwarf.test: * test-suite/tests/rtl-compilation.test: * test-suite/tests/rtl.test: * test-suite/vm/run-vm-tests.scm: Fixups.