[m-rev.] diff: test case (disabled) for shallow tracing

Mark Brown dougl at cs.mu.OZ.AU
Fri Aug 30 02:19:52 AEST 2002


Estimated hours taken: 0.5
Branches: main

tests/debugger/declarative/Mercury.options:
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/shallow.exp:
tests/debugger/declarative/shallow.inp:
tests/debugger/declarative/shallow.m:
tests/debugger/declarative/shallow_2.m:
tests/debugger/declarative/shallow_3.m:
	A test case for declarative debugging of shallow traced code.  This
	test is currently disabled because we don't yet support this trace
	level in the declarative debugger, although we hope to in future.

Index: tests/debugger/declarative/Mercury.options
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mercury.options,v
retrieving revision 1.1
diff -u -r1.1 Mercury.options
--- tests/debugger/declarative/Mercury.options	17 Aug 2002 13:52:03 -0000	1.1
+++ tests/debugger/declarative/Mercury.options	29 Aug 2002 16:14:16 -0000
@@ -4,6 +4,7 @@
 MCFLAGS-dependency2=--trace rep
 MCFLAGS-input_term_dep=--trace rep
 MCFLAGS-output_term_dep=--trace rep
+MCFLAGS-shallow_2=--trace shallow
 MCFLAGS-special_term_dep=--trace rep
 MCFLAGS-tabled_read_decl=--trace rep --trace-table-io-decl
 MCFLAGS-untraced_subgoal_sub=--trace minimum
Index: tests/debugger/declarative/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/declarative/Mmakefile,v
retrieving revision 1.38
diff -u -r1.38 Mmakefile
--- tests/debugger/declarative/Mmakefile	17 Aug 2002 13:52:03 -0000	1.38
+++ tests/debugger/declarative/Mmakefile	29 Aug 2002 16:14:17 -0000
@@ -49,6 +49,7 @@
 	untraced_subgoal
 
 NONWORKING_DECLARATIVE_PROGS=	\
+	shallow			\
 	solutions
 
 ifneq "$(findstring .debug,$(GRADE))" ""
@@ -183,6 +184,9 @@
 
 queens.out: queens queens.inp
 	$(MDB) ./queens < queens.inp > queens.out 2>&1
+
+shallow.out: shallow shallow.inp
+	$(MDB) ./shallow < shallow.inp > shallow.out 2>&1
 
 small.out: small small.inp
 	$(MDB) ./small < small.inp > small.out 2>&1
Index: tests/debugger/declarative/shallow.exp
===================================================================
RCS file: tests/debugger/declarative/shallow.exp
diff -N tests/debugger/declarative/shallow.exp
Index: tests/debugger/declarative/shallow.inp
===================================================================
RCS file: tests/debugger/declarative/shallow.inp
diff -N tests/debugger/declarative/shallow.inp
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/shallow.inp	29 Aug 2002 16:14:18 -0000
@@ -0,0 +1,43 @@
+echo on
+register --quiet
+break test
+continue
+finish
+dd
+n
+n
+y
+y
+continue
+continue
+finish
+dd
+n
+n
+y
+y
+continue
+continue
+finish
+dd
+n
+n
+y
+continue
+continue
+finish
+dd
+n
+n
+y
+y
+continue
+continue
+finish
+dd
+n
+n
+y
+y
+continue
+continue
Index: tests/debugger/declarative/shallow.m
===================================================================
RCS file: tests/debugger/declarative/shallow.m
diff -N tests/debugger/declarative/shallow.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/shallow.m	29 Aug 2002 16:14:18 -0000
@@ -0,0 +1,30 @@
+:- module shallow.
+:- interface.
+:- import_module io.
+:- pred main(io__state::di, io__state::uo) is det.
+:- implementation.
+:- import_module shallow_2.
+
+main -->
+	{ test(p("t1", 5), P1) },
+	{ test(p("t2", 37), P2) },
+	{ test(q("t3", 2), Q1) },
+	{ test(q("t4", -1), Q2) },
+	{ test(r("t5", 3), R) },
+	io__write_int(P1),
+	io__nl,
+	io__write_int(P2),
+	io__nl,
+	io__write_int(Q1),
+	io__nl,
+	io__write_int(Q2),
+	io__nl,
+	io__write_int(R),
+	io__nl.
+
+:- pred test(pred(int), int).
+:- mode test(pred(out) is det, out) is det.
+
+test(P, N) :-
+	P(N).
+
Index: tests/debugger/declarative/shallow_2.m
===================================================================
RCS file: tests/debugger/declarative/shallow_2.m
diff -N tests/debugger/declarative/shallow_2.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/shallow_2.m	29 Aug 2002 16:14:18 -0000
@@ -0,0 +1,45 @@
+:- module shallow_2.
+:- interface.
+
+:- pred p(string::in, int::in, int::out) is det.
+:- pred q(string::in, int::in, int::out) is det.
+:- pred r(string::in, int::in, int::out) is det.
+
+:- implementation.
+:- import_module shallow_3.
+
+p(S, M, N) :-
+	(
+		pp(S, 1, M)
+	->
+		N = 1
+	;
+		N = -11
+	).
+
+:- pred pp(string::in, int::in, int::out) is multi.
+
+pp(S, M, N) :- a(S, M, N).  
+pp(S, M, N) :- b(S, M, N).
+
+q(S, M, N) :-
+	(
+		% Fails:
+		a(S, M, -1)
+	->
+		N = 11
+	;
+		N = 2
+	).
+
+r(S, M, N) :-
+	(
+		% Succeeds:
+		\+ a(S, M, -3),
+		b(S, M, 5)
+	->
+		N = 23
+	;
+		N = 0
+	).
+
Index: tests/debugger/declarative/shallow_3.m
===================================================================
RCS file: tests/debugger/declarative/shallow_3.m
diff -N tests/debugger/declarative/shallow_3.m
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ tests/debugger/declarative/shallow_3.m	29 Aug 2002 16:14:18 -0000
@@ -0,0 +1,13 @@
+:- module shallow_3.
+:- interface.
+
+:- pred a(string::in, int::in, int::out) is multi.
+:- pred b(string::in, int::in, int::out) is det.
+
+:- implementation.
+
+a(_, X, X).
+a(_, _, 0).
+
+b(_, _, 5).
+
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list