Branch Coverage

lib/Text/KnuthPlass.xs
Criterion Covered Total %
branch 129 178 72.4


line true false branch
40 5384 0 IV infinity = ivHash(self, "infinity"); // $self->{'infinity'}
43 5237 147 NV width = nvHash(sum, "width") - nvHash(totals,"width");
5384 0 NV width = nvHash(sum, "width") - nvHash(totals,"width");
49 923 4461 NV linelength = SvNV(*av_fetch(linelengths, current_line <= ll ? current_line-1 : ll, 0));
5373 11 NV linelength = SvNV(*av_fetch(linelengths, current_line <= ll ? current_line-1 : ll, 0));
916 4457 NV linelength = SvNV(*av_fetch(linelengths, current_line <= ll ? current_line-1 : ll, 0));
7 4 NV linelength = SvNV(*av_fetch(linelengths, current_line <= ll ? current_line-1 : ll, 0));
55 5384 0 if (isPenalty(*av_fetch(nodes, end, 0))) {
1839 3545 if (isPenalty(*av_fetch(nodes, end, 0))) {
57 1807 32 width += nvHash(SvRV(*av_fetch(nodes,end, 0)),"width");
61 4075 1309 if (width < linelength) {
62 4068 7 stretch = nvHash(sum, "stretch") - nvHash(totals, "stretch");
4075 0 stretch = nvHash(sum, "stretch") - nvHash(totals, "stretch");
64 3264 811 if (stretch > 0) {
69 1243 66 } else if (width > linelength) {
71 1213 30 shrink = nvHash(sum, "shrink") - nvHash(totals, "shrink");
1243 0 shrink = nvHash(sum, "shrink") - nvHash(totals, "shrink");
72 36 1207 if (shrink > 0) {
84 586 0 IV infinity = ivHash(self, "infinity");
85 586 0 NV width = nvHash(sum, "width");
86 586 0 NV stretch = nvHash(sum, "stretch");
87 583 3 NV shrink = nvHash(sum, "shrink");
91 1106 45 while (i < len) {
93 411 695 if (sv_derived_from(e, "Text::KnuthPlass::Glue")) {
94 306 105 width += nvHash(SvRV(e), "width");
95 407 4 stretch += nvHash(SvRV(e), "stretch");
96 376 35 shrink += nvHash(SvRV(e), "shrink");
97 154 541 } else if (sv_derived_from(e, "Text::KnuthPlass::Box") ||
154 0 } else if (sv_derived_from(e, "Text::KnuthPlass::Box") ||
98 154 0 (isPenalty(e) && ivHash(SvRV(e), "penalty") == -infinity
154 0 (isPenalty(e) && ivHash(SvRV(e), "penalty") == -infinity
0 154 (isPenalty(e) && ivHash(SvRV(e), "penalty") == -infinity
99 0 0 && i > index)) {
126 0 0 while (b) {
128 0 0 if (SvROK(b->totals)) {
134 0 0 if (b && b->totals) sv_free((SV*)b->totals);
0 0 if (b && b->totals) sv_free((SV*)b->totals);
135 0 0 if (b) Safefree(b);
139 111 458 if (!a->prev) { list->head = a->next; } else { a->prev->next = a->next; }
140 4 565 if (!a->next) { list->tail = a->prev; } else { a->next->prev = a->prev; }
172 21 4 for (b = activelist->head; b; b = b->next) {
173 17 4 if (!best || b->demerits < best->demerits) best = b;
0 17 if (!best || b->demerits < best->demerits) best = b;
175 26 4 while (best) {
179 0 26 XPUSHs(sv_2mortal(newRV((SV*)posnode)));
219 147 0 IV tolerance = ivHash(self, "tolerance");
220 147 0 IV infinity = ivHash(self, "infinity");
234 147 0 if (demerits_r && SvRV(demerits_r)) {
147 0 if (demerits_r && SvRV(demerits_r)) {
235 147 0 linedemerits = ivHash(SvRV(demerits_r), "line");
236 147 0 flaggeddemerits = ivHash(SvRV(demerits_r), "flagged");
237 147 0 fitnessdemerits = ivHash(SvRV(demerits_r), "fitness");
242 147 0 if (isPenalty(node)) {
32 115 if (isPenalty(node)) {
243 32 0 nodepenalty = SvIV(*hv_fetch((HV*)SvRV(node), "penalty", 7, TRUE));
246 697 147 while (active) {
251 5384 0 while (active) {
263 4918 466 if (ratio < 1 || (isPenalty(node) && nodepenalty == -infinity)) {
4918 0 if (ratio < 1 || (isPenalty(node) && nodepenalty == -infinity)) {
1530 3388 if (ratio < 1 || (isPenalty(node) && nodepenalty == -infinity)) {
103 1427 if (ratio < 1 || (isPenalty(node) && nodepenalty == -infinity)) {
268 5364 20 if (-1 <= ratio && ratio <= tolerance) {
2439 2925 if (-1 <= ratio && ratio <= tolerance) {
272 2439 0 if (isPenalty(node) && nodepenalty > 0) {
917 1522 if (isPenalty(node) && nodepenalty > 0) {
688 229 if (isPenalty(node) && nodepenalty > 0) {
274 1751 0 } else if (isPenalty(node) && nodepenalty != -infinity) {
229 1522 } else if (isPenalty(node) && nodepenalty != -infinity) {
0 229 } else if (isPenalty(node) && nodepenalty != -infinity) {
280 2439 0 if (isPenalty(node) && isPenalty(SvRV(nodeAtPos))) {
917 1522 if (isPenalty(node) && isPenalty(SvRV(nodeAtPos))) {
0 917 if (isPenalty(node) && isPenalty(SvRV(nodeAtPos))) {
0 0 if (isPenalty(node) && isPenalty(SvRV(nodeAtPos))) {
282 0 0 ivHash(node, "flagged") *
283 0 0 ivHash(SvRV(nodeAtPos), "flagged"));
286 2437 2 if (ratio < -0.5) current_class = 0; // tight
287 2073 364 else if (ratio <= 0.5) current_class = 1; // normal
288 1956 117 else if (ratio <= 1) current_class = 2; // loose
291 594 1845 if (abs(current_class - active->fitness_class) > 1)
296 1853 586 if (!candidates[current_class] ||
808 1045 if (!candidates[current_class] ||
299 586 808 if (!candidates[current_class])
307 5237 147 if (!active || active->line >= current_line)
4687 550 if (!active || active->line >= current_line)
313 2788 697 for (t = 0; t <= 3; t++) {
314 586 2202 if (candidates[t]) {
325 547 39 if (active) {
329 14 533 if (!active->prev) { activelist->head = newnode; }
335 0 39 if (!activelist->head) {