summaryrefslogtreecommitdiff
path: root/tests/util/hostname.c
blob: 5d8bfe2ac995fc4da4e5aaa6e1a10d3274bf5e93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
#include "clar_libgit2.h"
#include "net.h"

void test_hostname__matches_cert(void)
{
	cl_assert_equal_b(true, git_net_hostname_matches_cert("www.example.org", "*.example.org"));
	cl_assert_equal_b(true, git_net_hostname_matches_cert("www.foo.example.org", "*.foo.example.org"));
	cl_assert_equal_b(false, git_net_hostname_matches_cert("foo.example.org", "*.foo.example.org"));
	cl_assert_equal_b(false, git_net_hostname_matches_cert("www.example.org", "*.foo.example.org"));
	cl_assert_equal_b(false, git_net_hostname_matches_cert("example.org", "*.example.org"));
	cl_assert_equal_b(false, git_net_hostname_matches_cert("www.foo.example.org", "*.example.org"));
	cl_assert_equal_b(false, git_net_hostname_matches_cert("blah.www.www.example.org", "*.example.org"));
}