Added a test for MUIA_Listview_SelectChange.
[AROS.git] / rom / filesys / pfs3 / fs / assroutines_unittest.c
blob4f7ae22e9a6a11bf1d70c4c55443dbe86f1b9b31
1 ;/*
2 phxass I=Watti:NDK_3.9/Include/include_i/ assroutines.asm
3 sc resopt parms=r assroutines_unittest.c
4 sc resopt link assroutines_unittest.o assroutines.o to assroutines_unittest
5 gcc -noixemul -O2 -o assroutines.o -c assroutines.c
6 gcc -noixemul -O2 -o assroutines_unittest.o -c assroutines_unittest.c
7 gcc -noixemul assroutines_unittest.o assroutines.o -o assroutines_unittest_c
8 quit
9 */
11 #include <exec/types.h>
12 #include "ass_protos.h"
14 #include <stdio.h>
15 #include <string.h>
17 int main(void)
19 struct
21 ULONG a;
22 UWORD b;
23 ULONG r;
24 } div[] =
26 {0,1,0x00000000},
27 {1,1,0x00000001},
28 {1,2,0x00010000},
29 {1,3,0x00010000},
30 {1,4,0x00010000},
31 {1,1000,0x00010000},
32 {1,6000,0x00010000},
33 {10000,666,0x000a000f},
34 {80000,666,0x01de0015},
35 {80000,1,0x00003880},
37 const div_numof = sizeof(div) / sizeof(div[0]);
38 int i;
39 UBYTE tmp[256], *p;
40 UBYTE t2[64];
42 printf("\ndivide:\n");
44 for (i = 0; i< div_numof; i++)
46 printf("%d / %d = 0x%08x\n", div[i].a, div[i].b, divide(div[i].a, div[i].b));
47 if (divide(div[i].a, div[i].b) != div[i].r)
49 printf("failed!\n");
50 return 5;
54 printf("\nctodstr:\n");
55 ctodstr("", tmp);
56 if (tmp[0] != 0 || memcmp(tmp+1, "", 1)) { printf("failed \"\"!\n"); return 5; }
57 ctodstr("foobar", tmp);
58 if (tmp[0] != 6 || memcmp(tmp+1, "foobar", 6)) { printf("failed \"foobar\"!\n"); return 5; }
60 printf("\nstcu_d:\n");
61 stcu_d(tmp, 0);
62 if (strcmp(tmp, "0")) { printf("failed 0\n"); return 5; }
63 stcu_d(tmp, 123456);
64 if (strcmp(tmp, "123456")) { printf("failed 123456\n"); return 5; }
65 stcu_d(tmp, 10000000);
66 if (strcmp(tmp, "10000000")) { printf("failed 10000000\n"); return 5; }
68 printf("\nstpcpy:\n");
69 p = stpcpy(tmp, "");
70 if (p != tmp || strcmp(tmp, "")) { printf("failed \"\"\n"); return 5; }
71 p = stpcpy(tmp, "foobar");
72 if (p != tmp + 6 || strcmp(tmp, "foobar")) { printf("failed \"foobar\"\n"); return 5; }
74 printf("\nintltoupper:\n");
76 ctodstr("", tmp);
77 intltoupper(tmp);
78 if (tmp[0] != 0) { printf("failed \"\"\n"); return 5; }
79 ctodstr("fooBaröäåßð!@£", tmp);
80 intltoupper(tmp);
81 if (tmp[0] != 14 || memcmp(tmp + 1, "FOOBARÖÄÅßÐ!@£", 14)) { printf("failed \"fooBaröäåßð!@£\"\n"); return 5; }
83 printf("\nintlcmp:\n");
84 ctodstr("foo", tmp);
85 intltoupper(tmp);
86 if (intlcmp(tmp, tmp) != 1) { printf("failed \"foo\" selfcompare\n"); return 5; }
87 ctodstr("foo", tmp);
88 intltoupper(tmp);
89 ctodstr("foo", t2);
90 if (intlcmp(tmp, t2) != 1) { printf("failed \"FOO\" vs \"foo\"\n"); return 5; }
91 ctodstr("fooBaröäåßð!@£", tmp);
92 intltoupper(tmp);
93 if (intlcmp(tmp, tmp) != 1) { printf("failed \"fooBaröäåßð!@£\" selfcompare\n"); return 5; }
94 ctodstr("fooBar", t2);
95 intltoupper(t2);
96 if (intlcmp(tmp, t2) != 0) { printf("failed \"fooBaröäåßð!@£\" vs \"fooBar\"\n"); return 5; }
97 ctodstr("fooBaröäåßð!@£xxx", t2);
98 intltoupper(t2);
99 if (intlcmp(tmp, t2) != 0) { printf("failed \"fooBaröäåßð!@£\" vs \"fooBaröäåßð!@£xxx\"\n"); return 5; }
100 ctodstr("fooBaxöäåßð!@£", t2);
101 if (intlcmp(tmp, t2) != 0) { printf("failed \"fooBaröäåßð!@£\" vs \"fooBaxöäåßð!@£\"\n"); return 5; }
102 ctodstr("fooBar", t2);
103 if (intlcmp(tmp, t2) != 0) { printf("failed \"fooBaröäåßð!@£\" vs \"fooBar\"\n"); return 5; }
104 ctodstr("fooBaröäåßð!@£xxx", t2);
105 if (intlcmp(tmp, t2) != 0) { printf("failed \"fooBaröäåßð!@£\" vs \"fooBaröäåßð!@£xxx\"\n"); return 5; }
106 ctodstr("fooBaxöäåßð!@£", t2);
107 if (intlcmp(tmp, t2) != 0) { printf("failed \"fooBaröäåßð!@£\" vs \"fooBaxöäåßð!@£\"\n"); return 5; }
109 printf("\nintlcdcmp:\n");
110 ctodstr("", tmp);
111 intltoupper(tmp);
112 if (intlcdcmp("", tmp) != 1) { printf("failed \"\"\n"); return 5; }
113 ctodstr("A", tmp);
114 if (intlcdcmp("A", tmp) != 1) { printf("failed \"A\" vs \"A\"\n"); return 5; }
115 ctodstr("a", tmp);
116 if (intlcdcmp("A", tmp) != 1) { printf("failed \"A\" vs \"a\"\n"); return 5; }
117 ctodstr("abcDEF", tmp);
118 if (intlcdcmp("ABCDEF", tmp) != 1) { printf("failed \"ABCDEF\" vs \"abcDEF\"\n"); return 5; }
119 ctodstr("fooBaröäåßð!@£", tmp);
120 if (intlcdcmp("FOOBARÖÄÅßÐ!@£", tmp) != 1) { printf("failed \"FOOBARÖÄÅßÐ!@£\" vs \"fooBaröäåßð!@£\"n"); return 5; }
121 ctodstr("fooBaröäåßð!@£", tmp);
122 if (intlcdcmp("FOOBARÖÄÅßÐ!@£", tmp) != 1) { printf("failed \"FOOBARÖÄÅßÐ!@£\" vs \"fooBaröäåßð!@£\"\n"); return 5; }
123 ctodstr("fooBaröäåßð!@£", tmp);
124 if (intlcdcmp("FOOBAXÖÄÅßÐ!@£", tmp) != 0) { printf("failed \"FOOBAXÖÄÅßÐ!@£\" vs \"fooBaröäåßð!@£\"\n"); return 5; }
125 ctodstr("fooBaröäåßð!@£", tmp);
126 if (intlcdcmp("FOOBAR", tmp) != 0) { printf("failed \"FOOBAR\" vs \"fooBaröäåßð!@£\"\n"); return 5; }
127 ctodstr("fooBaröäåßð!@£", tmp);
128 if (intlcdcmp("FOOBARÖÄÅßÐ!@£XXX", tmp) != 0) { printf("failed \"FOOBARÖÄÅßÐ!@£XXX\" vs \"fooBaröäåßð!@£\"\n"); return 5; }
130 return 0;
134 void EntryPoint(void)