mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 18:08:11 +00:00
Added t0501-walk (simple test for all revision pool walking modes)
Signed-off-by: Vicent Marti <tanoku@gmail.com> Signed-off-by: Andreas Ericsson <ae@op5.se>
This commit is contained in:
parent
1d1be8ee22
commit
0cf02ff92d
BIN
tests/t0501-objects/13/85f264afb75a56a5bec74243be9b367ba4ca08
Normal file
BIN
tests/t0501-objects/13/85f264afb75a56a5bec74243be9b367ba4ca08
Normal file
Binary file not shown.
BIN
tests/t0501-objects/18/1037049a54a1eb5fab404658a3a250b44335d7
Normal file
BIN
tests/t0501-objects/18/1037049a54a1eb5fab404658a3a250b44335d7
Normal file
Binary file not shown.
BIN
tests/t0501-objects/18/10dff58d8a660512d4832e740f692884338ccd
Normal file
BIN
tests/t0501-objects/18/10dff58d8a660512d4832e740f692884338ccd
Normal file
Binary file not shown.
BIN
tests/t0501-objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057
Normal file
BIN
tests/t0501-objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057
Normal file
Binary file not shown.
@ -0,0 +1,2 @@
|
|||||||
|
x<01>ŽQ
|
||||||
|
Â0DýÎ)öÊ6›Í¦ "xO°‰‰-ØFb¼¿EoàÏ0¼Ç¤º,ske×[ÎPn8R,EpD?±gŸ}Ê^3²âÙ<µåµGŽhYKÄèÒ8ЖDA<44>É)¿ÉÈ;gôݧÚàšjïp™4ÕŽ¯ô-çû¢óã<C3B3>êr‚ÁŠ;°s°GA4Ûº=ìùÖ(ôin7øIÌKÍFE
|
@ -0,0 +1,2 @@
|
|||||||
|
xťŽŰ 1EýNi@™Ék2 "X‚$ŮYW0Yc˙íŔżĂ…s¸ĄŐzďÚÚőMDĎ€0ćś8!¶†ÉĚŢs‰XŠŞgÚdí::@X0»P˘wŮ"F/‰‰śÍRŕ<>Uz÷ĄmúZZďú˛¤ŇV}|•/śo5݇ŇęIŁ!¬1z Ć:vůÇUim}ę/˘>
|
||||||
|
öF-
|
BIN
tests/t0501-objects/75/057dd4114e74cca1d750d0aee1647c903cb60a
Normal file
BIN
tests/t0501-objects/75/057dd4114e74cca1d750d0aee1647c903cb60a
Normal file
Binary file not shown.
BIN
tests/t0501-objects/81/4889a078c031f61ed08ab5fa863aea9314344d
Normal file
BIN
tests/t0501-objects/81/4889a078c031f61ed08ab5fa863aea9314344d
Normal file
Binary file not shown.
BIN
tests/t0501-objects/84/96071c1b46c854b31185ea97743be6a8774479
Normal file
BIN
tests/t0501-objects/84/96071c1b46c854b31185ea97743be6a8774479
Normal file
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
x<01><>[
|
||||||
|
Т0E§Ю*fЪфеЄ "ИW0<57><30>-иFтtџн<><EFBFBD>чpS[<5B>YР<59>x<EFBFBD>^
|
||||||
|
Dэb CLhutЩ<18>}Ѕ8X*4ZэЌsYНЈ<D09D>UР<55>AУж
ЬX3<>RЋMЕЖ) s6шМЂMІжс<D0B6><D181>м&Jm<4A>ѓ;}ЧѕБаќ<ЅЖ\@<40>р<EFBFBD>бо<D0B1>pФ<70>ЈvК?<3F>ђ<EFBFBD>ЋjлКL№ЋЈи?Hх
|
@ -0,0 +1,2 @@
|
|||||||
|
xťŹ;j1DëťmdÓú·Ŕ<C2B7>ÇŽ|M«µ3`ŤŚV{>€łâQŻ ¸·vL0I?Í!š4–Z=Ę! צ8˛F˘Ă’!rÖsQßyČ9<C48C>]$DŽ&„l6AÇ>jFWüҵIKNiűë§Z˘%ˇS<>Ś‘
|
||||||
|
‹Ň Ĺʉř<E280B0>U~Ě˝řä>'Ľď™ű Żwţ
×[ËÇ×÷öÚDGÚˇ±đŚQ-şMůŹ«>dܶ‘OŢáŇň}í\ŕ8g_ШÂoYr
|
BIN
tests/t0501-objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd
Normal file
BIN
tests/t0501-objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd
Normal file
Binary file not shown.
BIN
tests/t0501-objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6
Normal file
BIN
tests/t0501-objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6
Normal file
Binary file not shown.
@ -0,0 +1,3 @@
|
|||||||
|
x<01><>Kj1D³Ö)zçUBëÛ-0Á<30>uV9<56>¦Õò<#£È÷ÏȲ+ŠW<Jú¶Ý&8Ê/s¨‚e‹µµÈ•KJ«<C2AD>½S
|
||||||
|
ØRvÌÁ{©æQ†îr«äY¹QN$H\Eµ²Íè=6áX5¦òÇK Fr)·(‰dC<>‡Î†”–œ—jÊs®}À—ô9ác-Òw8Ëo¸\·r»¿IßÞÁ:
|
||||||
|
l}F‚W$Ds´Ç£©ÿÙšOW…e”]V8-Ã<>ÌÈ"U
|
@ -0,0 +1,3 @@
|
|||||||
|
x<01>ŽQ
|
||||||
|
Â0DýÎ)öʦ»I<‚'ØlR+˜Fj¼¿EoàÏ0<xÃh«õÞa Üõµ]È™åXUlÞPF)Åz‘4yó”µ,\r 'SÂÄ-mI4
|
||||||
|
‘Xhô”&òÌFÞ}n+\µõ—Y´-p|é·œoUî<55>ƒ¶z;-<2D>‘a<E28098>Ñlt{ØË?®I«,:ÃoÚR̳cHK
|
BIN
tests/t0501-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
Normal file
BIN
tests/t0501-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
Normal file
Binary file not shown.
BIN
tests/t0501-objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1
Normal file
BIN
tests/t0501-objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1
Normal file
Binary file not shown.
BIN
tests/t0501-objects/fa/49b077972391ad58037050f2a75f74e3671e92
Normal file
BIN
tests/t0501-objects/fa/49b077972391ad58037050f2a75f74e3671e92
Normal file
Binary file not shown.
BIN
tests/t0501-objects/fd/093bff70906175335656e6ce6ae05783708765
Normal file
BIN
tests/t0501-objects/fd/093bff70906175335656e6ce6ae05783708765
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
77
tests/t0501-walk.c
Normal file
77
tests/t0501-walk.c
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#include "test_lib.h"
|
||||||
|
#include "test_helpers.h"
|
||||||
|
#include "commit.h"
|
||||||
|
|
||||||
|
#include <git/odb.h>
|
||||||
|
#include <git/commit.h>
|
||||||
|
#include <git/revwalk.h>
|
||||||
|
|
||||||
|
static const char *odb_dir = "../t0501-objects";
|
||||||
|
/*
|
||||||
|
$ git log --oneline --graph --decorate
|
||||||
|
* a4a7dce (HEAD, br2) Merge branch 'master' into br2
|
||||||
|
|\
|
||||||
|
| * 9fd738e (master) a fourth commit
|
||||||
|
| * 4a202b3 a third commit
|
||||||
|
* | c47800c branch commit one
|
||||||
|
|/
|
||||||
|
* 5b5b025 another commit
|
||||||
|
* 8496071 testing
|
||||||
|
*/
|
||||||
|
static const char *commit_head = "a4a7dce85cf63874e984719f4fdd239f5145052f";
|
||||||
|
|
||||||
|
static const char *commit_ids[] = {
|
||||||
|
"a4a7dce85cf63874e984719f4fdd239f5145052f", // 0
|
||||||
|
"9fd738e8f7967c078dceed8190330fc8648ee56a", // 1
|
||||||
|
"4a202b346bb0fb0db7eff3cffeb3c70babbd2045", // 2
|
||||||
|
"c47800c7266a2be04c571c04d5a6614691ea99bd", // 3
|
||||||
|
"8496071c1b46c854b31185ea97743be6a8774479", // 4
|
||||||
|
"5b5b025afb0b4c913b4c338a42934a3863bf3644", // 5
|
||||||
|
};
|
||||||
|
|
||||||
|
static const int commit_sorting_topo[] = {0, 1, 2, 3, 5, 4};
|
||||||
|
static const int commit_sorting_time[] = {0, 3, 1, 2, 5, 4};
|
||||||
|
static const int commit_sorting_topo_reverse[] = {4, 5, 3, 2, 1, 0};
|
||||||
|
static const int commit_sorting_time_reverse[] = {4, 5, 2, 1, 3, 0};
|
||||||
|
static const int commit_sorting_topo_time[] = {0};
|
||||||
|
|
||||||
|
BEGIN_TEST(simple_walk_test)
|
||||||
|
git_odb *db;
|
||||||
|
git_oid id;
|
||||||
|
git_revpool *pool;
|
||||||
|
git_commit *head = NULL;
|
||||||
|
|
||||||
|
must_pass(git_odb_open(&db, odb_dir));
|
||||||
|
|
||||||
|
pool = gitrp_alloc(db);
|
||||||
|
must_be_true(pool != NULL);
|
||||||
|
|
||||||
|
git_oid_mkstr(&id, commit_head);
|
||||||
|
|
||||||
|
head = git_commit_parse(pool, &id);
|
||||||
|
must_be_true(head != NULL);
|
||||||
|
|
||||||
|
gitrp_push(pool, head);
|
||||||
|
|
||||||
|
#define TEST_WALK(sort_flags, result_array) {\
|
||||||
|
char oid[40]; int i = 0;\
|
||||||
|
git_commit *commit = NULL;\
|
||||||
|
gitrp_sorting(pool, sort_flags);\
|
||||||
|
while ((commit = gitrp_next(pool)) != NULL) {\
|
||||||
|
git_oid_fmt(oid, &commit->object.id);\
|
||||||
|
must_be_true(memcmp(oid, commit_ids[result_array[i++]], 40) == 0);\
|
||||||
|
}\
|
||||||
|
must_be_true(i == sizeof(result_array)/sizeof(int));\
|
||||||
|
gitrp_reset(pool);\
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_WALK(GIT_RPSORT_TIME, commit_sorting_time);
|
||||||
|
TEST_WALK(GIT_RPSORT_TOPOLOGICAL, commit_sorting_topo);
|
||||||
|
TEST_WALK(GIT_RPSORT_TIME | GIT_RPSORT_REVERSE, commit_sorting_time_reverse);
|
||||||
|
TEST_WALK(GIT_RPSORT_TOPOLOGICAL | GIT_RPSORT_REVERSE, commit_sorting_topo_reverse);
|
||||||
|
|
||||||
|
#undef TEST_WALK
|
||||||
|
|
||||||
|
gitrp_free(pool);
|
||||||
|
git_odb_close(db);
|
||||||
|
END_TEST
|
Loading…
Reference in New Issue
Block a user