mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-19 03:13:40 +00:00
Estimated hours taken: 0.2 general/Mmake: Enable double_error, since we now pass it. general/double_error.m: Fix the code so that we don't actually call error; calling error would prevent us from comparing the Mercury and NU-Prolog versions. general/double_error.exp: Add the expected output file.
47 lines
542 B
Mathematica
47 lines
542 B
Mathematica
:- module double_error.
|
|
|
|
:- interface.
|
|
|
|
:- import_module io.
|
|
|
|
:- pred main(io__state::di, io__state::uo) is det.
|
|
|
|
:- implementation.
|
|
|
|
:- import_module list, require.
|
|
|
|
main -->
|
|
io__command_line_arguments(Args),
|
|
{ list__length(Args, Num) },
|
|
(
|
|
{ p(Num) }
|
|
->
|
|
io__write_string("1\n")
|
|
;
|
|
{ Arg = "not 1\n" },
|
|
{ error(Arg) }
|
|
),
|
|
(
|
|
{ q(Num) }
|
|
->
|
|
io__write_string("2\n")
|
|
;
|
|
{ Arg = "not 2\n" },
|
|
{ error(Arg) }
|
|
).
|
|
|
|
:- pred p(int::in) is semidet.
|
|
|
|
p(0).
|
|
p(1).
|
|
p(2).
|
|
p(3).
|
|
|
|
:- pred q(int::in) is semidet.
|
|
|
|
q(0).
|
|
q(4).
|
|
q(5).
|
|
q(6).
|
|
|