Skip to content

Commit

Permalink
Fix timeframes
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasKl committed May 5, 2024
1 parent 163306b commit 6cff559
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions tests/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,3 +507,22 @@ def test_lambda_apply(self):
# Apply named lambda
self.w.eval_str('(define foo (lambda (y) (* y 2)))')
self.checkEqual('(foo 5)', 10)


class MultipleTracesTest(unittest.TestCase):
'''Test multiple traces'''

def setUp(self):
self.w = Wal()
self.w.load('tests/traces/counter.fst', tid='a')
self.w.load('tests/traces/counter.vcd', tid='b')

def checkEqual(self, txt, res):
'''eval first argument and check if result matches second argument '''
sexpr = read_wal_sexpr(txt)
self.assertEqual(self.w.eval(sexpr), res)

def test_index(self):
self.w.eval_str('(define x 0)')
self.w.eval_str('(whenever (!= a^INDEX b^INDEX) (inc x))')
self.checkEqual('x', 0)
2 changes: 1 addition & 1 deletion wal/libs/std/std.wal
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@

;; trace functions
(defun ALL-INDICES []
(map (fn [t] (list t (get (+ t "§INDEX")))) (loaded-traces)))
(map (fn [t] (list t (get (+ t "^INDEX")))) (loaded-traces)))

(defmacro timeframe body
(let ([TIMEFRAME-START (gensym)]
Expand Down

0 comments on commit 6cff559

Please sign in to comment.