Tests actually work now (they need SDL to compile)
[umd.git] / tests / move.c
blobc84f02f05f8e20efa04246396f6c6b3377e6f353
1 #include "umd.h"
2 #include <stdio.h>
3 #include <math.h>
4 #include <unistd.h>
5 #include "util.h"
7 int main(int argc, char **argv)
9 int x, y, button;
11 int status = VideoInit();
13 if (status != 0)
14 return status;
16 if (UMD_Init() < 0) {
17 fprintf(stderr, "%s\n", UMD_GetError());
18 return 1;
21 if (UMD_Warp(100, 100) < 0) {
22 fprintf(stderr, "%s\n", UMD_GetError());
23 return 3;
26 sleep(1);
28 if (UMD_Move(-25, 50) < 0) {
29 fprintf(stderr, "%s\n", UMD_GetError());
30 return 4;
33 CollectInput(&x, &y, &button);
35 if (UMD_Quit() < 0) {
36 fprintf(stderr, "%s\n", UMD_GetError());
37 return 2;
40 VideoQuit();
42 if (x != 75 || y != 150) {
43 fprintf(stderr, "Got\t%d\t%d\n", x, y);
44 fprintf(stderr, "Expected\t75\t150\n");
45 fprintf(stderr, "Test failed\n");
46 return 5;
49 printf("Test successful!\n");
51 return 0;