summaryrefslogtreecommitdiff
path: root/test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test.c')
-rw-r--r--test.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/test.c b/test.c
index 385c0ec..cf43ecf 100644
--- a/test.c
+++ b/test.c
@@ -1,4 +1,4 @@
-/* Compile with: cc test.c -Irgo/include -Lrgo -lrgo -otest */
+/* cc test.c -Irgo/include -L. -lrgo -otest */
#include <assert.h>
#include <inttypes.h>
@@ -8,6 +8,9 @@
#include <stdio.h>
int main(void) {
+ fprintf(stderr,"rgo test\n");
+ fprintf(stderr,"arch: %s\n",sus_archstr);
+ fprintf(stderr,"fast: %s\n",rgo_fastimpl() ? "yes" : "no");
fprintf(stderr,"\n");
{
#undef arrsz
@@ -59,7 +62,7 @@ int main(void) {
assert(arr1[(size_t)0x4] == arr0[(size_t)0x4]);
assert(arr1[(size_t)0x5] == arr0[(size_t)0x5]);
assert(arr1[(size_t)0x6] == arr0[(size_t)0x6]);
- uint8_t const eq = rgo_memeq(arr1,arrsz,arr0);
+ sus_typ_u8 const eq = rgo_memeq(arr1,arrsz,arr0);
fprintf(stderr,"eq: %u\n",eq);
assert(eq);
#undef arrsz
@@ -79,7 +82,7 @@ int main(void) {
size_t len = rgo_strlen(str);
fprintf(stderr,"len: %zX\n",len);
size_t pos0 = rgo_fndchr(str,' ');
- size_t pos1 = rgo_fndbyte(str,len,(uint8_t)' ');
+ size_t pos1 = rgo_fndbyte(str,len,(sus_typ_u8)' ');
fprintf(stderr,"pos0: %zX\n",pos0);
fprintf(stderr,"pos1: %zX\n",pos1);
assert(pos0 == (size_t)0x2);
@@ -87,7 +90,7 @@ int main(void) {
str += pos0 + (size_t)0x1;
len = rgo_strlen(str);
pos0 = rgo_fndchr(str,' ');
- pos1 = rgo_fndbyte(str,len,(uint8_t)' ');
+ pos1 = rgo_fndbyte(str,len,(sus_typ_u8)' ');
fprintf(stderr,"pos0: %zX\n",pos0);
fprintf(stderr,"pos1: %zX\n",pos1);
assert(pos0 == (size_t)0x2);
@@ -95,14 +98,13 @@ int main(void) {
str += pos0 + (size_t)0x1;
len = rgo_strlen(str);
pos0 = rgo_fndchr(str,' ');
- pos1 = rgo_fndbyte(str,len,(uint8_t)' ');
+ pos1 = rgo_fndbyte(str,len,(sus_typ_u8)' ');
fprintf(stderr,"pos0: %zX\n",pos0);
fprintf(stderr,"pos1: %zX\n",pos1);
assert(pos0 == (size_t)-0x1);
assert(pos1 == pos0);
}
fprintf(stderr,"\n");
-#if defined(__x86_64__)
{
char const str0[] = "What's up, my guy?";
fprintf(stderr,"str0: \"%s\"\n",str0);
@@ -110,9 +112,9 @@ int main(void) {
fprintf(stderr,"str1: \"%s\"\n",str1);
char const str2[] = "I don't know you!";
fprintf(stderr,"str2: \"%s\"\n",str2);
- uint8_t const cmp0 = rgo_streq(str0,str1);
- uint8_t const cmp1 = rgo_streq(str0,str2);
- uint8_t const cmp2 = rgo_streq(str1,str2);
+ sus_typ_u8 const cmp0 = rgo_streq(str0,str1);
+ sus_typ_u8 const cmp1 = rgo_streq(str0,str2);
+ sus_typ_u8 const cmp2 = rgo_streq(str1,str2);
fprintf(stderr,"cmp0: %u\n",cmp0);
fprintf(stderr,"cmp1: %u\n",cmp1);
fprintf(stderr,"cmp2: %u\n",cmp2);
@@ -122,14 +124,13 @@ int main(void) {
}
fprintf(stderr,"\n");
{
- char const str0[] = "What in the world?";
+ char const str0[] = "What in the world are you doing?";
fprintf(stderr,"str0: \"%s\"\n",str0);
- char const str1[sizeof (str0)];
- assert(rgo_strcpy(str0,str1) == (size_t)0x12);
+ char str1[sizeof (str0)];
+ assert(rgo_strcpy(str0,str1) == (size_t)0x20);
fprintf(stderr,"str1: \"%s\"\n",str1);
assert(rgo_streq(str0,str1));
}
fprintf(stderr,"\n");
-#endif
printf("All tests have passed!\n");
}