home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / TESTS / LF / TESTPROF.LF < prev    next >
Text File  |  1996-06-04  |  935b  |  63 lines

  1.  
  2. %%%
  3. %%%  Predicates and functions used to test the module 'profiler'
  4. %%%
  5.  
  6.  
  7. import("profiler")?
  8.  
  9. app([], X, X).
  10. app([X | LX], L, [X | R]) :- app(LX, L, R).
  11.  
  12.  
  13. verif(X) :- 
  14.   cond(X :== true, 
  15.     (
  16.       write("that's true"),
  17.       nl
  18.     ),
  19.     (
  20.        write("that's false"),
  21.        nl
  22.     )
  23.   ).
  24.  
  25.  
  26. q :- 
  27.     write("q : first try"), nl, fail
  28.   ;
  29.     write("q : second try"), nl.
  30. q :- write("q : that's all"), nl, !, fail.
  31. q. 
  32.  
  33.  
  34. testapp :-  write("testapp"), nl, app(A,B,[1,2,3]), write(A), nl, write(B), nl, fail.
  35. testapp :- write("failure !"), nl, !, fail.
  36. testapp.
  37.  
  38.  
  39. f(S:string) -> R | R=strcon("+", strcon(S, "+")).
  40. f(N:int) -> Y + 1 | Y = N*N, fail.
  41.  
  42.  
  43. %%% This example shows that the profiler is able to register a function failure
  44. %%% even if the evaluation fails.
  45.  
  46. g(S:string) -> S + 1 | S $== "anything".  
  47. g(X:int) -> R | (X =:= 0, !, R="zero" ; R="<> 0"). 
  48.  
  49.  
  50. h(X:int) -> X+1.
  51. h(S:string) -> R | R=strcon(S,"+++").
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.