2020-08-18 05:56:24 +03:00
|
|
|
|
#include "test.h"
|
|
|
|
|
|
2020-09-27 13:46:47 +03:00
|
|
|
|
#define STR(x) #x
|
|
|
|
|
|
2020-07-07 08:04:36 +03:00
|
|
|
|
typedef unsigned short char16_t;
|
2020-07-07 08:04:36 +03:00
|
|
|
|
typedef unsigned int char32_t;
|
|
|
|
|
typedef int wchar_t;
|
2020-07-07 08:04:36 +03:00
|
|
|
|
|
2020-05-04 10:53:48 +03:00
|
|
|
|
int π = 3;
|
|
|
|
|
|
2020-08-18 05:56:24 +03:00
|
|
|
|
int main() {
|
|
|
|
|
ASSERT(4, sizeof(L'\0'));
|
|
|
|
|
ASSERT(97, L'a');
|
|
|
|
|
|
|
|
|
|
ASSERT(0, strcmp("αβγ", "\u03B1\u03B2\u03B3"));
|
|
|
|
|
ASSERT(0, strcmp("日本語", "\u65E5\u672C\u8A9E"));
|
|
|
|
|
ASSERT(0, strcmp("日本語", "\U000065E5\U0000672C\U00008A9E"));
|
|
|
|
|
ASSERT(0, strcmp("🌮", "\U0001F32E"));
|
|
|
|
|
|
2020-05-06 12:47:42 +03:00
|
|
|
|
ASSERT(-1, L'\xffffffff'>>31);
|
|
|
|
|
ASSERT(946, L'β');
|
|
|
|
|
ASSERT(12354, L'あ');
|
|
|
|
|
ASSERT(127843, L'🍣');
|
|
|
|
|
|
2020-09-27 13:46:47 +03:00
|
|
|
|
ASSERT(2, sizeof(u'\0'));
|
|
|
|
|
ASSERT(1, u'\xffff'>>15);
|
|
|
|
|
ASSERT(97, u'a');
|
|
|
|
|
ASSERT(946, u'β');
|
|
|
|
|
ASSERT(12354, u'あ');
|
|
|
|
|
ASSERT(62307, u'🍣');
|
|
|
|
|
|
|
|
|
|
ASSERT(0, strcmp(STR(u'a'), "u'a'"));
|
|
|
|
|
|
2020-07-06 12:59:25 +03:00
|
|
|
|
ASSERT(4, sizeof(U'\0'));
|
|
|
|
|
ASSERT(1, U'\xffffffff'>>31);
|
|
|
|
|
ASSERT(97, U'a');
|
|
|
|
|
ASSERT(946, U'β');
|
|
|
|
|
ASSERT(12354, U'あ');
|
|
|
|
|
ASSERT(127843, U'🍣');
|
|
|
|
|
|
|
|
|
|
ASSERT(0, strcmp(STR(U'a'), "U'a'"));
|
|
|
|
|
|
2020-09-27 13:47:36 +03:00
|
|
|
|
ASSERT(4, sizeof(u8"abc"));
|
|
|
|
|
ASSERT(0, strcmp(u8"abc", "abc"));
|
|
|
|
|
|
|
|
|
|
ASSERT(0, strcmp(STR(u8"a"), "u8\"a\""));
|
|
|
|
|
|
2020-09-26 13:56:56 +03:00
|
|
|
|
ASSERT(2, sizeof(u""));
|
|
|
|
|
ASSERT(10, sizeof(u"\xffzzz"));
|
|
|
|
|
ASSERT(0, memcmp(u"", "\0\0", 2));
|
|
|
|
|
ASSERT(0, memcmp(u"abc", "a\0b\0c\0\0\0", 8));
|
|
|
|
|
ASSERT(0, memcmp(u"日本語", "\345e,g\236\212\0\0", 8));
|
|
|
|
|
ASSERT(0, memcmp(u"🍣", "<\330c\337\0\0", 6));
|
|
|
|
|
ASSERT(u'β', u"βb"[0]);
|
|
|
|
|
ASSERT(u'b', u"βb"[1]);
|
|
|
|
|
ASSERT(0, u"βb"[2]);
|
|
|
|
|
|
|
|
|
|
ASSERT(0, strcmp(STR(u"a"), "u\"a\""));
|
|
|
|
|
|
2020-09-26 13:57:36 +03:00
|
|
|
|
ASSERT(4, sizeof(U""));
|
|
|
|
|
ASSERT(20, sizeof(U"\xffzzz"));
|
|
|
|
|
ASSERT(0, memcmp(U"", "\0\0\0\0", 4));
|
|
|
|
|
ASSERT(0, memcmp(U"abc", "a\0\0\0b\0\0\0c\0\0\0\0\0\0\0", 16));
|
|
|
|
|
ASSERT(0, memcmp(U"日本語", "\345e\0\0,g\0\0\236\212\0\0\0\0\0\0", 16));
|
|
|
|
|
ASSERT(0, memcmp(U"🍣", "c\363\001\0\0\0\0\0", 8));
|
|
|
|
|
ASSERT(u'β', U"βb"[0]);
|
|
|
|
|
ASSERT(u'b', U"βb"[1]);
|
|
|
|
|
ASSERT(0, U"βb"[2]);
|
|
|
|
|
ASSERT(1, U"\xffffffff"[0] >> 31);
|
|
|
|
|
|
|
|
|
|
ASSERT(0, strcmp(STR(U"a"), "U\"a\""));
|
|
|
|
|
|
2020-07-05 14:49:58 +03:00
|
|
|
|
ASSERT(4, sizeof(L""));
|
|
|
|
|
ASSERT(20, sizeof(L"\xffzzz"));
|
|
|
|
|
ASSERT(0, memcmp(L"", "\0\0\0\0", 4));
|
|
|
|
|
ASSERT(0, memcmp(L"abc", "a\0\0\0b\0\0\0c\0\0\0\0\0\0\0", 16));
|
|
|
|
|
ASSERT(0, memcmp(L"日本語", "\345e\0\0,g\0\0\236\212\0\0\0\0\0\0", 16));
|
|
|
|
|
ASSERT(0, memcmp(L"🍣", "c\363\001\0\0\0\0\0", 8));
|
|
|
|
|
ASSERT(u'β', L"βb"[0]);
|
|
|
|
|
ASSERT(u'b', L"βb"[1]);
|
|
|
|
|
ASSERT(0, L"βb"[2]);
|
|
|
|
|
ASSERT(-1, L"\xffffffff"[0] >> 31);
|
|
|
|
|
|
|
|
|
|
ASSERT(0, strcmp(STR(L"a"), "L\"a\""));
|
|
|
|
|
|
2020-07-07 08:04:36 +03:00
|
|
|
|
ASSERT(u'α', ({ char16_t x[] = u"αβ"; x[0]; }));
|
|
|
|
|
ASSERT(u'β', ({ char16_t x[] = u"αβ"; x[1]; }));
|
|
|
|
|
ASSERT(6, ({ char16_t x[] = u"αβ"; sizeof(x); }));
|
|
|
|
|
|
2020-07-07 08:04:36 +03:00
|
|
|
|
ASSERT(U'🤔', ({ char32_t x[] = U"🤔x"; x[0]; }));
|
|
|
|
|
ASSERT(U'x', ({ char32_t x[] = U"🤔x"; x[1]; }));
|
|
|
|
|
ASSERT(12, ({ char32_t x[] = U"🤔x"; sizeof(x); }));
|
|
|
|
|
|
|
|
|
|
ASSERT(L'🤔', ({ wchar_t x[] = L"🤔x"; x[0]; }));
|
|
|
|
|
ASSERT(L'x', ({ wchar_t x[] = L"🤔x"; x[1]; }));
|
|
|
|
|
ASSERT(12, ({ wchar_t x[] = L"🤔x"; sizeof(x); }));
|
|
|
|
|
|
2020-05-04 10:53:48 +03:00
|
|
|
|
ASSERT(3, π);
|
|
|
|
|
ASSERT(3, ({ int あβ0¾=3; あβ0¾; }));
|
2020-07-19 14:28:46 +03:00
|
|
|
|
ASSERT(5, ({ int $$$=5; $$$; }));
|
2020-05-04 10:53:48 +03:00
|
|
|
|
|
2020-08-18 05:56:24 +03:00
|
|
|
|
printf("OK\n");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|