Commit Graph

3 Commits

Author SHA1 Message Date
Zoltan Somogyi
d23c4f74a3 Update the style of more tests. 2020-10-06 19:20:18 +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
Mark Brown
db259026ac Provide better documentation on how (not) to use the random number
Estimated hours taken: 1.5
Branches: main

library/random.m:
	Provide better documentation on how (not) to use the random number
	generator in the standard library.  Generators of this kind are
	very sensitive to the way in which they are used, and if used
	in a way not anticipated they can give very poor results.

	XXX The standard library really should provide a better quality RNG.
	There is still a place for quick and dirty RNGs like this one,
	though, provided users are given adequate information about the
	pitfalls.

	One of the pitfalls to avoid is that you shouldn't use mod (or rem)
	to reduce a number down to some desired range, you should use
	something like div.  We therefore provide a predicate that does
	this the prescribed way.  We also provide a predicate that is
	similar to randmax, but returns the number of distinct random
	numbers that can be generated instead of the maximum.

	Fix random__permutation to avoid the above pitfall.

	Replace some occurrences of is/2 with =/2.

NEWS:
	Mention the new predicate.

tests/hard_coded/Mmakefile:
tests/hard_coded/random_permutation.exp:
tests/hard_coded/random_permutation.m:
	A test case for random__permutation.  We don't test that the
	result is "random", but we at least test that it is a permutation.

tests/hard_coded/random_simple.exp:
tests/hard_coded/random_simple.m:
	A simple test that checks for off-by-one errors in random__random/5.

tests/hard_coded/stable_sort.m:
tests/hard_coded/test_bitset.exp:
tests/hard_coded/test_bitset.m:
	Fix these tests to avoid the above pitfall.  The bitset tester also
	needed to be modified so that it doesn't output anything that may
	depend on the particular random sequence generated.
2002-09-26 06:11:39 +00:00