Cleaned up testing files

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2025-08-09 04:45:40 +0200
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2025-08-09 04:45:40 +0200
Commit 091e1e639bb09568375c5b77a60b333d2f506c38 (patch)
-rw-r--r-- .vimrc 2
-rw-r--r-- tests/test.lua 0
-rw-r--r-- tests/json.lua 10
3 files changed, 17 insertions, 11 deletions
diff --git a/.vimrc b/.vimrc
...
2
set errorformat=%f:%l:%c:\ %m
2
set errorformat=%f:%l:%c:\ %m
3
  
3
  
4
let g:gdb_executable = 'bidi'
4
let g:gdb_executable = 'bidi'
5
let g:gdb_arguments = '-f tests/graphics.lua'
5
let g:gdb_arguments = '-f tests/test.lua'
6
  
6
  
7
nnoremap <leader>m :call LocalMake()<CR>
7
nnoremap <leader>m :call LocalMake()<CR>
8
nnoremap <leader>r :execute '!./' . g:gdb_executable . ' ' . g:gdb_arguments<CR>
8
nnoremap <leader>r :execute '!./' . g:gdb_executable . ' ' . g:gdb_arguments<CR>
...
diff --git a/tests/test.lua b/tests/test.lua
...
32
    return color[randomKey]  -- Return the corresponding color
32
    return color[randomKey]  -- Return the corresponding color
33
end
33
end
34
  
34
  
  
35
function test_json()
  
36
	local file = io.open("tests/test.json", "r")
  
37
	local content = file:read("*a")
  
38
	file:close()
  
39
  
  
40
	local data = json.decode(content)
  
41
  
  
42
	print("name: " .. data.name)
  
43
	for _, n in pairs(data.numbers) do
  
44
		print(" - number: " .. n)
  
45
	end
  
46
end
  
47
  
35
function test_buttons()
48
function test_buttons()
36
	-- Testing button presses.
49
	-- Testing button presses.
37
	if button_down(button.PAD_UP) then
50
	if button_down(button.PAD_UP) then
...
110
	-- Using camera
123
	-- Using camera
111
	move_camera(test_camera_position.x, test_camera_position.y)
124
	move_camera(test_camera_position.x, test_camera_position.y)
112
  
125
  
  
126
	draw_rect(100, 100, 300, 200, color.BLUE)
  
127
  
113
	start_camera()
128
	start_camera()
114
	draw_rect(0, 0, 300, 200, color.YELLOW)
129
	draw_rect(0, 0, 300, 200, color.YELLOW)
115
	stop_camera()
130
	stop_camera()
...
121
	start_drawing()
136
	start_drawing()
122
	clear_window(color.BLACK)
137
	clear_window(color.BLACK)
123
  
138
  
  
139
	-- test_json()
124
	-- test_api()
140
	-- test_api()
125
	-- test_buttons()
141
	-- test_buttons()
126
	-- test_camera()
142
	-- test_camera()
...
diff --git a/tests/json.lua b/tests/json.lua
1
local file = io.open("tests/test.json", "r")
  
2
local content = file:read("*a")
  
3
file:close()
  
4
  
  
5
local data = json.decode(content)
  
6
  
  
7
print("name: " .. data.name)
  
8
for _, n in pairs(data.numbers) do
  
9
	print(" - number: " .. n)
  
10
end