-
Notifications
You must be signed in to change notification settings - Fork 2
/
tests.py
57 lines (44 loc) · 1.71 KB
/
tests.py
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
from VMTranslator import VMTranslator
# To check if tests passed, the CPU emulator is required. It can be
# downloaded at https://www.nand2tetris.org/software.
# ALL TESTS PASSED!
# Nand 2 Tetris Pt.2 Week 1 Test Files
vmt = VMTranslator(
"assets\MemoryAccess\BasicTest\BasicTest.vm",
include_init_code=False) # init done by .tst file
vmt.translate() # Test PASSED
vmt = VMTranslator(
"assets\MemoryAccess\PointerTest\PointerTest.vm",
include_init_code=False) # init done by .tst file
vmt.translate() # Test PASSED
vmt = VMTranslator(
"assets\MemoryAccess\StaticTest\StaticTest.vm",
include_init_code=False) # init done by .tst file
vmt.translate() # Test PASSED
vmt = VMTranslator(
"assets\StackArithmetic\SimpleAdd\SimpleAdd.vm",
include_init_code=False) # init done by .tst file
vmt.translate() # Test PASSED
vmt = VMTranslator(
"assets\StackArithmetic\StackTest\StackTest.vm",
include_init_code=False) # init done by .tst file
vmt.translate() # Test PASSED
# Nand 2 Tetris Pt.2 Week 2 Test Files
vmt = VMTranslator("assets\FunctionCalls\FibonacciElement")
vmt.translate() # Test PASSED
vmt = VMTranslator("assets\\FunctionCalls\\NestedCall")
vmt.translate() # Test PASSED
vmt = VMTranslator(
"assets\FunctionCalls\SimpleFunction",
include_init_code=False) # init done by .tst file
vmt.translate() # Test PASSED
vmt = VMTranslator("assets\FunctionCalls\StaticsTest")
vmt.translate() # Test PASSED
vmt = VMTranslator(
"assets\ProgramFlow\BasicLoop",
include_init_code=False) # init done by .tst file
vmt.translate() # Test PASSED
vmt = VMTranslator(
"assets\ProgramFlow\FibonacciSeries",
include_init_code=False) # init done by .tst file
vmt.translate() # Test PASSED