Commit Graph

7 Commits

Author SHA1 Message Date
Julien Fischer
1f6d83692a Update programming style in tests/hard_coded.
tests/hard_coded/*.m:
    Update programming style, unless doing so would change
    the meaning of the test, in particular:

    - use '.' as a module qualifier in place of '__'
    - use {write,print}_line where appropriate
    - use if-then-else in place of C -> T ; E
    - use state variables in place of DCGs

tests/hard_coded/dir_test.m:
    Document what the expected outputs correspond to.

    Use a uniform module qualifier in the output.

tests/hard_coded/dir_test.exp*:
    Conform to the above change.
2021-01-07 13:58:12 +11:00
Zoltan Somogyi
a69fc36be0 Update some tests' programming style. 2020-10-05 17:53:05 +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
0ff60718d1 Allow strings of digits prefixed by a single '+' to be converted
Estimated hours taken: 0.5
Branches: main

Allow strings of digits prefixed by a single '+' to be converted
to arbitrary precision integers.

library/integer.m:
	Modify integer.from_string/1 and integer.det_from_string/1
	so that they accept strings that match the regexp [+-]?[0-9]+.
	Previously they would fail to correctly convert a string of
	digits if it was prefixed by a single '+'.

	This now corresponds to the behaviour of string.to_int/1
	and string.det_to_int/1.

tests/hard_coded/integer_test.m:
	Check that strings of digits prefixed with '+' are converted
	correctly.
2004-11-11 06:41:52 +00:00
Julien Fischer
794f363490 Add a new function to the integer module and deprecate an
Estimated hours taken: 1
Branches: main

Add a new function to the integer module and deprecate an
existing predicate.

library/integer.m:
	Add a function integer.det_from_string/1 that is similar
	to integer.from_string/1 except that it throws an
 	exception instead of failing if the string cannot be
	converted to an integer.

	Deprecate the predicate version of integer.pow.  We don't
	gain anything from having both a predicate and function
	version.

library/string.m:
	Replace a call to the predicate version of integer.pow with
	a call to the function version.

tests/hard_coded/integer_test.m:
	Test integer.det_from_string.
	Replace instances of `:' as the module qualifier.
	Include integer.one/0 and integer.zero/0 in some
	of the tests.

NEWS:
	Mention these changes.
2004-11-10 07:12:38 +00:00
Zoltan Somogyi
6554ef7daa Replace "is" with "=".
Estimated hours taken: 2
Branches: main

Replace "is" with "=".
Add field names where relevant.
Replace integers with counters where relevant.
2003-05-26 09:01:46 +00:00
Bert Thompson
30ef37923c Moved tests of library/{integer,rational}.m from tests/general to
Estimated hours taken: 0.1

Moved tests of library/{integer,rational}.m from tests/general to
tests/hard_coded since the library modules and their tests cannot
be compiled under NU-Prolog.

general/Mmakefile:
general/.cvsignore:
	Removed references to integer_test and rational_test.
general/integer_test.m:
general/integer_test.exp:
general/rational_test.exp:
general/rational_test.m:
	File removed.
hard_coded/Mmakefile:
hard_coded/.cvsignore:
	Added references to integer_test and rational_test.
hard_coded/integer_test.m:
hard_coded/integer_test.exp:
hard_coded/rational_test.exp:
hard_coded/rational_test.m:
	File added.
1998-04-16 12:00:32 +00:00