]> git.proxmox.com Git - libgit2.git/blobdiff - tests/core/string.c
New upstream version 1.3.0+dfsg.1
[libgit2.git] / tests / core / string.c
index 85db0c6623008a7e92015f511c4b2a7696412bb2..928dfbcc1fcd6dd3183da6933ad45174fc613485 100644 (file)
@@ -123,3 +123,14 @@ void test_core_string__strcasecmp(void)
        cl_assert(git__strcasecmp("et", "e\342\202\254ghi=") < 0);
        cl_assert(git__strcasecmp("\303\215", "\303\255") < 0);
 }
+
+void test_core_string__strlcmp(void)
+{
+       const char foo[3] = { 'f', 'o', 'o' };
+
+       cl_assert(git__strlcmp("foo", "foo", 3) == 0);
+       cl_assert(git__strlcmp("foo", foo, 3) == 0);
+       cl_assert(git__strlcmp("foo", "foobar", 3) == 0);
+       cl_assert(git__strlcmp("foobar", "foo", 3) > 0);
+       cl_assert(git__strlcmp("foo", "foobar", 6) < 0);
+}