8 Commits

Author SHA1 Message Date
Zoltan Somogyi
2bd7c5ee3e Rename X's aux modules as X_helper_N in hard_coded.
tests/hard_coded/*.m:
    Rename modules as mentioned above.

    In a few cases, where the main module's name itself had a suffix,
    such as "_mod_a" or "_main", remove that suffix. This entails
    renaming the .exp file as well. (In some cases, this meant that
    the name of a helper module was "taken over" by the main module
    of the test case.)

    Update all references to the moved modules.

    General updates to programming style, such as

    - replacing DCG notation with state var notation
    - replacing (C->T;E) with (if C then T else E)
    - moving pred/func declarations to just before their code
    - replacing io.write/io.nl sequences with io.write_line
    - replacing io.print/io.nl sequences with io.print_line
    - fixing too-long lines
    - fixing grammar errors in comments

tests/hard_coded/Mmakefile:
tests/hard_coded/Mercury.options:
    Update all references to the moved modules.

    Enable the constant_prop_int test case. The fact that it wasn't enabled
    before is probably an accident. (When constant_prop_int.m was created,
    the test case was added to a list in the Mmakefile, but that list
    was later removed due to never being referenced.)

tests/hard_coded/constant_prop_int.{m,exp}:
    Delete the calls to shift operations with negative shift amounts,
    since we have added a compile-time error for these since the test
    was originally created.
2023-06-16 08:33:22 +02:00
Zoltan Somogyi
f8c67929de Modernize library/array2d.m.
library/array2d.m:
    Add lookup and unsafe_lookup, in both function and predicate forms,
    as alternatives to rafe's ^elem notation.

    Use meaningful variable names in both code and documentation.
    For example, use NumRows and NumColumns instead of M and N.

    Replace the implementation of the function that converts a 2d array
    back to lists. The new implementation has one loop over rows and one
    loop over columns, while the old one had a single loop that did
    both jobs. The new one returns [] (meaning no rows) for a 0x0 array,
    while the old returned [[]] (meaning one row with no columns).

NEWS:
    Announce the changes.

tests/hard_coded/test_array2d.m:
    Use a lookup instead of ^elem.

tests/hard_coded/test_array2d.exp:
    Expect the updated output from lists. Expect any exceptions to come
    from lookup functions, not ^elem functions (since the latter now
    just call the former).
2020-10-05 00:06:37 +11:00
Zoltan Somogyi
12a870f8f6 Test another predicate in array2d. 2020-10-03 20:19:59 +10:00
Julien Fischer
a79bae00e8 Add io.write_array/[56] and array2d.is_empty/1.
library/io.m:
    Add predicates io.write_array/[56] which are are similar to
    io.write_list but work on arrays and do _not_ require converting
    the array into a list first.

library/array2d.m:
    Add array2d.is_empty/1.

NEWS:
    Announce the above additions.

tests/hard_coded/Mmakefile:
tests/hard_coded/write_array.{m,exp}:
    Add a test for write_array.

tests/hard_coded/test_array2d.{m,exp}:
    Extend this test to cover is_empty/1.
2016-03-18 12:06:10 +11:00
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00
Julien Fischer
92ddfdcf11 Delete obsolete procedures and modules from the standard library.
library/array.m:
library/array2d.m:
library/bitmap.m:
library/store.m:
library/thread.semaphore.m:
library/version_array2d.m:
library/version_bitmap.m:
library/version_hash_table.m:
library/version_store.m:
	Delete predicates that were deprecated in Mercury 13.05 and before.

library/version_array.m
	Delete the deprecated function new/2.

	Deprecate unsafe_new/2	and unsafe_init/2 to replace it.
	(We had overlooked this previously.)

library/string.m:
	Delete the deprecated function set_char_char/3.
	(We will leave the other deprecated procedures in this module
	for at least another release.)

library/svlist.m:
library/svpqueue.m:
library/svstack.m:
	Delete these modules: they were only ever needed as a transitional
	mechanism.

library/library.m:
	Conform to the above changes.

doc/Mmakefile:
	Unrelated change: delete references to files that have been
	deleted since we moved to git.

tests/hard_coded/*/*.m
tests/tabling/*.m:
	Update test cases where they made use of predicates that have
	now been deleted from the standard library.
2013-05-16 17:50:15 +10:00
Julien Fischer
3eab84ca5f Fix a test case that was failing due to a type
Estimated hours taken: 0.5
Branches: main

tests/hard_coded/test_array2d.m:
	Fix a test case that was failing due to a type
	ambiguity caused by the addition of string.string/1
	to the library.
2004-03-19 09:06:56 +00:00
Ralph Becket
40f91a28ef Added a new library module, array2d.m, implementing 2d rectangular arrays.
Estimated hours taken: 4
Branches: main

Added a new library module, array2d.m, implementing 2d rectangular arrays.

NEWS:
	Report the new addition.

library/array2d.m:
	Added.

library/library.m:
	Added import for array2d.

compiler/modules.m:
	Added clause for array2d to mercury_std_library_module/1.

tests/hard_coded/test_array2d.m:
tests/hard_coded/test_array2d.exp:
tests/hard_coded/Mmakefile:
	Test case added.
2003-01-23 04:25:47 +00:00