-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtests.py
More file actions
60 lines (50 loc) · 2.1 KB
/
tests.py
File metadata and controls
60 lines (50 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
##------------------------------------------------------------------------------
## tests.py
##
## Unit tests for pylambda
##------------------------------------------------------------------------------
##------------------------------------------------------------------------------
## local imports
##------------------------------------------------------------------------------
from lexer import *
from parser import *
from terms import *
from algorithms import *
##------------------------------------------------------------------------------
## global imports
##------------------------------------------------------------------------------
import ply.lex as lex
import ply.yacc as yacc
import unittest
##------------------------------------------------------------------------------
## class PyLambdaTest
##------------------------------------------------------------------------------
class PyLambdaTest(unittest.TestCase):
def test_bound_vars_variable (self):
self.assertEqual (set([]), bound_vars (Variable ('a')))
self.assertEqual (set(['b']),
bound_vars (Abstraction
('b',
Application
(Variable ('a'),
Variable ('b')))))
def test_free_vars (self):
self.assertEqual (set (['a']), free_vars (Variable ('a')))
self.assertEqual (set (['a']),
free_vars (Abstraction
('b',
Application
(Variable ('a'),
Variable ('b')))))
def test_substitute (self):
return
def test_beta_reduce (self):
return
def test_multi_step_beta_reduce (self):
return
##
##------------------------------------------------------------------------------
## Main
##------------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()