wcsrchr.c 445 B

123456789101112131415161718192021222324
  1. #include <assert.h>
  2. #include <wchar.h>
  3. int main() {
  4. wchar_t *s;
  5. assert(wcsrchr(L"", L'a') == NULL);
  6. s = L"a";
  7. assert(wcsrchr(s, L'a') == s);
  8. s = L"aa";
  9. assert(wcsrchr(s, L'a') == s + 1);
  10. s = L"aab";
  11. assert(wcsrchr(s, L'a') == s + 1);
  12. s = L"abcdef!\"£$%^e&*";
  13. assert(wcsrchr(s, L'g') == NULL);
  14. assert(wcsrchr(s, L'\"') == s + 7);
  15. assert(wcsrchr(s, L'e') == s + 12);
  16. return 0;
  17. }