-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathtest.c
More file actions
54 lines (41 loc) · 1.37 KB
/
test.c
File metadata and controls
54 lines (41 loc) · 1.37 KB
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
/* test.c
* Simple test program to verify compilation and basic functionality
*/
#include "compat.h"
#include <stdio.h>
int main() {
printf("Testing Puzzle Pits compatibility layer...\n");
// Test basic initialization
if (init_sdl_compat() < 0) {
printf("Failed to initialize SDL compatibility layer\n");
return 1;
}
printf("SDL compatibility layer initialized successfully\n");
// Test some basic functions
printf("Testing basic functions:\n");
// Test timer
uint32_t ticks = get_ticks();
printf("Timer ticks: %u\n", ticks);
// Test mouse
uint16_t mouse_available = initmouse();
printf("Mouse available: %s\n", mouse_available ? "Yes" : "No");
// Test keyboard
printf("Keyboard hit test: %s\n", kbhit() ? "Key pressed" : "No key");
// Test memory functions
void* test_mem = farmalloc(1024);
if (test_mem) {
printf("Memory allocation: Success\n");
farfree(test_mem);
} else {
printf("Memory allocation: Failed\n");
}
// Test port I/O stubs
outp(0x3C8, 0);
uint8_t test_val = inp(0x3C9);
printf("Port I/O test: Read value %d\n", test_val);
// Cleanup
cleanup_sdl_compat();
printf("All tests completed successfully!\n");
printf("Compilation and basic functionality verified.\n");
return 0;
}