コード例 #1
0
ファイル: test-dns-domain.c プロジェクト: nmartensen/systemd
static void test_dns_name_apply_idna_one(const char *s, const char *result) {
#ifdef HAVE_LIBIDN
        _cleanup_free_ char *buf = NULL;
        assert_se(dns_name_apply_idna(s, &buf) >= 0);
        assert_se(dns_name_equal(buf, result) > 0);
#endif
}
コード例 #2
0
ファイル: test-dns-domain.c プロジェクト: dankor/systemd
static void test_dns_name_apply_idna_one(const char *s, int expected, const char *result) {
        _cleanup_free_ char *buf = NULL;
        int r;

        r = dns_name_apply_idna(s, &buf);
        log_debug("dns_name_apply_idna: \"%s\" → %d/\"%s\" (expected %d/\"%s\")",
                  s, r, strnull(buf), expected, strnull(result));

        /* Different libidn2 versions are more and less accepting
         * of underscore-prefixed names. So let's list the lowest
         * expected return value. */
        assert_se(r >= expected);
        if (expected == 1)
                assert_se(dns_name_equal(buf, result) == 1);
}