[m-rev.] RNGs

Mark Brown mark at mercurylang.org
Wed Aug 28 00:51:17 AEST 2019


On Tue, Aug 27, 2019 at 1:55 PM Mark Brown <mark at mercurylang.org> wrote:
>
> On Tue, Aug 27, 2019 at 10:59 AM Julien Fischer <jfischer at opturion.com> wrote:
> > >  Are the names "gen_uint8", etc, okay instead?
> >
> > I would prefer "generate_uint8" etc to the abbrevated form.  Rationale:
> > we already have array.generate and I don't want to add to the situation
> > we already have in the stdlib with "rev" and "reverse".
>
> Fixed. I'll rebase and merge these changes after bootcheck finishes,
> unless anyone has any other comments.

Two of the generators fail in csharp grade, which seems to be a
problem with arrays of uint32/uint64. E.g., the following

main(!IO) :-
    array.init(3, 2u32, L),
    write_line(L, !IO).

fails with

System.InvalidCastException: Specified cast is not valid.
  at mercury.test.main_2_p_0 () <0x41b76730 + 0x00083> in <filename unknown>:0
  at mercury.test.Main (System.String[] args) <0x41b38d50 + 0x0001f>
in <filename unknown>:0

For now, I'll just disable the tests on csharp. The diff for this is attached.

Mark
-------------- next part --------------
commit 6577500f9ec8ca385204db55b75623ae22b1aaf1
Author: Mark Brown <mark at mercurylang.org>
Date:   Tue Aug 27 23:50:10 2019 +1000

    Disable tests of random module in C# and Erlang grades.

diff --git a/tests/hard_coded/Mmakefile b/tests/hard_coded/Mmakefile
index a16c707..e68cec0 100644
--- a/tests/hard_coded/Mmakefile
+++ b/tests/hard_coded/Mmakefile
@@ -303,9 +303,6 @@ ORDINARY_PROGS = \
 	quantifier \
 	quantifier2 \
 	quoting_bug_test \
-	random1 \
-	random2 \
-	random3 \
 	random_permutation \
 	random_simple \
 	rational_test \
@@ -495,6 +492,16 @@ else
 	FOREIGN_ENUM_PROGS =
 endif
 
+# Tests of the random module currently only work in C and Java grades.
+ifeq "$(filter csharp% erlang%,$(GRADE))" ""
+	RANDOM_PROGS = \
+		random1 \
+		random2 \
+		random3
+else
+	RANDOM_PROGS =
+endif
+
 # Some tests only link in trailing grades.
 ifeq "$(filter tr%,$(GRADE))" ""
 	TRAILED_PROGS =
@@ -858,6 +865,7 @@ PROGS = \
 	$(CSHARP_PROGS) \
 	$(SOLVER_PROGS) \
 	$(FOREIGN_ENUM_PROGS) \
+	$(RANDOM_PROGS) \
 	$(TRAILED_PROGS) \
 	$(STACK_SEGMENT_PROGS) \
 	$(MUTABLE_PROGS) \


More information about the reviews mailing list