python_code
stringlengths
0
1.8M
repo_name
stringclasses
7 values
file_path
stringlengths
5
99
/* * libdivecomputer * * Copyright (C) 2008 Jef Driesen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later versio...
libdc-for-dirk-Subsurface-branch
src/suunto_eon_parser.c
/* * libdivecomputer * * Copyright (C) 2008 Jef Driesen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later versio...
libdc-for-dirk-Subsurface-branch
src/reefnet_sensusultra_parser.c
/* * libdivecomputer * * Copyright (C) 2013 Jef Driesen * Copyright (C) 2014 Anton Lundin * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, o...
libdc-for-dirk-Subsurface-branch
src/hw_ostc3.c
/* * libdivecomputer * * Copyright (C) 2010 Jef Driesen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later versio...
libdc-for-dirk-Subsurface-branch
src/datetime.c
/* * libdivecomputer * * Copyright (C) 2011 Jef Driesen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later versio...
libdc-for-dirk-Subsurface-branch
src/atomics_cobalt.c
#include "clar_libgit2.h" #include "util.h" void test_hex__fromhex(void) { /* Passing cases */ cl_assert(git__fromhex('0') == 0x0); cl_assert(git__fromhex('1') == 0x1); cl_assert(git__fromhex('3') == 0x3); cl_assert(git__fromhex('9') == 0x9); cl_assert(git__fromhex('A') == 0xa); cl_assert(git__fromhex('C') == 0...
libgit2-main
tests/util/hex.c
#include "precompiled.h"
libgit2-main
tests/util/precompiled.c
#include "clar_libgit2.h" #include "fs_path.h" #ifdef GIT_USE_ICONV static git_fs_path_iconv_t ic; static char *nfc = "\xC3\x85\x73\x74\x72\xC3\xB6\x6D"; static char *nfd = "\x41\xCC\x8A\x73\x74\x72\x6F\xCC\x88\x6D"; #endif void test_iconv__initialize(void) { #ifdef GIT_USE_ICONV cl_git_pass(git_fs_path_iconv_init_p...
libgit2-main
tests/util/iconv.c
#include "clar_libgit2.h" #include "wildmatch.h" #define assert_matches(string, pattern, wildmatch, iwildmatch, pathmatch, ipathmatch) \ assert_matches_(string, pattern, wildmatch, iwildmatch, pathmatch, ipathmatch, __FILE__, __func__, __LINE__) static void assert_matches_(const char *string, const char *pattern, ...
libgit2-main
tests/util/wildmatch.c
/** * Some tests for p_ftruncate() to ensure that * properly handles large (2Gb+) files. */ #include "clar_libgit2.h" static const char *filename = "core_ftruncate.txt"; static int fd = -1; void test_ftruncate__initialize(void) { if (!cl_is_env_set("GITTEST_INVASIVE_FS_SIZE")) cl_skip(); cl_must_pass((fd = p...
libgit2-main
tests/util/ftruncate.c
#include "clar_libgit2.h" #include "array.h" static int int_lookup(const void *k, const void *a) { const int *one = (const int *)k; int *two = (int *)a; return *one - *two; } #define expect_pos(k, n, ret) \ key = (k); \ cl_assert_equal_i((ret), \ git_array_search(&p, integers, int_lookup, &key)); \ cl_assert...
libgit2-main
tests/util/array.c
#ifndef _WIN32 # include <arpa/inet.h> # include <sys/socket.h> # include <netinet/in.h> #else # include <ws2tcpip.h> # ifdef _MSC_VER # pragma comment(lib, "ws2_32") # endif #endif #include "clar_libgit2.h" #include "futils.h" #include "posix.h" void test_posix__initialize(void) { #ifdef GIT_WIN32 /* on win32, the...
libgit2-main
tests/util/posix.c
#include "clar_libgit2.h" #include "posix.h" #ifdef GIT_WIN32 # include "win32/reparse.h" #endif void test_link__cleanup(void) { #ifdef GIT_WIN32 RemoveDirectory("lstat_junction"); RemoveDirectory("lstat_dangling"); RemoveDirectory("lstat_dangling_dir"); RemoveDirectory("lstat_dangling_junction"); RemoveDirecto...
libgit2-main
tests/util/link.c
#include "clar_libgit2.h" static void assert_l32_parses(const char *string, int32_t expected, int base) { int32_t i; cl_git_pass(git__strntol32(&i, string, strlen(string), NULL, base)); cl_assert_equal_i(i, expected); } static void assert_l32_fails(const char *string, int base) { int32_t i; cl_git_fail(git__strn...
libgit2-main
tests/util/strtol.c
#include "clar_libgit2.h" void test_init__returns_count(void) { /* libgit2_tests initializes us first, so we have an existing * initialization. */ cl_assert_equal_i(2, git_libgit2_init()); cl_assert_equal_i(3, git_libgit2_init()); cl_assert_equal_i(2, git_libgit2_shutdown()); cl_assert_equal_i(1, git_libgit2...
libgit2-main
tests/util/init.c
#include <stdint.h> #include "clar_libgit2.h" #include "vector.h" /* initial size of 1 would cause writing past array bounds */ void test_vector__0(void) { git_vector x; int i; cl_git_pass(git_vector_init(&x, 1, NULL)); for (i = 0; i < 10; ++i) { git_vector_insert(&x, (void*) 0xabc); } git_vector_free(&x); } ...
libgit2-main
tests/util/vector.c
#include "clar_libgit2.h" #include "futils.h" #define TESTSTR "Have you seen that? Have you seeeen that??" const char *test_string = TESTSTR; const char *test_string_x2 = TESTSTR TESTSTR; #define TESTSTR_4096 REP1024("1234") #define TESTSTR_8192 REP1024("12341234") const char *test_4096 = TESTSTR_4096; const char *te...
libgit2-main
tests/util/gitstr.c
#include "clar_libgit2.h" #include "bitvec.h" #if 0 static void print_bitvec(git_bitvec *bv) { int b; if (!bv->length) { for (b = 63; b >= 0; --b) fprintf(stderr, "%d", (bv->u.bits & (1ul << b)) ? 1 : 0); } else { for (b = bv->length * 8; b >= 0; --b) fprintf(stderr, "%d", (bv->u.ptr[b >> 3] & (b & 0x0ff...
libgit2-main
tests/util/bitvec.c
#include "clar_libgit2.h" #include "filebuf.h" /* make sure git_filebuf_open doesn't delete an existing lock */ void test_filebuf__0(void) { git_filebuf file = GIT_FILEBUF_INIT; int fd; char test[] = "test", testlock[] = "test.lock"; fd = p_creat(testlock, 0744); /* -V536 */ cl_must_pass(fd); cl_must_pass(p_cl...
libgit2-main
tests/util/filebuf.c
#include "clar_libgit2.h" #include "pqueue.h" static int cmp_ints(const void *v1, const void *v2) { int i1 = *(int *)v1, i2 = *(int *)v2; return (i1 < i2) ? -1 : (i1 > i2) ? 1 : 0; } void test_pqueue__items_are_put_in_order(void) { git_pqueue pq; int i, vals[20]; cl_git_pass(git_pqueue_init(&pq, 0, 20, cmp_ints...
libgit2-main
tests/util/pqueue.c
#include "clar_libgit2.h" #include "hash.h" #define FIXTURE_DIR "sha1" #ifdef GIT_SHA1_WIN32 static git_hash_win32_provider_t orig_provider; #endif void test_sha1__initialize(void) { #ifdef GIT_SHA1_WIN32 orig_provider = git_hash_win32_provider(); #endif cl_fixture_sandbox(FIXTURE_DIR); } void test_sha1__cleanup...
libgit2-main
tests/util/sha1.c
#include "clar_libgit2.h" #include "futils.h" #include "posix.h" void test_copy__file(void) { struct stat st = {0}; const char *content = "This is some stuff to copy\n"; cl_git_mkfile("copy_me", content); cl_git_pass(git_futils_cp("copy_me", "copy_me_two", 0664)); cl_git_pass(git_fs_path_lstat("copy_me_two", &...
libgit2-main
tests/util/copy.c
#include "clar_libgit2.h" /* compare prefixes */ void test_string__0(void) { cl_assert(git__prefixcmp("", "") == 0); cl_assert(git__prefixcmp("a", "") == 0); cl_assert(git__prefixcmp("", "a") < 0); cl_assert(git__prefixcmp("a", "b") < 0); cl_assert(git__prefixcmp("b", "a") > 0); cl_assert(git__prefixcmp("ab", "a...
libgit2-main
tests/util/string.c
#include "clar_libgit2.h" #include "utf8.h" void test_utf8__char_length(void) { cl_assert_equal_i(0, git_utf8_char_length("", 0)); cl_assert_equal_i(1, git_utf8_char_length("$", 1)); cl_assert_equal_i(5, git_utf8_char_length("abcde", 5)); cl_assert_equal_i(1, git_utf8_char_length("\xc2\xa2", 2)); cl_assert_equal_...
libgit2-main
tests/util/utf8.c
#include "clar_libgit2.h" #include <locale.h> #include "regexp.h" #if LC_ALL > 0 static const char *old_locales[LC_ALL]; #endif static git_regexp regex; void test_regexp__initialize(void) { #if LC_ALL > 0 memset(&old_locales, 0, sizeof(old_locales)); #endif } void test_regexp__cleanup(void) { git_regexp_dispose...
libgit2-main
tests/util/regexp.c
#ifdef GIT_ASSERT_HARD # undef GIT_ASSERT_HARD #endif #define GIT_ASSERT_HARD 0 #include "clar_libgit2.h" static const char *hello_world = "hello, world"; static const char *fail = "FAIL"; static int dummy_fn(const char *myarg) { GIT_ASSERT_ARG(myarg); GIT_ASSERT_ARG(myarg != hello_world); return 0; } static co...
libgit2-main
tests/util/assert.c
#include "clar_libgit2.h" #define assert_sorted(a, cmp) \ _assert_sorted(a, ARRAY_SIZE(a), sizeof(*a), cmp) struct big_entries { char c[311]; }; static void _assert_sorted(void *els, size_t n, size_t elsize, git__sort_r_cmp cmp) { int8_t *p = els; git__qsort_r(p, n, elsize, cmp, NULL); while (n-- > 1) { cl_a...
libgit2-main
tests/util/qsort.c
#include "clar_libgit2.h" void test_integer__multiply_int64_no_overflow(void) { #if !defined(git__multiply_int64_overflow) int64_t result = 0; cl_assert(!git__multiply_int64_overflow(&result, INT64_C(0x0), INT64_C(0x0))); cl_assert_equal_i(result, INT64_C(0x0)); cl_assert(!git__multiply_int64_overflow(&result, INT...
libgit2-main
tests/util/integer.c
#include "clar_libgit2.h" #include "futils.h" #include "posix.h" static void cleanup_basic_dirs(void *ref) { GIT_UNUSED(ref); git_futils_rmdir_r("d0", NULL, GIT_RMDIR_EMPTY_HIERARCHY); git_futils_rmdir_r("d1", NULL, GIT_RMDIR_EMPTY_HIERARCHY); git_futils_rmdir_r("d2", NULL, GIT_RMDIR_EMPTY_HIERARCHY); git_futils_...
libgit2-main
tests/util/mkdir.c
#include "clar_libgit2.h" #include "futils.h" /* Fixture setup and teardown */ void test_futils__initialize(void) { cl_must_pass(p_mkdir("futils", 0777)); } void test_futils__cleanup(void) { cl_fixture_cleanup("futils"); } void test_futils__writebuffer(void) { git_str out = GIT_STR_INIT, append = GIT_STR_INIT; ...
libgit2-main
tests/util/futils.c
#include "clar_libgit2.h" #include "zstream.h" static const char *data = "This is a test test test of This is a test"; #define INFLATE_EXTRA 2 static void assert_zlib_equal_( const void *expected, size_t e_len, const void *compressed, size_t c_len, const char *msg, const char *file, const char *func, int line) { ...
libgit2-main
tests/util/zstream.c
#include "clar_libgit2.h" #include "futils.h" #include "fs_path.h" static char *path_save; void test_path__initialize(void) { path_save = cl_getenv("PATH"); } void test_path__cleanup(void) { cl_setenv("PATH", path_save); git__free(path_save); path_save = NULL; } static void check_dirname(const char *A, const ch...
libgit2-main
tests/util/path.c
#include "clar_libgit2.h" #include "pool.h" #include "git2/oid.h" void test_pool__0(void) { int i; git_pool p; void *ptr; git_pool_init(&p, 1); for (i = 1; i < 10000; i *= 2) { ptr = git_pool_malloc(&p, i); cl_assert(ptr != NULL); cl_assert(git_pool__ptr_in_pool(&p, ptr)); cl_assert(!git_pool__ptr_in_po...
libgit2-main
tests/util/pool.c
#include "clar_libgit2.h" #include "futils.h" #include "posix.h" void test_stat__initialize(void) { cl_git_pass(git_futils_mkdir("root/d1/d2", 0755, GIT_MKDIR_PATH)); cl_git_mkfile("root/file", "whatever\n"); cl_git_mkfile("root/d1/file", "whatever\n"); } void test_stat__cleanup(void) { git_futils_rmdir_r("root",...
libgit2-main
tests/util/stat.c
#include "clar_libgit2.h" #include "hash.h" #define FIXTURE_DIR "sha1" #ifdef GIT_SHA256_WIN32 static git_hash_win32_provider_t orig_provider; #endif void test_sha256__initialize(void) { #ifdef GIT_SHA256_WIN32 orig_provider = git_hash_win32_provider(); #endif cl_fixture_sandbox(FIXTURE_DIR); } void test_sha256_...
libgit2-main
tests/util/sha256.c
#include "clar_libgit2.h" #include "strmap.h" static git_strmap *g_table; void test_strmap__initialize(void) { cl_git_pass(git_strmap_new(&g_table)); cl_assert(g_table != NULL); } void test_strmap__cleanup(void) { git_strmap_free(g_table); } void test_strmap__0(void) { cl_assert(git_strmap_size(g_table) == 0); ...
libgit2-main
tests/util/strmap.c
#include "clar_libgit2.h" #include "futils.h" static const char *empty_tmp_dir = "test_gitfo_rmdir_recurs_test"; void test_rmdir__initialize(void) { git_str path = GIT_STR_INIT; cl_must_pass(p_mkdir(empty_tmp_dir, 0777)); cl_git_pass(git_str_joinpath(&path, empty_tmp_dir, "/one")); cl_must_pass(p_mkdir(path.ptr...
libgit2-main
tests/util/rmdir.c
#include "clar_libgit2.h" static void assert_found(const char *haystack, const char *needle, size_t expected_pos) { cl_assert_equal_p(git__memmem(haystack, haystack ? strlen(haystack) : 0, needle, needle ? strlen(needle) : 0), haystack + expected_pos); } static void assert_absent(const char *haystack,...
libgit2-main
tests/util/memmem.c
#include "clar_libgit2.h" #include "sortedcache.h" static int name_only_cmp(const void *a, const void *b) { return strcmp(a, b); } void test_sortedcache__name_only(void) { git_sortedcache *sc; void *item; size_t pos; cl_git_pass(git_sortedcache_new( &sc, 0, NULL, NULL, name_only_cmp, NULL)); cl_git_pass(git...
libgit2-main
tests/util/sortedcache.c
#include "clar_libgit2.h" #include "varint.h" void test_encoding__decode(void) { const unsigned char *buf = (unsigned char *)"AB"; size_t size; cl_assert(git_decode_varint(buf, &size) == 65); cl_assert(size == 1); buf = (unsigned char *)"\xfe\xdc\xbaXY"; cl_assert(git_decode_varint(buf, &size) == 267869656); ...
libgit2-main
tests/util/encoding.c
#include "clar_libgit2.h" void test_errors__public_api(void) { char *str_in_error; git_error_clear(); cl_assert(git_error_last() == NULL); git_error_set_oom(); cl_assert(git_error_last() != NULL); cl_assert(git_error_last()->klass == GIT_ERROR_NOMEMORY); str_in_error = strstr(git_error_last()->message, "memo...
libgit2-main
tests/util/errors.c
#include "clar_libgit2.h" #include "futils.h" typedef struct name_data { int count; /* return count */ char *name; /* filename */ } name_data; typedef struct walk_data { char *sub; /* sub-directory name */ name_data *names; /* name state data */ git_str path; } walk_data; static char *top_dir = "dir-walk"; s...
libgit2-main
tests/util/dirent.c
#include "clar_libgit2.h" #include "fs_path.h" static void test_make_relative( const char *expected_path, const char *path, const char *parent, int expected_status) { git_str buf = GIT_STR_INIT; git_str_puts(&buf, path); cl_assert_equal_i(expected_status, git_fs_path_make_relative(&buf, parent)); cl_assert_equ...
libgit2-main
tests/util/path/core.c
#include "clar_libgit2.h" #ifdef GIT_WIN32 #include "win32/path_w32.h" #endif #ifdef GIT_WIN32 static void test_utf8_to_utf16(const char *utf8_in, const wchar_t *utf16_expected) { git_win32_path path_utf16; int path_utf16len; cl_assert((path_utf16len = git_win32_path_from_utf8(path_utf16, utf8_in)) >= 0); cl_as...
libgit2-main
tests/util/path/win32.c
#include "clar_libgit2.h" /* Override default allocators with ones that will fail predictably. */ static git_allocator std_alloc; static git_allocator oom_alloc; static void *oom_malloc(size_t n, const char *file, int line) { /* Reject any allocation of more than 100 bytes */ return (n > 100) ? NULL : std_alloc.gm...
libgit2-main
tests/util/str/oom.c
#include "clar_libgit2.h" static git_str _buf; void test_str_splice__initialize(void) { git_str_init(&_buf, 16); } void test_str_splice__cleanup(void) { git_str_dispose(&_buf); } void test_str_splice__preprend(void) { git_str_sets(&_buf, "world!"); cl_git_pass(git_str_splice(&_buf, 0, 0, "Hello Dolly", str...
libgit2-main
tests/util/str/splice.c
#include "clar_libgit2.h" static const char *test_string = "Have you seen that? Have you seeeen that??"; void test_str_basic__resize(void) { git_str buf1 = GIT_STR_INIT; git_str_puts(&buf1, test_string); cl_assert(git_str_oom(&buf1) == 0); cl_assert_equal_s(git_str_cstr(&buf1), test_string); git_str_puts(&buf1,...
libgit2-main
tests/util/str/basic.c
#include "clar_libgit2.h" static void expect_quote_pass(const char *expected, const char *str) { git_str buf = GIT_STR_INIT; cl_git_pass(git_str_puts(&buf, str)); cl_git_pass(git_str_quote(&buf)); cl_assert_equal_s(expected, git_str_cstr(&buf)); cl_assert_equal_i(strlen(expected), git_str_len(&buf)); git_str_...
libgit2-main
tests/util/str/quote.c
#include "clar_libgit2.h" static void expect_decode_pass(const char *expected, const char *encoded) { git_str in = GIT_STR_INIT, out = GIT_STR_INIT; /* * ensure that we only read the given length of the input buffer * by putting garbage at the end. this will ensure that we do * not, eg, rely on nul-terminati...
libgit2-main
tests/util/str/percent.c
/* * Copyright (c) Vicent Marti. All rights reserved. * * This file is part of clar, distributed under the ISC license. * For full terms see the included COPYING file. */ #include <assert.h> #include <setjmp.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include <stdarg.h> #includ...
libgit2-main
tests/clar/clar.c
#include "clar_libgit2.h" #include "posix.h" #include "fs_path.h" #include "git2/sys/repository.h" void cl_git_report_failure( int error, int expected, const char *file, const char *func, int line, const char *fncall) { char msg[4096]; const git_error *last = git_error_last(); if (expected) p_snprintf(msg, 4096...
libgit2-main
tests/clar/clar_libgit2.c
#include "clar_libgit2.h" #include "clar_libgit2_trace.h" #ifdef GIT_WIN32_LEAKCHECK # include "win32/w32_leakcheck.h" #endif #ifdef _WIN32 int __cdecl main(int argc, char *argv[]) #else int main(int argc, char *argv[]) #endif { int res; char *at_exit_cmd; clar_test_init(argc, argv); res = git_libgit2_init(); ...
libgit2-main
tests/clar/main.c
#include "clar_libgit2_trace.h" #include "clar_libgit2.h" #include "clar_libgit2_timer.h" #include "trace.h" struct method { const char *name; void (*git_trace_cb)(git_trace_level_t level, const char *msg); void (*close)(void); }; static const char *message_prefix(git_trace_level_t level) { switch (level) { case...
libgit2-main
tests/clar/clar_libgit2_trace.c
#include "clar_libgit2.h" #include "clar_libgit2_timer.h" void cl_perf_timer__init(cl_perf_timer *t) { memset(t, 0, sizeof(cl_perf_timer)); } void cl_perf_timer__start(cl_perf_timer *t) { t->time_started = git__timer(); } void cl_perf_timer__stop(cl_perf_timer *t) { double time_now = git__timer(); t->last = tim...
libgit2-main
tests/clar/clar_libgit2_timer.c
#include "precompiled.h"
libgit2-main
tests/libgit2/precompiled.c
#include "clar_libgit2.h" static git_repository *_repo; static git_commit *commit; void test_commit_parent__initialize(void) { git_oid oid; cl_git_pass(git_repository_open(&_repo, cl_fixture("testrepo.git"))); git_oid__fromstr(&oid, "be3563ae3f795b2b4353bcce3a527ad0a4f7f644", GIT_OID_SHA1); cl_git_pass(git_comm...
libgit2-main
tests/libgit2/commit/parent.c
#include "clar_libgit2.h" #include "commit.h" #include "git2/commit.h" static git_repository *_repo; void test_commit_commit__initialize(void) { cl_fixture_sandbox("testrepo.git"); cl_git_pass(git_repository_open(&_repo, "testrepo.git")); } void test_commit_commit__cleanup(void) { git_repository_free(_repo); _re...
libgit2-main
tests/libgit2/commit/commit.c
#include "clar_libgit2.h" #include "signature.h" static int try_build_signature(const char *name, const char *email, git_time_t time, int offset) { git_signature *sign; int error = 0; if ((error = git_signature_new(&sign, name, email, time, offset)) < 0) return error; git_signature_free((git_signature *)sign)...
libgit2-main
tests/libgit2/commit/signature.c
#include "clar_libgit2.h" #include <git2/types.h> #include "commit.h" #include "signature.h" /* Fixture setup */ static git_repository *g_repo; void test_commit_parse__initialize(void) { g_repo = cl_git_sandbox_init("testrepo"); } void test_commit_parse__cleanup(void) { cl_git_sandbox_cleanup(); } /* Header parsin...
libgit2-main
tests/libgit2/commit/parse.c
#include "clar_libgit2.h" #include "git2/sys/commit.h" static const char *committer_name = "Vicent Marti"; static const char *committer_email = "vicent@github.com"; static const char *commit_message = "This commit has been created in memory\n\ This is a commit created in memory and it will be written back to disk\n...
libgit2-main
tests/libgit2/commit/write.c
#include "clar_libgit2.h" #include "delta.h" void test_delta_apply__read_at_off(void) { unsigned char base[16] = { 0 }, delta[] = { 0x10, 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0x10, 0x00, 0x00 }; void *out; size_t outlen; cl_git_fail(git_delta_apply(&out, &outlen, base, sizeof(base), delta, sizeof(delta))); } voi...
libgit2-main
tests/libgit2/delta/apply.c
#include "clar.h" #include "clar_libgit2.h" #include "git2/revert.h" #include "../merge/merge_helpers.h" #define TEST_REPO_PATH "revert-rename.git" static git_repository *repo; /* Fixture setup and teardown */ void test_revert_rename__initialize(void) { repo = cl_git_sandbox_init(TEST_REPO_PATH); } void test_reve...
libgit2-main
tests/libgit2/revert/rename.c
#include "clar.h" #include "clar_libgit2.h" #include "futils.h" #include "git2/revert.h" #include "../merge/merge_helpers.h" #define TEST_REPO_PATH "revert" static git_repository *repo; /* Fixture setup and teardown */ void test_revert_bare__initialize(void) { repo = cl_git_sandbox_init(TEST_REPO_PATH); } void t...
libgit2-main
tests/libgit2/revert/bare.c
#include "clar.h" #include "clar_libgit2.h" #include "futils.h" #include "git2/revert.h" #include "../merge/merge_helpers.h" #define TEST_REPO_PATH "revert" static git_repository *repo; static git_index *repo_index; /* Fixture setup and teardown */ void test_revert_workdir__initialize(void) { git_config *cfg; r...
libgit2-main
tests/libgit2/revert/workdir.c
#include "clar_libgit2.h" #include "git2/sys/repository.h" #include "apply.h" #include "repository.h" #include "../patch/patch_common.h" static git_repository *repo = NULL; static git_diff_options binary_opts = GIT_DIFF_OPTIONS_INIT; void test_apply_fromdiff__initialize(void) { repo = cl_git_sandbox_init("renames"...
libgit2-main
tests/libgit2/apply/fromdiff.c
#include "clar_libgit2.h" #include "apply_helpers.h" static git_repository *repo; #define TEST_REPO_PATH "merge-recursive" void test_apply_both__initialize(void) { git_oid oid; git_commit *commit; repo = cl_git_sandbox_init(TEST_REPO_PATH); git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", GIT...
libgit2-main
tests/libgit2/apply/both.c
#include "clar_libgit2.h" #include "apply_helpers.h" static git_repository *repo; #define TEST_REPO_PATH "merge-recursive" void test_apply_check__initialize(void) { git_oid oid; git_commit *commit; repo = cl_git_sandbox_init(TEST_REPO_PATH); git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", GI...
libgit2-main
tests/libgit2/apply/check.c
#include "clar_libgit2.h" #include "apply_helpers.h" struct iterator_compare_data { struct merge_index_entry *expected; size_t cnt; size_t idx; }; static int iterator_compare(const git_index_entry *entry, void *_data) { git_oid expected_id; struct iterator_compare_data *data = (struct iterator_compare_data *)_d...
libgit2-main
tests/libgit2/apply/apply_helpers.c
#include "clar_libgit2.h" #include "apply_helpers.h" static git_repository *repo; #define TEST_REPO_PATH "merge-recursive" void test_apply_index__initialize(void) { git_oid oid; git_commit *commit; repo = cl_git_sandbox_init(TEST_REPO_PATH); git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", GI...
libgit2-main
tests/libgit2/apply/index.c
#include "clar_libgit2.h" #include "git2/sys/repository.h" #include "apply.h" #include "repository.h" #include "../patch/patch_common.h" static git_repository *repo = NULL; void test_apply_partial__initialize(void) { repo = cl_git_sandbox_init("renames"); } void test_apply_partial__cleanup(void) { cl_git_sandbox...
libgit2-main
tests/libgit2/apply/partial.c
#include "clar_libgit2.h" #include "git2/sys/repository.h" #include "apply.h" #include "patch.h" #include "patch_parse.h" #include "repository.h" #include "../patch/patch_common.h" static git_repository *repo = NULL; void test_apply_fromfile__initialize(void) { repo = cl_git_sandbox_init("renames"); } void test_a...
libgit2-main
tests/libgit2/apply/fromfile.c
#include "clar_libgit2.h" #include "apply_helpers.h" static git_repository *repo; #define TEST_REPO_PATH "merge-recursive" void test_apply_callbacks__initialize(void) { git_oid oid; git_commit *commit; repo = cl_git_sandbox_init(TEST_REPO_PATH); git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707"...
libgit2-main
tests/libgit2/apply/callbacks.c
#include "clar_libgit2.h" #include "apply_helpers.h" static git_repository *repo; #define TEST_REPO_PATH "merge-recursive" void test_apply_workdir__initialize(void) { git_oid oid; git_commit *commit; repo = cl_git_sandbox_init(TEST_REPO_PATH); git_oid__fromstr(&oid, "539bd011c4822c560c1d17cab095006b7a10f707", ...
libgit2-main
tests/libgit2/apply/workdir.c
#include "clar_libgit2.h" #include "apply_helpers.h" #include "../merge/merge_helpers.h" static git_repository *repo; #define TEST_REPO_PATH "merge-recursive" void test_apply_tree__initialize(void) { repo = cl_git_sandbox_init(TEST_REPO_PATH); } void test_apply_tree__cleanup(void) { cl_git_sandbox_cleanup(); } ...
libgit2-main
tests/libgit2/apply/tree.c
#include "clar_libgit2.h" #include "path.h" #include "util.h" #include "posix.h" #include "submodule_helpers.h" #include "git2/sys/repository.h" /* rewrite gitmodules -> .gitmodules * rewrite the empty or relative urls inside each module * rename the .gitted directory inside any submodule to .git */ void rewrite_gi...
libgit2-main
tests/libgit2/submodule/submodule_helpers.c
#include "clar_libgit2.h" #include "submodule_helpers.h" #include "git2/sys/repository.h" #include "repository.h" #include "futils.h" static git_repository *g_repo = NULL; void test_submodule_lookup__initialize(void) { g_repo = setup_fixture_submod2(); } void test_submodule_lookup__cleanup(void) { cl_git_sandbox_c...
libgit2-main
tests/libgit2/submodule/lookup.c
#include "clar_libgit2.h" #include "posix.h" #include "path.h" #include "submodule_helpers.h" #include "futils.h" #include "repository.h" static git_repository *g_repo = NULL; void test_submodule_escape__cleanup(void) { cl_git_sandbox_cleanup(); } #define EVIL_SM_NAME "../../modules/evil" #define EVIL_SM_NAME_WINDO...
libgit2-main
tests/libgit2/submodule/escape.c
/* test the submodule APIs on repositories where there are no submodules */ #include "clar_libgit2.h" #include "posix.h" #include "futils.h" void test_submodule_nosubs__cleanup(void) { cl_git_sandbox_cleanup(); } void test_submodule_nosubs__lookup(void) { git_repository *repo = cl_git_sandbox_init("status"); git_...
libgit2-main
tests/libgit2/submodule/nosubs.c
#include "clar_libgit2.h" #include "posix.h" #include "path.h" #include "submodule_helpers.h" #include "futils.h" static git_repository *g_repo = NULL; void test_submodule_init__cleanup(void) { cl_git_sandbox_cleanup(); } void test_submodule_init__absolute_url(void) { git_submodule *sm; git_config *cfg; git_str ...
libgit2-main
tests/libgit2/submodule/init.c
#include "clar_libgit2.h" #include "posix.h" #include "path.h" #include "submodule_helpers.h" #include "futils.h" static git_repository *g_repo = NULL; void test_submodule_update__cleanup(void) { cl_git_sandbox_cleanup(); } void test_submodule_update__uninitialized_submodule_no_init(void) { git_submodule *sm; git...
libgit2-main
tests/libgit2/submodule/update.c
#include "clar_libgit2.h" #include "posix.h" #include "path.h" #include "submodule_helpers.h" #include "futils.h" #include "repository.h" static git_repository *g_repo = NULL; void test_submodule_inject_option__initialize(void) { g_repo = setup_fixture_submodule_simple(); } void test_submodule_inject_option__cleanu...
libgit2-main
tests/libgit2/submodule/inject_option.c
#include "clar_libgit2.h" #include "posix.h" #include "path.h" #include "submodule_helpers.h" #include "config/config_helpers.h" #include "futils.h" static git_repository *g_repo = NULL; void test_submodule_repository_init__basic(void) { git_submodule *sm; git_repository *repo; git_str dot_git_content = GIT_STR_IN...
libgit2-main
tests/libgit2/submodule/repository_init.c
#include "clar_libgit2.h" #include "posix.h" #include "path.h" #include "submodule_helpers.h" #include "futils.h" #include "iterator.h" static git_repository *g_repo = NULL; void test_submodule_status__initialize(void) { g_repo = setup_fixture_submod2(); } void test_submodule_status__cleanup(void) { } void test_su...
libgit2-main
tests/libgit2/submodule/status.c
#include "clar_libgit2.h" #include "posix.h" #include "path.h" #include "submodule_helpers.h" #include "config/config_helpers.h" #include "futils.h" #include "repository.h" #include "git2/sys/commit.h" static git_repository *g_repo = NULL; static const char *valid_blob_id = "fa49b077972391ad58037050f2a75f74e3671e92"; ...
libgit2-main
tests/libgit2/submodule/add.c
#include "clar_libgit2.h" #include "posix.h" #include "path.h" #include "submodule_helpers.h" #include "config/config_helpers.h" static git_repository *g_repo = NULL; #define SM_LIBGIT2_URL "https://github.com/libgit2/libgit2.git" #define SM_LIBGIT2_BRANCH "github-branch" #define SM_LIBGIT2 "sm_libgit2" vo...
libgit2-main
tests/libgit2/submodule/modify.c
#include "clar_libgit2.h" #include "submodule_helpers.h" #include "path.h" static git_repository *g_parent; static git_repository *g_child; static git_submodule *g_module; void test_submodule_open__initialize(void) { g_parent = setup_fixture_submod2(); } void test_submodule_open__cleanup(void) { git_submodule_free...
libgit2-main
tests/libgit2/submodule/open.c
#include "clar_libgit2.h" #include "clar_libgit2_trace.h" #include "trace.h" static int written = 0; static void trace_callback(git_trace_level_t level, const char *message) { GIT_UNUSED(level); cl_assert(strcmp(message, "Hello world!") == 0); written = 1; } void test_trace_trace__initialize(void) { /* If glob...
libgit2-main
tests/libgit2/trace/trace.c
#include "clar_libgit2.h" #include "win32/w32_leakcheck.h" #if defined(GIT_WIN32_LEAKCHECK) static void a(void) { char buf[10000]; cl_assert(git_win32_leakcheck_stack(buf, sizeof(buf), 0, NULL, NULL) == 0); #if 0 fprintf(stderr, "Stacktrace from [%s:%d]:\n%s\n", __FILE__, __LINE__, buf); #endif } static void b(v...
libgit2-main
tests/libgit2/trace/windows/stacktrace.c
#include "clar_libgit2.h" #include "git2/sys/remote.h" #include "git2/sys/transport.h" static const char *proxy_url = "https://proxy"; static git_transport _transport = GIT_TRANSPORT_INIT; static int dummy_transport(git_transport **transport, git_remote *owner, void *param) { *transport = &_transport; GIT_UNUSED(ow...
libgit2-main
tests/libgit2/transport/register.c
#include "clar_libgit2.h" #include "settings.h" void test_core_useragent__get(void) { const char *custom_name = "super duper git"; git_str buf = GIT_STR_INIT; cl_assert_equal_p(NULL, git_libgit2__user_agent()); cl_git_pass(git_libgit2_opts(GIT_OPT_SET_USER_AGENT, custom_name)); cl_assert_equal_s(custom_name, git...
libgit2-main
tests/libgit2/core/useragent.c
#include "clar_libgit2.h" #include "git2/sys/hashsig.h" #include "futils.h" #define SIMILARITY_TEST_DATA_1 \ "000\n001\n002\n003\n004\n005\n006\n007\n008\n009\n" \ "010\n011\n012\n013\n014\n015\n016\n017\n018\n019\n" \ "020\n021\n022\n023\n024\n025\n026\n027\n028\n029\n" \ "030\n031\n032\n033\n034\n035\n036\n037\n...
libgit2-main
tests/libgit2/core/hashsig.c
#include "clar_libgit2.h" #include "oidmap.h" static struct { git_oid oid; size_t extra; } test_oids[0x0FFF]; static git_oidmap *g_map; void test_core_oidmap__initialize(void) { uint32_t i, j; for (i = 0; i < ARRAY_SIZE(test_oids); ++i) { uint32_t segment = i / 8; int modi = i - (segment * 8); test_oids[i...
libgit2-main
tests/libgit2/core/oidmap.c
#include "clar_libgit2.h" #include "futils.h" #include "sysdir.h" #ifdef GIT_WIN32 #define NUM_VARS 5 static const char *env_vars[NUM_VARS] = { "HOME", "HOMEDRIVE", "HOMEPATH", "USERPROFILE", "PROGRAMFILES" }; #else #define NUM_VARS 1 static const char *env_vars[NUM_VARS] = { "HOME" }; #endif static char *env_save[N...
libgit2-main
tests/libgit2/core/env.c
#include "clar_libgit2.h" #include "oid.h" static git_oid id_sha1; static git_oid idp_sha1; static git_oid idm_sha1; const char *str_oid_sha1 = "ae90f12eea699729ed24555e40b9fd669da12a12"; const char *str_oid_sha1_p = "ae90f12eea699729ed"; const char *str_oid_sha1_m = "ae90f12eea699729ed24555e40b9fd669da12a12THIS IS E...
libgit2-main
tests/libgit2/core/oid.c
#include "clar_libgit2.h" void test_core_features__0(void) { int major, minor, rev, caps; git_libgit2_version(&major, &minor, &rev); cl_assert_equal_i(LIBGIT2_VER_MAJOR, major); cl_assert_equal_i(LIBGIT2_VER_MINOR, minor); cl_assert_equal_i(LIBGIT2_VER_REVISION, rev); caps = git_libgit2_features(); #ifdef GIT...
libgit2-main
tests/libgit2/core/features.c
#include "clar_libgit2.h" #include "cache.h" void test_core_opts__cleanup(void) { cl_git_pass(git_libgit2_opts(GIT_OPT_SET_EXTENSIONS, NULL, 0)); } void test_core_opts__readwrite(void) { size_t old_val = 0; size_t new_val = 0; git_libgit2_opts(GIT_OPT_GET_MWINDOW_SIZE, &old_val); git_libgit2_opts(GIT_OPT_SET_MW...
libgit2-main
tests/libgit2/core/opts.c
#include "clar_libgit2.h" #include "pool.h" #include "git2/oid.h" static char to_hex[] = "0123456789abcdef"; void test_core_pool__oid(void) { git_pool p; char oid_hex[GIT_OID_SHA1_HEXSIZE]; git_oid *oid; int i, j; memset(oid_hex, '0', sizeof(oid_hex)); git_pool_init(&p, sizeof(git_oid)); p.page_size = 4000; ...
libgit2-main
tests/libgit2/core/pool.c
#include "clar_libgit2.h" #include <git2/sys/commit_graph.h> #include <git2/sys/config.h> #include <git2/sys/filter.h> #include <git2/sys/odb_backend.h> #include <git2/sys/refdb_backend.h> #include <git2/sys/transport.h> #define STRINGIFY(s) #s /* Checks two conditions for the specified structure: * 1. That the ...
libgit2-main
tests/libgit2/core/structinit.c
#include "clar_libgit2.h" #include "buf.h" void test_core_buf__sanitize(void) { git_buf buf = { (char *)0x42, 0, 16 }; cl_git_pass(git_buf_sanitize(&buf)); cl_assert_equal_s(buf.ptr, ""); cl_assert_equal_i(buf.reserved, 0); cl_assert_equal_i(buf.size, 0); git_buf_dispose(&buf); } void test_core_buf__tostr(voi...
libgit2-main
tests/libgit2/core/buf.c
#include "clar.h" #include "clar_libgit2.h" #include "futils.h" #include "git2/cherrypick.h" #include "../merge/merge_helpers.h" #define TEST_REPO_PATH "cherrypick" static git_repository *repo; void test_cherrypick_bare__initialize(void) { repo = cl_git_sandbox_init(TEST_REPO_PATH); } void test_cherrypick_bare__...
libgit2-main
tests/libgit2/cherrypick/bare.c