Compare commits

..

No commits in common. "1f5f6a5e3b5b43fa3809bde7cc40ac5c227cfe45" and "27a18a608cfd68a677a570129f7b64e8bcadf512" have entirely different histories.

5 changed files with 1 additions and 48 deletions

View File

@ -279,14 +279,7 @@ void sched_common_exit(Context* context, int64_t status)
return true; return true;
}); });
} }
else else { reboot(); }
{
#ifndef RUN_TEST_AS_INIT
reboot();
#else
hang();
#endif
}
Scheduler::task_yield(context); Scheduler::task_yield(context);
} }

View File

@ -48,9 +48,6 @@ extern "C"
/* Concatenates at most max bytes of the string src into dest. */ /* Concatenates at most max bytes of the string src into dest. */
char* strncat(char* dest, const char* src, size_t max); char* strncat(char* dest, const char* src, size_t max);
/* Returns the length of the initial segment of str which consists entirely of bytes not in reject. */
size_t strcspn(const char* str, const char* reject);
/* Compares strings a and b. You might prefer to use the safer strncmp function. */ /* Compares strings a and b. You might prefer to use the safer strncmp function. */
int strcmp(const char* a, const char* b); int strcmp(const char* a, const char* b);

View File

@ -119,22 +119,6 @@ extern "C"
return *(const unsigned char*)a - *(const unsigned char*)b; return *(const unsigned char*)a - *(const unsigned char*)b;
} }
size_t strcspn(const char* str, const char* reject)
{
const char* s = str;
while (*s)
{
const char* rp = reject;
while (*rp)
{
if (*s == *rp) return s - str;
rp++;
}
s++;
}
return s - str;
}
char* strcat(char* dest, const char* src) char* strcat(char* dest, const char* src)
{ {
size_t dest_len = strlen(dest); size_t dest_len = strlen(dest);

View File

@ -2,12 +2,10 @@
DEFINE_TEST(strlen); DEFINE_TEST(strlen);
DEFINE_TEST(strnlen); DEFINE_TEST(strnlen);
DEFINE_TEST(strcspn);
int main() int main()
{ {
START_TEST_CASE(string.h); START_TEST_CASE(string.h);
RUN_TEST(strlen); RUN_TEST(strlen);
RUN_TEST(strnlen); RUN_TEST(strnlen);
RUN_TEST(strcspn);
} }

View File

@ -40,24 +40,5 @@ DEFINE_TEST(strnlen)
EXPECT_EQ(len, sizeof(buf)); EXPECT_EQ(len, sizeof(buf));
TEST_SUCCESS();
}
DEFINE_TEST(strcspn)
{
START_TEST(strcspn);
const char* str = "This string has vowels";
const char* vowels = "aeiou";
size_t len = strcspn(str, vowels);
EXPECT_EQ(len, 2);
str = "WWWWW";
len = strcspn(str, vowels);
EXPECT_EQ(len, 5);
TEST_SUCCESS(); TEST_SUCCESS();
} }