Add test case to demonstrate tracing, as discussed in issue 68.

The new evaluator allows us to have more direct control over
evaluation order, and makes it straightforward to implement tracing
primitives.  There are two new primitives 'trace' and 'traceVal' in the
Cryptol prelude that produce tracing output when evaluated.
Fixes #68
This commit is contained in:
Robert Dockins 2016-07-13 15:09:56 -07:00
parent e001310299
commit 5d1e1948d8
3 changed files with 24 additions and 0 deletions

7
tests/issues/issue68.cry Normal file
View File

@ -0,0 +1,7 @@
f : [8] -> [8]
f x = 20 + x
// Note! This test case may be a bit fragile, as it
// tests the output of tracing, which depends on evaluation
// order.
traceTest = [ trace "Hi!" i (f i) | i <- [0 .. 10 ] ]

View File

@ -0,0 +1,2 @@
:l issue68.cry
traceTest

View File

@ -0,0 +1,15 @@
Loading module Cryptol
Loading module Cryptol
Loading module Main
Hi! 0
Hi! 1
Hi! 2
Hi! 3
Hi! 4
Hi! 5
Hi! 6
Hi! 7
Hi! 8
Hi! 9
Hi! 10
[0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e]