MCPcopy Create free account
hub / github.com/buke/quickjs-go / check_flags

Function check_flags

deps/quickjs/unicode_gen.c:1912–1965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1910
1911
1912void check_flags(void)
1913{
1914 int c;
1915 bool flag_ref, flag;
1916 for(c = 0; c <= CHARCODE_MAX; c++) {
1917 flag_ref = get_prop(c, PROP_Cased);
1918 flag = lre_is_cased(c);
1919 if (flag != flag_ref) {
1920 printf("ERROR: c=%05x cased=%d ref=%d\n",
1921 c, flag, flag_ref);
1922 exit(1);
1923 }
1924
1925 flag_ref = get_prop(c, PROP_Case_Ignorable);
1926 flag = lre_is_case_ignorable(c);
1927 if (flag != flag_ref) {
1928 printf("ERROR: c=%05x case_ignorable=%d ref=%d\n",
1929 c, flag, flag_ref);
1930 exit(1);
1931 }
1932
1933 flag_ref = get_prop(c, PROP_ID_Start);
1934 flag = lre_is_id_start(c);
1935 if (flag != flag_ref) {
1936 printf("ERROR: c=%05x id_start=%d ref=%d\n",
1937 c, flag, flag_ref);
1938 exit(1);
1939 }
1940
1941 flag_ref = get_prop(c, PROP_ID_Continue);
1942 flag = lre_is_id_continue(c);
1943 if (flag != flag_ref) {
1944 printf("ERROR: c=%05x id_cont=%d ref=%d\n",
1945 c, flag, flag_ref);
1946 exit(1);
1947 }
1948 }
1949#ifdef PROFILE
1950 {
1951 int64_t ti, count;
1952 ti = get_time_ns();
1953 count = 0;
1954 for(c = 0x20; c <= 0xffff; c++) {
1955 flag_ref = get_prop(c, PROP_ID_Start);
1956 flag = lre_is_id_start(c);
1957 assert(flag == flag_ref);
1958 count++;
1959 }
1960 ti = get_time_ns() - ti;
1961 printf("flags time=%0.1f ns/char\n",
1962 (double)ti / count);
1963 }
1964#endif
1965}
1966
1967#endif
1968

Callers 1

mainFunction · 0.85

Calls 8

get_propFunction · 0.85
lre_is_casedFunction · 0.85
exitFunction · 0.85
lre_is_case_ignorableFunction · 0.85
lre_is_id_startFunction · 0.85
lre_is_id_continueFunction · 0.85
get_time_nsFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected