Commit Graph

5 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
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
Fergus Henderson
a22674efa6 Fix a bug in the definition of `div'.
Estimated hours taken: 0.5

library/int.m:
	Fix a bug in the definition of `div'.

tests/hard_coded/division_test.m:
	Add some new regression tests for the above-mentioned bug.
1997-11-24 15:27:33 +00:00
Fergus Henderson
c71bef50d1 Fix some bugs in the test case:
Estimated hours taken: 1

tests/hard_coded/division_test.m:
	Fix some bugs in the test case:
	div_test/4 was testing `//' rather than `div',
	and the formulas used in mod_test/4 were wrong.
1997-03-23 19:44:01 +00:00
Fergus Henderson
4f41a1b7c2 Clean up the handlng of integer division and remainder.
library/int.m:
	Add a new function `div'.  The idea is that `div' is the same
	as `//', except that `div' will round toward minus infinity, whereas
	`//' will round toward zero.  `div' is more well-behaved, `//'
	is more efficient.

	Change the behaviour of `mod' so that it is remainder after `div'
	rather than remainder after `//'.  This makes it more well-behaved,
	but less efficient.

	Add a new function `rem', which is the new name for what `mod'
	used to do (i.e. remainder after `//').

compiler/llds.m:
	Add some comments about the `/' and `mod' llds operators.
	(The `mod' llds operator should probably be renamed `rem',
	but I haven't done that yet.)

compiler/code_util.m:
	Recognize `int:rem', rather than `int:mod', as the llds `mod'
	operator.

tests/hard_coded/division_test.m:
	Add some test cases for `div', `mod', `//', and `rem' on
	negative numbers.
1997-03-21 10:57:45 +00:00