MCPcopy Create free account
hub / github.com/git/git / check_strcmp_offset

Function check_strcmp_offset

t/unit-tests/u-strcmp-offset.c:4–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include "read-cache-ll.h"
3
4static void check_strcmp_offset(const char *string1, const char *string2,
5 int expect_result, uintmax_t expect_offset)
6{
7 size_t offset;
8 int result = strcmp_offset(string1, string2, &offset);
9
10 /*
11 * Because different CRTs behave differently, only rely on signs of the
12 * result values.
13 */
14 result = (result < 0 ? -1 :
15 result > 0 ? 1 :
16 0);
17
18 cl_assert_equal_i(result, expect_result);
19 cl_assert_equal_i((uintmax_t)offset, expect_offset);
20}
21
22void test_strcmp_offset__empty(void)
23{

Calls 1

strcmp_offsetFunction · 0.85