diff options
author | Vicent Marti <tanoku@gmail.com> | 2010-05-26 21:23:01 +0200 |
---|---|---|
committer | Andreas Ericsson <ae@op5.se> | 2010-06-02 10:32:07 +0200 |
commit | 0cf02ff92d5c08516ff2253f59daad1c4c582d8f (patch) | |
tree | 698d940f85a59f00286c49af24b390be7cd8466d | |
parent | 1d1be8ee22a69ad37b6cab510bf5f480dc6df779 (diff) | |
download | libgit2-0cf02ff92d5c08516ff2253f59daad1c4c582d8f.tar.gz |
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>
22 files changed, 92 insertions, 0 deletions
diff --git a/tests/t0501-objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 b/tests/t0501-objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 Binary files differnew file mode 100644 index 000000000..cedb2a22e --- /dev/null +++ b/tests/t0501-objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 diff --git a/tests/t0501-objects/18/1037049a54a1eb5fab404658a3a250b44335d7 b/tests/t0501-objects/18/1037049a54a1eb5fab404658a3a250b44335d7 Binary files differnew file mode 100644 index 000000000..93a16f146 --- /dev/null +++ b/tests/t0501-objects/18/1037049a54a1eb5fab404658a3a250b44335d7 diff --git a/tests/t0501-objects/18/10dff58d8a660512d4832e740f692884338ccd b/tests/t0501-objects/18/10dff58d8a660512d4832e740f692884338ccd Binary files differnew file mode 100644 index 000000000..ba0bfb30c --- /dev/null +++ b/tests/t0501-objects/18/10dff58d8a660512d4832e740f692884338ccd diff --git a/tests/t0501-objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 b/tests/t0501-objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 Binary files differnew file mode 100644 index 000000000..7ca4ceed5 --- /dev/null +++ b/tests/t0501-objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 diff --git a/tests/t0501-objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045 b/tests/t0501-objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045 new file mode 100644 index 000000000..8953b6cef --- /dev/null +++ b/tests/t0501-objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045 @@ -0,0 +1,2 @@ +xQ +0D)6ͦ "xO-FbEo0Ǥ,ske[Pn8R,EpD?g}^3<GhYK8ЖDA);gݧjp4-r;sGA4ۺ=(in7IKFE
\ No newline at end of file diff --git a/tests/t0501-objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644 b/tests/t0501-objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644 new file mode 100644 index 000000000..c1f22c54f --- /dev/null +++ b/tests/t0501-objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644 @@ -0,0 +1,2 @@ +x 1ENi@k2 "X$YW0YcÅszMD08!sXgd::@X0Pw"F/RUzmZZV}|/o5I!1z:vUim}/> +F-
\ No newline at end of file diff --git a/tests/t0501-objects/75/057dd4114e74cca1d750d0aee1647c903cb60a b/tests/t0501-objects/75/057dd4114e74cca1d750d0aee1647c903cb60a Binary files differnew file mode 100644 index 000000000..2ef4faa0f --- /dev/null +++ b/tests/t0501-objects/75/057dd4114e74cca1d750d0aee1647c903cb60a diff --git a/tests/t0501-objects/81/4889a078c031f61ed08ab5fa863aea9314344d b/tests/t0501-objects/81/4889a078c031f61ed08ab5fa863aea9314344d Binary files differnew file mode 100644 index 000000000..2f9b6b6e3 --- /dev/null +++ b/tests/t0501-objects/81/4889a078c031f61ed08ab5fa863aea9314344d diff --git a/tests/t0501-objects/84/96071c1b46c854b31185ea97743be6a8774479 b/tests/t0501-objects/84/96071c1b46c854b31185ea97743be6a8774479 Binary files differnew file mode 100644 index 000000000..5df58dda5 --- /dev/null +++ b/tests/t0501-objects/84/96071c1b46c854b31185ea97743be6a8774479 diff --git a/tests/t0501-objects/9f/d738e8f7967c078dceed8190330fc8648ee56a b/tests/t0501-objects/9f/d738e8f7967c078dceed8190330fc8648ee56a new file mode 100644 index 000000000..a79612435 --- /dev/null +++ b/tests/t0501-objects/9f/d738e8f7967c078dceed8190330fc8648ee56a @@ -0,0 +1,3 @@ +x[ +0E*fդ "W0-Ft݁pS[Yx^ +Db CLhut}8X*4ZsYUA
X3RM) s6輢Mរ&Jm;}<\@ޏpĀv?jۺL?H
\ No newline at end of file diff --git a/tests/t0501-objects/a4/a7dce85cf63874e984719f4fdd239f5145052f b/tests/t0501-objects/a4/a7dce85cf63874e984719f4fdd239f5145052f new file mode 100644 index 000000000..f8588696b --- /dev/null +++ b/tests/t0501-objects/a4/a7dce85cf63874e984719f4fdd239f5145052f @@ -0,0 +1,2 @@ +x;j1Dmdǎ|M3`V{>QvL0I?!4Z=!צ8F!rsQy9]$D&l6A>jFWҵIKNiZ%S + U~̽>' w
[DGڡQ-M>dO}\8g_ШoYr
\ No newline at end of file diff --git a/tests/t0501-objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd b/tests/t0501-objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd Binary files differnew file mode 100644 index 000000000..d0d7e736e --- /dev/null +++ b/tests/t0501-objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd diff --git a/tests/t0501-objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 b/tests/t0501-objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 Binary files differnew file mode 100644 index 000000000..18a7f61c2 --- /dev/null +++ b/tests/t0501-objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 diff --git a/tests/t0501-objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644 b/tests/t0501-objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644 new file mode 100644 index 000000000..0817229bc --- /dev/null +++ b/tests/t0501-objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644 @@ -0,0 +1,3 @@ +xKj1D)zUB-0uV9<#+W<J&8/seȕKJS +Rv{QrYQN$H\E=6X5K Fr)(dCΆjs}9c-w8o\rI: +l}FW$DsǣٚOWe]V8-Ý"U
\ No newline at end of file diff --git a/tests/t0501-objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd b/tests/t0501-objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd new file mode 100644 index 000000000..75f541f10 --- /dev/null +++ b/tests/t0501-objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd @@ -0,0 +1,3 @@ +xQ +0D)ʦI<'lR+FjEo0<xha ]șXUlPF)z4y,\r 'S-mI4 +Xh&F}n+\Y-p|鷜oUz;-alt{?I,:oRcHK
\ No newline at end of file diff --git a/tests/t0501-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 b/tests/t0501-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 Binary files differnew file mode 100644 index 000000000..711223894 --- /dev/null +++ b/tests/t0501-objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tests/t0501-objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 b/tests/t0501-objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 Binary files differnew file mode 100644 index 000000000..03770969a --- /dev/null +++ b/tests/t0501-objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 diff --git a/tests/t0501-objects/fa/49b077972391ad58037050f2a75f74e3671e92 b/tests/t0501-objects/fa/49b077972391ad58037050f2a75f74e3671e92 Binary files differnew file mode 100644 index 000000000..112998d42 --- /dev/null +++ b/tests/t0501-objects/fa/49b077972391ad58037050f2a75f74e3671e92 diff --git a/tests/t0501-objects/fd/093bff70906175335656e6ce6ae05783708765 b/tests/t0501-objects/fd/093bff70906175335656e6ce6ae05783708765 Binary files differnew file mode 100644 index 000000000..12bf5f3e3 --- /dev/null +++ b/tests/t0501-objects/fd/093bff70906175335656e6ce6ae05783708765 diff --git a/tests/t0501-objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx b/tests/t0501-objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx Binary files differnew file mode 100644 index 000000000..94c3c71da --- /dev/null +++ b/tests/t0501-objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx diff --git a/tests/t0501-objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack b/tests/t0501-objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack Binary files differnew file mode 100644 index 000000000..74c7fe4f3 --- /dev/null +++ b/tests/t0501-objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack diff --git a/tests/t0501-walk.c b/tests/t0501-walk.c new file mode 100644 index 000000000..755a4f75d --- /dev/null +++ b/tests/t0501-walk.c @@ -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 |