Blame tests/core/hex.c

Packit ae9e2a
#include "clar_libgit2.h"
Packit ae9e2a
#include "util.h"
Packit ae9e2a
Packit ae9e2a
void test_core_hex__fromhex(void)
Packit ae9e2a
{
Packit ae9e2a
	/* Passing cases */
Packit ae9e2a
	cl_assert(git__fromhex('0') == 0x0);
Packit ae9e2a
	cl_assert(git__fromhex('1') == 0x1);
Packit ae9e2a
	cl_assert(git__fromhex('3') == 0x3);
Packit ae9e2a
	cl_assert(git__fromhex('9') == 0x9);
Packit ae9e2a
	cl_assert(git__fromhex('A') == 0xa);
Packit ae9e2a
	cl_assert(git__fromhex('C') == 0xc);
Packit ae9e2a
	cl_assert(git__fromhex('F') == 0xf);
Packit ae9e2a
	cl_assert(git__fromhex('a') == 0xa);
Packit ae9e2a
	cl_assert(git__fromhex('c') == 0xc);
Packit ae9e2a
	cl_assert(git__fromhex('f') == 0xf);
Packit ae9e2a
Packit ae9e2a
	/* Failing cases */
Packit ae9e2a
	cl_assert(git__fromhex('g') == -1);
Packit ae9e2a
	cl_assert(git__fromhex('z') == -1);
Packit ae9e2a
	cl_assert(git__fromhex('X') == -1);
Packit ae9e2a
}