Skip to content

Commit 6112a98

Browse files
committed
Update unit tests, #30
1 parent dcc8f95 commit 6112a98

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

export/carts/demo.p8.png

342 Bytes
Loading

tests/tests.lua

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,51 @@ function test_control_flow()
101101
assert_equal(sum, 6, "for loop")
102102
end
103103

104+
-- P8SCII
105+
function test_graphics()
106+
cls()
107+
108+
for i = 15, 0, -1 do
109+
fillp(0x0000)
110+
circ(64, 64, 2 + (i * 2), i)
111+
fillp(0x51BF)
112+
circfill(0, 0, 2 + (i * 2), i)
113+
end
114+
115+
fillp("\x80")
116+
rectfill(64, 0, 67, 3, 15)
117+
fillp("\x81")
118+
rectfill(68, 0, 71, 3, 14)
119+
fillp("\x82")
120+
rectfill(72, 0, 75, 3, 13)
121+
fillp("\x83")
122+
rectfill(76, 0, 79, 3, 12)
123+
fillp("\x84")
124+
rectfill(80, 0, 83, 3, 11)
125+
fillp("\x85")
126+
rectfill(84, 0, 87, 3, 10)
127+
fillp("\x86")
128+
rectfill(88, 0, 91, 3, 9)
129+
fillp("\x87")
130+
rectfill(92, 0, 95, 3, 8)
131+
132+
fillp(0x0000)
133+
pset(64, 64, 142)
134+
rect(31, 31, 98, 98, 140)
135+
136+
rectfill(32, 32, 40, 40, 8)
137+
rectfill(89, 32, 97, 40, 9)
138+
rectfill(32, 89, 40, 97, 10)
139+
rectfill(89, 89, 97, 97, 11)
140+
141+
ovalfill(105, 105, 127, 115, 13)
142+
oval(107, 107, 125, 113, 15)
143+
line(110, 110, 122, 110, 8)
144+
145+
local crc = crc32(0x6000, 0x2000);
146+
assert_equal(0x440c2f00, crc, "Graphics, CRC")
147+
end
148+
104149
-- Math.
105150
function test_math()
106151
assert_equal(abs(5.000), 5.00, "abs(5.000)")
@@ -293,7 +338,6 @@ function test_operators()
293338
end
294339

295340
-- P8SCII
296-
297341
function test_p8scii()
298342
cls(1)
299343
for i = 16, 255 do
@@ -373,6 +417,7 @@ function run_tests()
373417
test_relational_operations()
374418
test_logical_operations()
375419
test_control_flow()
420+
test_graphics()
376421
test_math()
377422
test_memory()
378423
test_operators()

0 commit comments

Comments
 (0)