From 5d1e1948d8cd5cb412f75325961bc8816793af5b Mon Sep 17 00:00:00 2001 From: Robert Dockins Date: Wed, 13 Jul 2016 15:09:56 -0700 Subject: [PATCH] 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 --- tests/issues/issue68.cry | 7 +++++++ tests/issues/issue68.icry | 2 ++ tests/issues/issue68.icry.stdout | 15 +++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 tests/issues/issue68.cry create mode 100644 tests/issues/issue68.icry create mode 100644 tests/issues/issue68.icry.stdout diff --git a/tests/issues/issue68.cry b/tests/issues/issue68.cry new file mode 100644 index 00000000..230453fa --- /dev/null +++ b/tests/issues/issue68.cry @@ -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 ] ] diff --git a/tests/issues/issue68.icry b/tests/issues/issue68.icry new file mode 100644 index 00000000..82dd66e0 --- /dev/null +++ b/tests/issues/issue68.icry @@ -0,0 +1,2 @@ +:l issue68.cry +traceTest diff --git a/tests/issues/issue68.icry.stdout b/tests/issues/issue68.icry.stdout new file mode 100644 index 00000000..0507c4ed --- /dev/null +++ b/tests/issues/issue68.icry.stdout @@ -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]