From 997cb1c39c603512b7db760e9537c39ea3c68a38 Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 24 Nov 2019 04:51:55 +0100 Subject: Added reference bonus functions to test against assembly one --- Makefile | 7 +- ft_atoi_base_test.c | 113 +++++++++++++++++++++++++++ ft_list_push_front_test.c | 17 ++++ ft_list_remove_if_test.c | 17 ++++ ft_list_size_test.c | 17 ++++ ft_list_sort_test.c | 17 ++++ ft_strcpy_test.c | 6 +- ft_strdup_test.c | 6 +- functions_reference/ref_ft_atoi_base.c | 44 +++++++++++ functions_reference/ref_ft_list_push_front.c | 11 +++ functions_reference/ref_ft_list_remove_if.c | 21 +++++ functions_reference/ref_ft_list_size.c | 17 ++++ functions_reference/ref_ft_list_sort.c | 45 +++++++++++ helper.c | 7 -- libasm_test.h | 26 ++++++ main.c | 6 ++ prettier.py | 63 ++++++--------- 17 files changed, 386 insertions(+), 54 deletions(-) create mode 100644 ft_atoi_base_test.c create mode 100644 ft_list_push_front_test.c create mode 100644 ft_list_remove_if_test.c create mode 100644 ft_list_size_test.c create mode 100644 ft_list_sort_test.c create mode 100644 functions_reference/ref_ft_atoi_base.c create mode 100644 functions_reference/ref_ft_list_push_front.c create mode 100644 functions_reference/ref_ft_list_remove_if.c create mode 100644 functions_reference/ref_ft_list_size.c create mode 100644 functions_reference/ref_ft_list_sort.c diff --git a/Makefile b/Makefile index dd317a2..648cdbd 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,15 @@ PYTHON = python3 LIBASM_PATH = ../libasm CC = gcc -CCFLAGS = -Wall -Wextra +CCFLAGS = -I. -Wall -Wextra LDFLAGS = -L$(LIBASM_PATH) -lasm NAME = runtest SRC = main.c ft_strlen_test.c ft_strcpy_test.c ft_strcmp_test.c \ - ft_write_test.c ft_read_test.c ft_strdup_test.c helper.c + ft_write_test.c ft_read_test.c ft_strdup_test.c helper.c \ + ft_atoi_base_test.c ft_list_push_front_test.c ft_list_size_test.c \ + ft_list_sort_test.c ft_list_remove_if_test.c \ + functions_reference/ref_ft_atoi_base.c OBJ = $(SRC:.c=.o) run: pretty diff --git a/ft_atoi_base_test.c b/ft_atoi_base_test.c new file mode 100644 index 0000000..ece1ce7 --- /dev/null +++ b/ft_atoi_base_test.c @@ -0,0 +1,113 @@ +#include "libasm_test.h" + +static int expected_ret; +static int actual_ret; + +#define FT_ATOI_BASE_EXPECT(str, base) do { \ + expected_ret = ref_ft_atoi_base(str, base); \ + actual_ret = ft_atoi_base(str, base); \ + if (actual_ret != expected_ret) \ + printf("KO: [COMPARE]: %s: expected: %d got: %d with: "#str", "#base"\n", \ + test_name, expected_ret, actual_ret); \ + else \ + print_ok(); \ +} while (0); + +static void +ft_atoi_base_segfault(void) +{ + TEST_ASM_FUNCTION(ft_atoi_base("", "")); + TEST_ASM_FUNCTION(ft_atoi_base("10", "")); + TEST_ASM_FUNCTION(ft_atoi_base("", "01")); + TEST_ASM_FUNCTION(ft_atoi_base("123", "0123456789")); + TEST_ASM_FUNCTION(ft_atoi_base("101", "01")); + TEST_ASM_FUNCTION(ft_atoi_base("ffe0", "0123456789abcdef")); + TEST_ASM_FUNCTION(ft_atoi_base("\t\n\r\v\f\r 4", "01234")); + TEST_ASM_FUNCTION(ft_atoi_base("45", "")); + TEST_ASM_FUNCTION(ft_atoi_base("45", "0")); + TEST_ASM_FUNCTION(ft_atoi_base("45", "01")); + TEST_ASM_FUNCTION(ft_atoi_base("10", "011")); + TEST_ASM_FUNCTION(ft_atoi_base("10", "0+")); + TEST_ASM_FUNCTION(ft_atoi_base("10", "-0")); + TEST_ASM_FUNCTION(ft_atoi_base("10111", "\t541")); + TEST_ASM_FUNCTION(ft_atoi_base("10111", "98\n541")); + TEST_ASM_FUNCTION(ft_atoi_base("10111", "7\r541")); + TEST_ASM_FUNCTION(ft_atoi_base("10111", "0\v541")); + TEST_ASM_FUNCTION(ft_atoi_base("10111", "1\f541")); + TEST_ASM_FUNCTION(ft_atoi_base("10111", "54 1")); + TEST_ASM_FUNCTION(ft_atoi_base("111000", "01")); + TEST_ASM_FUNCTION(ft_atoi_base("ff", "0123456789abcdef")); + TEST_ASM_FUNCTION(ft_atoi_base("52", "01234567")); + TEST_ASM_FUNCTION(ft_atoi_base("2a", "0123456789abcdef")); + TEST_ASM_FUNCTION(ft_atoi_base("7fffffff", "0123456789abcdef")); + TEST_ASM_FUNCTION(ft_atoi_base("ff", "0123-456789abcdef")); + TEST_ASM_FUNCTION(ft_atoi_base("ff", "01\r23456789abcdef")); + TEST_ASM_FUNCTION(ft_atoi_base("ff", "abcc")); + TEST_ASM_FUNCTION(ft_atoi_base("ff", "")); + TEST_ASM_FUNCTION(ft_atoi_base("ff", "a")); +} + +static void +ft_atoi_base_compare(void) +{ + FT_ATOI_BASE_EXPECT("", ""); + FT_ATOI_BASE_EXPECT("10", ""); + FT_ATOI_BASE_EXPECT("", "01"); + FT_ATOI_BASE_EXPECT("123", "0123456789"); + FT_ATOI_BASE_EXPECT("101", "01"); + FT_ATOI_BASE_EXPECT("ffe0", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("\t\n\r\v\f\r 4", "01234"); + FT_ATOI_BASE_EXPECT("45", ""); + FT_ATOI_BASE_EXPECT("45", "0"); + FT_ATOI_BASE_EXPECT("45", "01"); + FT_ATOI_BASE_EXPECT("10", "011"); + FT_ATOI_BASE_EXPECT("10", "0+"); + FT_ATOI_BASE_EXPECT("10", "-0"); + FT_ATOI_BASE_EXPECT("10111", "\t541"); + FT_ATOI_BASE_EXPECT("10111", "98\n541"); + FT_ATOI_BASE_EXPECT("10111", "7\r541"); + FT_ATOI_BASE_EXPECT("10111", "0\v541"); + FT_ATOI_BASE_EXPECT("10111", "1\f541"); + FT_ATOI_BASE_EXPECT("10111", "54 1"); + FT_ATOI_BASE_EXPECT("111000", "01"); + FT_ATOI_BASE_EXPECT("ff", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("52", "01234567"); + FT_ATOI_BASE_EXPECT("2a", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("7fffffff", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("ff", "0123-456789abcdef"); + FT_ATOI_BASE_EXPECT("ff", "01\r23456789abcdef"); + FT_ATOI_BASE_EXPECT("ff", "abcc"); + FT_ATOI_BASE_EXPECT("ff", ""); + FT_ATOI_BASE_EXPECT("ff", "a"); + FT_ATOI_BASE_EXPECT("-ff", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("--ff", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("+--ff", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("-++++++-+--ff", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("-++++++-+--ff\xff", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("-+\r++-+--ff\xff", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("-01", "01"); + FT_ATOI_BASE_EXPECT("--11101", "01"); + FT_ATOI_BASE_EXPECT("+-123", "01"); + FT_ATOI_BASE_EXPECT("-++++01++-+--ff", "01"); + FT_ATOI_BASE_EXPECT("-++10101\xff", "01"); + FT_ATOI_BASE_EXPECT("-+\r++-+--01\x01", "01"); + FT_ATOI_BASE_EXPECT("a\0bb", "ab"); + FT_ATOI_BASE_EXPECT("-b\0bb", "ab"); + FT_ATOI_BASE_EXPECT(" \t\n\r-++++++-+--ff\xff", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT(" -+\r++-+--ff\xff", "0123456789abcdef"); + FT_ATOI_BASE_EXPECT("\n-01", "01"); + FT_ATOI_BASE_EXPECT("\x0b--11101", "01"); + FT_ATOI_BASE_EXPECT(" 755x+", "01234567"); + FT_ATOI_BASE_EXPECT(" 700chmod", "01234567"); + FT_ATOI_BASE_EXPECT(" 644yo", "01234567"); +} + +void +ft_atoi_base_test(void) +{ + test_name = "ft_atoi_base.s"; + + ft_atoi_base_segfault(); + if (!signaled) + ft_atoi_base_compare(); +} diff --git a/ft_list_push_front_test.c b/ft_list_push_front_test.c new file mode 100644 index 0000000..411194e --- /dev/null +++ b/ft_list_push_front_test.c @@ -0,0 +1,17 @@ +#include "libasm_test.h" + +static void +ft_list_push_front_segfault(void) +{ + +} +static void +ft_list_push_front_compare(void) +{ + +} +void +ft_list_push_front_test(void) +{ + +} diff --git a/ft_list_remove_if_test.c b/ft_list_remove_if_test.c new file mode 100644 index 0000000..e574949 --- /dev/null +++ b/ft_list_remove_if_test.c @@ -0,0 +1,17 @@ +#include "libasm_test.h" + +static void +ft_list_remove_if_segfault(void) +{ + +} +static void +ft_list_remove_if_compare(void) +{ + +} +void +ft_list_remove_if_test(void) +{ + +} diff --git a/ft_list_size_test.c b/ft_list_size_test.c new file mode 100644 index 0000000..80394d7 --- /dev/null +++ b/ft_list_size_test.c @@ -0,0 +1,17 @@ +#include "libasm_test.h" + +static void +ft_list_size_segfault(void) +{ + +} +static void +ft_list_size_compare(void) +{ + +} +void +ft_list_size_test(void) +{ + +} diff --git a/ft_list_sort_test.c b/ft_list_sort_test.c new file mode 100644 index 0000000..e9fe2da --- /dev/null +++ b/ft_list_sort_test.c @@ -0,0 +1,17 @@ +#include "libasm_test.h" + +static void +ft_list_sort_segfault(void) +{ + +} +static void +ft_list_sort_compare(void) +{ + +} +void +ft_list_sort_test(void) +{ + +} diff --git a/ft_strcpy_test.c b/ft_strcpy_test.c index 1ca7a49..c8ec474 100644 --- a/ft_strcpy_test.c +++ b/ft_strcpy_test.c @@ -9,7 +9,7 @@ static char actual_buf[FT_STRCPY_BUF_SIZE] = {0}; strcpy(expected_buf, str); \ ft_strcpy(actual_buf, str); \ if (strcmp(expected_buf, actual_buf) != 0) \ - printf("KO: [COMPARE]: %s: expected: \"%s\" got: \"%s\"\n", test_name, expected_buf, actual_buf); \ + printf("KO: [COMPARE]: %s: expected: \"%s\" got: \"%s\"\n", test_name, expected_buf, actual_buf); \ else \ print_ok(); \ } while (0); @@ -47,8 +47,8 @@ volutpat, eros eget rhoncus rhoncus, diam augue egestas dolor, vitae rutrum nisi felis sed purus. Mauris magna ex, mollis non suscipit eu, lacinia ac turpis. Phasellus\ ac tortor et lectus fermentum lobortis eu at mauris. Vestibulum sit amet posuere\ tortor, sit amet consequat amet."); - FT_STRCPY_EXPECT("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"); - FT_STRCPY_EXPECT("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"); + FT_STRCPY_EXPECT("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0b\x0c\x0d\x0e\x0f"); + FT_STRCPY_EXPECT("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0b\x0c\x0d\x0e\x0f"); } void diff --git a/ft_strdup_test.c b/ft_strdup_test.c index b0d48b7..5ca7850 100644 --- a/ft_strdup_test.c +++ b/ft_strdup_test.c @@ -5,7 +5,7 @@ static char *tmp; #define FT_STRDUP_EXPECT(str) do { \ tmp = ft_strdup(str); \ if (tmp == NULL || strcmp(str, tmp) != 0) \ - printf("KO: [COMPARE]: %s: expected: \"%s\" got: \"%s\"\n", test_name, str, tmp); \ + printf("KO: [COMPARE]: %s: expected: \"%s\" got: \"%s\"\n", test_name, str, tmp); \ else \ print_ok(); \ free(tmp); \ @@ -53,8 +53,8 @@ volutpat, eros eget rhoncus rhoncus, diam augue egestas dolor, vitae rutrum nisi felis sed purus. Mauris magna ex, mollis non suscipit eu, lacinia ac turpis. Phasellus\ ac tortor et lectus fermentum lobortis eu at mauris. Vestibulum sit amet posuere\ tortor, sit amet consequat amet."); - FT_STRDUP_EXPECT("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"); - FT_STRDUP_EXPECT("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f"); + FT_STRDUP_EXPECT("\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0b\x0c\x0d\x0e\x0f"); + FT_STRDUP_EXPECT("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0b\x0c\x0d\x0e\x0f"); } diff --git a/functions_reference/ref_ft_atoi_base.c b/functions_reference/ref_ft_atoi_base.c new file mode 100644 index 0000000..b2a4231 --- /dev/null +++ b/functions_reference/ref_ft_atoi_base.c @@ -0,0 +1,44 @@ +#include "libasm_test.h" + +static bool +valid_base(char *base) +{ + if (strlen(base) < 2) + return false; + while (*base) + { + if (isspace(*base) || *base == '+' || *base == '-') + return false; + for (int i = 1; base[i]; i++) + if (base[i] == *base) + return false; + base++; + } + return true; +} + +int +ref_ft_atoi_base(char *str, char *base) +{ + long int nb; + int radix; + bool is_negative; + + if (!valid_base(base)) + return 0; + while (isspace(*str)) + str++; + is_negative = false; + while (*str == '+' || *str == '-') + if (*str++ == '-') + is_negative = !is_negative; + radix = strlen(base); + nb = 0; + while (*str && strchr(base, *str) != NULL) + { + nb *= radix; + nb += strchr(base, *str) - base; + str++; + } + return is_negative ? -nb : nb; +} diff --git a/functions_reference/ref_ft_list_push_front.c b/functions_reference/ref_ft_list_push_front.c new file mode 100644 index 0000000..821247d --- /dev/null +++ b/functions_reference/ref_ft_list_push_front.c @@ -0,0 +1,11 @@ +#include "libasm_test.h" + +void +ref_ft_list_push_front(t_list **begin_list, void *data) +{ + + if (begin_list == NULL || data == NULL) + return ; + data->next = *begin_list; + *begin_list = data; +} diff --git a/functions_reference/ref_ft_list_remove_if.c b/functions_reference/ref_ft_list_remove_if.c new file mode 100644 index 0000000..8b55da1 --- /dev/null +++ b/functions_reference/ref_ft_list_remove_if.c @@ -0,0 +1,21 @@ +#include "libasm_test.h" + +void +ref_ft_list_remove_if(t_list **begin_list, void *data_ref, + int (*cmp)(), void (*free_fct)(void *)) +{ + t_list *saved_next; + + if (begin_list == NULL || *begin_list == NULL) + return ; + if (cmp(&(*begin_list)->val, data_ref) != 0) + { + ref_ft_list_remove_if(&(*begin_list)->next, data_ref, cmp, free_fct); + return ; + } + saved_next = (*begin_list)->next; + free_fct((*begin_list)->val); + free(*begin_list); + *begin_list = saved_next; + ref_ft_list_remove_if(begin_list, data_ref, cmp, free_fct); +} diff --git a/functions_reference/ref_ft_list_size.c b/functions_reference/ref_ft_list_size.c new file mode 100644 index 0000000..7473bad --- /dev/null +++ b/functions_reference/ref_ft_list_size.c @@ -0,0 +1,17 @@ +#include "libasm_test.h" + +int +ref_ft_list_size(t_list *begin_list) +{ + int counter; + + counter = 0; + while (begin_list) + { + counter++ + begin_list = begin_list->next; + } + return counter; +} + + diff --git a/functions_reference/ref_ft_list_sort.c b/functions_reference/ref_ft_list_sort.c new file mode 100644 index 0000000..b03c84b --- /dev/null +++ b/functions_reference/ref_ft_list_sort.c @@ -0,0 +1,45 @@ +#include "libasm_test.h" + +static t_list* +merge_sorted_list(t_list* l1, t_list* l2, int (*cmp)()) +{ + t_list *merged = NULL; + + if (l1 == NULL && l2 == NULL) + return NULL; + if (l1 == NULL) + return l2; + if (l2 == NULL) + return l1; + merged = cmp(l1->data, l2->data) < 0 ? l1 : l2; + if (cmp(l1->data, l2->data) < 0) + merged->next = merge_sorted_list(l1->next, l2, cmp); + else + merged->next = merge_sorted_list(l1, l2->next, cmp); + return merged; +} + +void +ref_ft_list_sort(t_list **begin_list, int (*cmp)()) +{ + if (begin_list == NULL || *begin_list == NULL + || (*begin_list)->next == NULL) + return ; + t_list *fast = (*begin_list)->next; + t_list *slow = *begin_list; + while (fast != NULL) + { + fast = fast->next; + if (fast != NULL) + { + fast = fast->next; + slow = slow->next; + } + } + t_list *middle = slow->next; + slow->next = NULL; + + sortList(begin_list, cmp); + sortList(&middle, cmp); + *begin_list = merge_sorted_list(*begin_list, middle, cmp); +} diff --git a/helper.c b/helper.c index 1808628..ebfa232 100644 --- a/helper.c +++ b/helper.c @@ -8,13 +8,6 @@ print_ok(void) fflush(stdout); } -void -print_stack_alignment_error(void) -{ - printf("KO: [STACK ALIGNMENT]: %s\n", test_name); - fflush(stdout); -} - void print_signaled_ko(void) { diff --git a/libasm_test.h b/libasm_test.h index 6a71788..3076372 100644 --- a/libasm_test.h +++ b/libasm_test.h @@ -64,6 +64,18 @@ ft_read_test(void); void ft_strdup_test(void); +void +ft_atoi_base_test(void); +void +ft_list_push_front_test(void); +void +ft_list_size_test(void); +void +ft_list_sort_test(void); +void +ft_list_remove_if_test(void); + + /* * helpers @@ -75,6 +87,20 @@ print_signaled_ko(void); void expect_int(int expected, int actual); +/* + * function of reference + */ +int +ref_ft_atoi_base(char *str, char *base); +void +ref_ft_list_push_front(t_list **begin_list, void *data); +int +ref_ft_list_size(t_list *begin_list); +void +ref_ft_list_sort(t_list **begin_list, int (*cmp)()); +void +ref_ft_list_remove_if(t_list **begin_list, void *data_ref, int (*cmp)(), void (*free_fct)(void *)); + /* * segfault tester */ diff --git a/main.c b/main.c index dbaa60d..8b19230 100644 --- a/main.c +++ b/main.c @@ -9,5 +9,11 @@ main(void) ft_write_test(); ft_read_test(); ft_strdup_test(); + + ft_atoi_base_test(); + ft_list_push_front_test(); + ft_list_size_test(); + ft_list_sort_test(); + ft_list_remove_if_test(); return 0; } diff --git a/prettier.py b/prettier.py index ce8a839..1b8ad0a 100644 --- a/prettier.py +++ b/prettier.py @@ -11,29 +11,6 @@ def green(*strings): def red(*strings): return "".join([f"\033[31m{s}\033[0m" for s in strings]) - -def parse_args(): - parser = argparse.ArgumentParser( prog="ft_printf test", description="A ~quicker tester for ft_printf") - parser.add_argument("-v", "--verbose", - help="increase verbosity", action="store_true") - parser.add_argument("-q", "--quiet", - help="decrease vebosity", action="store_true") - parser.add_argument("-l", "--no-log", - help="disable result log", action="store_true") - parser.add_argument("-c", "--no-clear", help="disable terminal clear before output") - parser.add_argument("-i", "--interactive", help="print fail as them come", - action="store_true") - parser.add_argument("-f", "--output-file", help="output file name") - return vars(parser.parse_args(sys.argv[1:])) - - -def print_log_ko(ko, options): - print(f"- [{red(ko['type'])}] ft_printf({ko['args']})") - if options["verbose"]: - print(" expected: ", ko["expected"]) - print(" actual: ", ko["actual"]) - print() - def create_logs_entry(logs, key): logs[key] = {} logs[key]["ok_counter"] = 0 @@ -50,28 +27,36 @@ def parse(): print("\n\n", line[4:], ": ", sep="", end="") create_logs_entry(logs, line[4:]) logs[line[4:]]["ok_counter"] += 1 - if (logs[line[4:]]["ok_counter"] + logs[line[4:]]["ko_counter"]) % 10 == 0: + if (logs[line[4:]]["ok_counter"] + logs[line[4:]]["ko_counter"]) % 15 == 0: print("\n", ''.join([" " for _ in range(1 + len(line[4:]))]), end="") print(green("[OK] "), end="") continue - m = re.search("^KO: \[(SEGFAULT|COMPARE)\]: (.*): expected: (.*) got: (.*)$", line) - if m is None: - print(line) - print("PARSING ERROR") - continue - l = logs.get(m.group(2)) + if line.find("SEGFAULT") != -1: + name = line[4:] + else: + m = re.search("^KO: \[COMPARE\]: (.*): expected: (.*) got: (.*) (with: .*)?$", line) + if m is None: + print(line) + print("PARSING ERROR") + continue + name = m.group(1) + + l = logs.get(name) if l is None: - print("\n") - create_logs_entry(logs, m.group(2)) + create_logs_entry(logs, name) + print("\n\n", name, ": ", sep="", end="") + l = logs.get(name) l["ko_counter"] += 1 l["ko_info"].append({ - "type": m.group(1), - "expected": m.group(3), - "actual": m.group(4), + "type": "COMPARE", + "expected": m.group(2), + "actual": m.group(3), + "with": m.group(4)[6:] }) - if (l["ok_counter"] + l["ko_counter"]) % 10 == 0: - print("\n", ''.join([" " for _ in range(1 + len(m.group(2)))]), end="") + if (l["ok_counter"] + l["ko_counter"]) % 15 == 0: + print("\n", ''.join([" " for _ in range(1 + len(name))]), end="") print(red("[KO] "), end="") + sys.stdout.flush() return logs if __name__ == "__main__": @@ -81,6 +66,6 @@ if __name__ == "__main__": for k, v in logs.items(): for e in v["ko_info"]: if e['type'] == "SEGFAULT": - print(f"{k} : {red(SEGFAULT)}") + print(f"{k} : {red('SEGFAULT')}") elif e['type'] == "COMPARE": - print(f"{k}:\n {green('expected: ', e['expected'])}\n {red('actual: ', e['actual'])}") + print(f"{k} with {e['with']}:\n {green('expected: ', e['expected'])}\n {red('actual: ', e['actual'])}") -- cgit