Blame tests/core/hex.c

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