76 static const char *tab[] = {
81 "abcåäö ,
"ABCÅÄÖ",
};
static const int n = sizeof(tab) / sizeof(tab[0]);
int i, j;
int sign_str, sign_oct;
Octstr *os1, *os2;
for (i = 0; i < n; ++i) {
os1 = octstr_create(tab[i]);
for (j = 0; j < n; ++j) {
os2 = octstr_create(tab[j]);
sign_str = signof(strcmp(tab[i], tab[j]));
sign_oct = signof(octstr_compare(os1, os2));
if (sign_str != sign_oct)
panic(0, "strcmp (%d) and octstr_compare (%d) differ for "
"`%s' and `%s'", sign_str, sign_oct, tab[i], tab[j]);
sign_str = signof(strcasecmp(tab[i], tab[j]));
sign_oct = signof(octstr_case_compare(os1, os2));
if (sign_str != sign_oct)
panic(0, "strcasecmp (%d) and octstr_case_compare (%d) "
"differ for `%s' and `%s'", sign_str, sign_oct,
tab[i], tab[j]);
octstr_destroy(os2);
}
octstr_destroy(os1);
}
}
int main(void)
{
gwlib_init();
log_set_output_level(GW_INFO);
check_comparisons();
gwlib_shutdown();
return 0;
}
",
82 "ABCÅÄÖ ,
};
static const int n = sizeof(tab) / sizeof(tab[0]);
int i, j;
int sign_str, sign_oct;
Octstr *os1, *os2;
for (i = 0; i < n; ++i) {
os1 = octstr_create(tab[i]);
for (j = 0; j < n; ++j) {
os2 = octstr_create(tab[j]);
sign_str = signof(strcmp(tab[i], tab[j]));
sign_oct = signof(octstr_compare(os1, os2));
if (sign_str != sign_oct)
panic(0, "strcmp (%d) and octstr_compare (%d) differ for "
"`%s' and `%s'", sign_str, sign_oct, tab[i], tab[j]);
sign_str = signof(strcasecmp(tab[i], tab[j]));
sign_oct = signof(octstr_case_compare(os1, os2));
if (sign_str != sign_oct)
panic(0, "strcasecmp (%d) and octstr_case_compare (%d) "
"differ for `%s' and `%s'", sign_str, sign_oct,
tab[i], tab[j]);
octstr_destroy(os2);
}
octstr_destroy(os1);
}
}
int main(void)
{
gwlib_init();
log_set_output_level(GW_INFO);
check_comparisons();
gwlib_shutdown();
return 0;
}
",
84 static const int n =
sizeof(tab) /
sizeof(tab[0]);
86 int sign_str, sign_oct;
89 for (i = 0; i < n; ++i) {
91 for (j = 0; j < n; ++j) {
94 sign_str =
signof(strcmp(tab[i], tab[j]));
96 if (sign_str != sign_oct)
97 panic(0,
"strcmp (%d) and octstr_compare (%d) differ for " 98 "`%s' and `%s'", sign_str, sign_oct, tab[i], tab[j]);
100 sign_str =
signof(strcasecmp(tab[i], tab[j]));
102 if (sign_str != sign_oct)
103 panic(0,
"strcasecmp (%d) and octstr_case_compare (%d) " 104 "differ for `%s' and `%s'", sign_str, sign_oct,
void log_set_output_level(enum output_level level)
int octstr_case_compare(const Octstr *os1, const Octstr *os2)
void octstr_destroy(Octstr *ostr)
#define octstr_create(cstr)
void gwlib_shutdown(void)
static void check_comparisons(void)
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)