Skip to content

Commit 05c8f12

Browse files
committed
tests organized, created a pretty page for MSX's examples
1 parent 9f79032 commit 05c8f12

26 files changed

+101
-17
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.cache/*
22
__pycache__/*
3+
tests/__pycache__/*
4+
tests/.cache/*
35
py3/*
46
*.swp

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![](inliner_logo.png)
1+
![](images/inliner_logo.png)
22

33
__Inliner__ is a tool that converts a BASIC program written in an indented BASIC style into the numbered lines style. It supports labels, definitions and statements in multiple lines and you could to choose the comments that will be exported after conversion.
44

examples/msx/README.md

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Examples for MSX
2+
3+
There are few examples of MSX-BASIC programs I've written using the Inliner's syntax.
4+
5+
## brainfuck.bas
6+
7+
A [brainfuck](https://en.wikipedia.org/wiki/Brainfuck) interpreter in a single BASIC line.
8+
9+
![](../../images/brainfuck.png)
10+
11+
There is a sample 'hello world' :
12+
```
13+
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>+
14+
+.<<+++++++++++++++.>.+++.------.--------.>+.>.
15+
```
16+
17+
## colored_sprite.bas
18+
19+
Example of MSX2's colored sprites using the "OR method" to obtain a 3rd color.
20+
21+
![](../../images/colored_sprite.png)
22+
23+
## hardware_scroll.bas
24+
25+
Simple animation using MSX2+'s hardware scrolling feature.
26+
27+
![](../../images/hardware_scroll.png)
28+
29+
## kaleidoscope2.bas
30+
31+
Kaleidoscope program for MSX1 in 256×192, 16 colors and color clashing.
32+
33+
![](../../images/kaleidoscope2.png)
34+
35+
## kaleidoscope5.bas
36+
37+
Kaleidoscope program for MSX2 in 256×212 and 16 colors.
38+
39+
![](../../images/kaleidoscope5.png)
40+
41+
## kaleidoscope8.bas
42+
43+
Kaleidoscope program for MSX2 in 256×212 and 256 colors.
44+
45+
![](../../images/kaleidoscope8.png)
46+
47+
## spiral.bas
48+
49+
Simple animation on the 32×24 text mode.
50+
51+
![](../../images/spiral.png)
52+
53+
## sunset.bas
54+
55+
A sunset pattern.
56+
57+
![](../../images/sunset.png)

images/brainfuck.png

6.99 KB
Loading

images/colored_sprite.png

3.28 KB
Loading

images/hardware_scroll.png

12.1 KB
Loading
File renamed without changes.

images/kaleidoscope2.png

42 KB
Loading

images/kaleidoscope5.png

67.8 KB
Loading

images/kaleidoscope8.png

82.5 KB
Loading

images/kaleidoscope_apple2.png

36.1 KB
Loading

images/kaleidoscope_mc1000.png

9.94 KB
Loading

images/spiral.png

5.12 KB
Loading

images/sunset.png

4.56 KB
Loading

images/triangles.png

4.11 KB
Loading

messages.pot lang/messages.pot

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

conversion_test.py tests/conversion_test.py

+24-16
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,43 @@
1-
# tratamento de leiaute de arquivos
1+
#
2+
# Program conversion tests
3+
#
4+
import sys
5+
sys.path.append('../inliner')
6+
7+
from os import path
28
from Inliner import Inliner
39

4-
START=10
5-
STEP=10
6-
LF="\n"
7-
UPPER=False
10+
START = 10
11+
STEP = 10
12+
LF = "\n"
13+
UPPER = False
14+
15+
TEST_DIR = 'tests'
816

917
def fake_inliner(filename):
10-
program = Inliner.load(filename=filename)
18+
program = Inliner.load(filename=path.join(TEST_DIR, filename))
1119
code = Inliner(program=program, start_line=START, step_line=STEP)
1220
return code.list(uppercase=UPPER, linefeed=LF)
1321

1422

1523
def test_base():
16-
assert fake_inliner("examples/tests/base.bas") == \
17-
"""10 input "What is your name?";k$
24+
assert fake_inliner('base.bas') == \
25+
"""10 input "What is your name?";k$
1826
20 print "Hello ";k$;"!"
1927
"""
2028

2129

2230
def test_comment():
23-
assert fake_inliner("examples/tests/comment.bas") == \
24-
"""10 ' It is a comment
31+
assert fake_inliner('comment.bas') == \
32+
"""10 ' It is a comment
2533
20 input "What is your name?";k$
2634
30 print "Hello ";k$;"!"
2735
"""
2836

2937

3038
def test_labels():
31-
assert fake_inliner("examples/tests/labels.bas") == \
32-
"""10 input "What is your name?";k$
39+
assert fake_inliner('labels.bas') == \
40+
"""10 input "What is your name?";k$
3341
20 print "Hello "; k$;", how do you doing?"
3442
30 input "Again (Y/N)?";k$:if k$="N" then end
3543
40 if k$="Y" then goto 10
@@ -38,15 +46,15 @@ def test_labels():
3846

3947

4048
def test_self_label():
41-
assert fake_inliner("examples/tests/self_label.bas") == \
42-
"""10 i=1:print "counting... ";
49+
assert fake_inliner('self_label.bas') == \
50+
"""10 i=1:print "counting... ";
4351
20 print i;:i=i+1:goto 20
4452
"""
4553

4654

4755
def test_self_splitting():
48-
assert fake_inliner("examples/tests/splitting.bas") == \
49-
"""10 input "What is your name?";k$
56+
assert fake_inliner('splitting.bas') == \
57+
"""10 input "What is your name?";k$
5058
20 print "Hello "; k$;", how do you doing?"
5159
"""
5260

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/undefined_label.bas

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
let i%=0
2+
3+
main_loop:
4+
5+
if i%<20 then gosub {{wrong_label}}
6+
7+
i%=i%+1
8+
goto {{main_loop}}
9+
10+
end
11+
12+
right_label:
13+
print "*";
14+
return

tests/wrong_label_name.bas

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
$teste:
2+
print "hello!"
3+

0 commit comments

Comments
 (0)