diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2025-03-23 15:36:22 +0100 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-03-23 15:36:22 +0100 |
| commit | 085906735bbadeb8e6cd47fc11610fe104080032 (patch) | |
| tree | 3ae60b6feb86e24efa3bdb0fcad28ccbd9564725 /test | |
| parent | 50da512936a9af6ad9aa808531af8f316a381dd4 (diff) | |
Add some cost calculation
Diffstat (limited to 'test')
| -rw-r--r-- | test/contrained.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test/contrained.c b/test/contrained.c index 1af01a8..37fae1d 100644 --- a/test/contrained.c +++ b/test/contrained.c @@ -277,5 +277,60 @@ int main(int argc, char **argv) { ); } + { + struct Tree a = { + .adj = { + .data = (nid[]){2, 0}, + .stride = 1, + }, + .len = 2, + }; + + struct Tree b = { + .adj = { + .data = (nid[]){2, 3, 0}, + .stride = 1, + }, + .len = 3, + }; + + DECL_MAT_DATA(cost, uint32_t, 3, 4, + 0, 2, 2, + 2, 0, 2, + 2, 2, 2, + 2, 2, 0, + ); + DECL_MAT(cost_n, uint32_t, 3, 4); + DECL_MAT(cost_f, uint32_t, 3, 4); + DECL_MAT(cost_s, uint32_t, 3, 2); + + constrained_tree_distance( + a, + b, + cost, + cost_n, + cost_f, + cost_s + ); + + if(*imat_uint32_t(cost_n, 1, 1) != 2) { + log("Test Fail\n"); + return 1; + } + + DECL_MAT(alignment, uint32_t, 2, 2); + uint32_t adj_alignment[2] = {0, 0}; + constrained_tree_alignment( + a, + b, + cost, + cost_n, + cost_f, + cost_s, + adj_alignment, + alignment + ); + } + return 0; } |
