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
11 #include <exec/types.h>
12 #include "ass_protos.h"
33 {10000,666,0x000a000f},
34 {80000,666,0x01de0015},
37 const div_numof
= sizeof(div
) / sizeof(div
[0]);
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
)
54 printf("\nctodstr:\n");
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");
62 if (strcmp(tmp
, "0")) { printf("failed 0\n"); return 5; }
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");
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");
78 if (tmp
[0] != 0) { printf("failed \"\"\n"); return 5; }
79 ctodstr("fooBaröäåßð!@£", tmp
);
81 if (tmp
[0] != 14 || memcmp(tmp
+ 1, "FOOBARÖÄÅßÐ!@£", 14)) { printf("failed \"fooBaröäåßð!@£\"\n"); return 5; }
83 printf("\nintlcmp:\n");
86 if (intlcmp(tmp
, tmp
) != 1) { printf("failed \"foo\" selfcompare\n"); return 5; }
90 if (intlcmp(tmp
, t2
) != 1) { printf("failed \"FOO\" vs \"foo\"\n"); return 5; }
91 ctodstr("fooBaröäåßð!@£", tmp
);
93 if (intlcmp(tmp
, tmp
) != 1) { printf("failed \"fooBaröäåßð!@£\" selfcompare\n"); return 5; }
94 ctodstr("fooBar", t2
);
96 if (intlcmp(tmp
, t2
) != 0) { printf("failed \"fooBaröäåßð!@£\" vs \"fooBar\"\n"); return 5; }
97 ctodstr("fooBaröäåßð!@£xxx", 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");
112 if (intlcdcmp("", tmp
) != 1) { printf("failed \"\"\n"); return 5; }
114 if (intlcdcmp("A", tmp
) != 1) { printf("failed \"A\" vs \"A\"\n"); return 5; }
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; }
134 void EntryPoint(void)