Commit | Line | Data |
---|---|---|
6e942bd8 AT |
1 | #!/usr/local/bin/python3.6 |
2 | ||
3 | # (c) 2019 Aaron Taylor <ataylor at subgeniuskitty dot com> | |
4 | # All rights reserved. | |
5 | ||
6 | # Quick and dirty tests for the VVhitespace interpreter. | |
7 | ||
8 | import os, subprocess | |
9 | ||
10 | compiler_path = './vvc' | |
11 | interpreter_path = './vvi' | |
12 | temp_file = './test.vvs' | |
13 | path_to_tests = './tests/' | |
14 | src_extension = '.pvvs' | |
15 | ||
16 | tests = [ | |
17 | ['0001_push_printchar_exit', 'A'], | |
18 | ['1001_stack_operations', 'BB'] | |
19 | ] | |
20 | ||
21 | for test in tests: | |
22 | subprocess.run([compiler_path, '-i', path_to_tests + test[0] + src_extension, '-o', temp_file]) | |
23 | result = subprocess.run([interpreter_path, '-i', temp_file], stdout=subprocess.PIPE) | |
24 | if result.stdout.decode('utf-8') != test[1]: | |
25 | print(test[0]) | |
26 | else: | |
27 | print('.', end='') | |
28 | os.remove(temp_file) | |
29 | ||
30 | print("") |