Branch Coverage

lib/Text/KnuthPlass.xs
Criterion Covered Total %
branch 122 178 68.5


line true false branch
38 1364 0 IV infinity = ivHash(self, "infinity");
41 1262 102 NV width = nvHash(sum, "width") - nvHash(totals,"width");
1364 0 NV width = nvHash(sum, "width") - nvHash(totals,"width");
47 0 1364 NV linelength = SvNV(*av_fetch(linelengths, current_line <= ll ? current_line-1 : ll, 0));
1361 3 NV linelength = SvNV(*av_fetch(linelengths, current_line <= ll ? current_line-1 : ll, 0));
0 1361 NV linelength = SvNV(*av_fetch(linelengths, current_line <= ll ? current_line-1 : ll, 0));
0 3 NV linelength = SvNV(*av_fetch(linelengths, current_line <= ll ? current_line-1 : ll, 0));
53 1364 0 if (isPenalty(*av_fetch(nodes, end, 0))) {
394 970 if (isPenalty(*av_fetch(nodes, end, 0))) {
55 373 21 width += nvHash(SvRV(*av_fetch(nodes,end, 0)),"width");
58 1316 48 if (width < linelength) {
59 1310 6 stretch = nvHash(sum, "stretch") - nvHash(totals, "stretch");
1316 0 stretch = nvHash(sum, "stretch") - nvHash(totals, "stretch");
61 1104 212 if (stretch > 0) {
66 25 23 } else if (width > linelength) {
68 25 0 shrink = nvHash(sum, "shrink") - nvHash(totals, "shrink");
25 0 shrink = nvHash(sum, "shrink") - nvHash(totals, "shrink");
69 25 0 if (shrink > 0) {
80 157 0 IV infinity = ivHash(self, "infinity");
81 157 0 NV width = nvHash(sum, "width");
82 157 0 NV stretch = nvHash(sum, "stretch");
83 157 0 NV shrink = nvHash(sum, "shrink");
87 304 7 while (i < len) {
89 122 182 if (sv_derived_from(e, "Text::KnuthPlass::Glue")) {
90 49 73 width += nvHash(SvRV(e), "width");
91 119 3 stretch += nvHash(SvRV(e), "stretch");
92 119 3 shrink += nvHash(SvRV(e), "shrink");
93 32 150 } else if (sv_derived_from(e, "Text::KnuthPlass::Box") ||
32 0 } else if (sv_derived_from(e, "Text::KnuthPlass::Box") ||
94 32 0 (isPenalty(e) && ivHash(SvRV(e), "penalty") == -infinity
32 0 (isPenalty(e) && ivHash(SvRV(e), "penalty") == -infinity
0 32 (isPenalty(e) && ivHash(SvRV(e), "penalty") == -infinity
95 0 0 && i > index)) {
122 0 0 while (b) {
124 0 0 if (SvROK(b->totals)) {
130 0 0 if (b && b->totals) sv_free((SV*)b->totals);
0 0 if (b && b->totals) sv_free((SV*)b->totals);
131 0 0 if (b) Safefree(b);
135 139 18 if (!a->prev) { list->head = a->next; } else { a->prev->next = a->next; }
136 3 154 if (!a->next) { list->tail = a->prev; } else { a->next->prev = a->prev; }
166 3 3 for (b = activelist->head; b; b = b->next) {
167 0 3 if (!best || b->demerits < best->demerits) best = b;
0 0 if (!best || b->demerits < best->demerits) best = b;
169 15 3 while (best) {
173 0 15 XPUSHs(sv_2mortal(newRV((SV*)posnode)));
211 102 0 IV tolerance = ivHash(self, "tolerance");
212 102 0 IV infinity = ivHash(self, "infinity");
226 102 0 if (demerits_r && SvRV(demerits_r)) {
102 0 if (demerits_r && SvRV(demerits_r)) {
227 102 0 linedemerits = ivHash(SvRV(demerits_r), "line");
228 102 0 flaggeddemerits = ivHash(SvRV(demerits_r), "flagged");
229 102 0 fitnessdemerits = ivHash(SvRV(demerits_r), "fitness");
234 102 0 if (isPenalty(node)) {
21 81 if (isPenalty(node)) {
235 21 0 nodepenalty = SvIV(*hv_fetch((HV*)SvRV(node), "penalty", 7, TRUE));
238 117 102 while (active) {
243 1364 0 while (active) {
253 1211 153 if (ratio < 1 || (isPenalty(node) && nodepenalty == -infinity))
1211 0 if (ratio < 1 || (isPenalty(node) && nodepenalty == -infinity))
318 893 if (ratio < 1 || (isPenalty(node) && nodepenalty == -infinity))
4 314 if (ratio < 1 || (isPenalty(node) && nodepenalty == -infinity))
256 1352 12 if (-1 <= ratio && ratio <= tolerance) {
835 517 if (-1 <= ratio && ratio <= tolerance) {
260 835 0 if (isPenalty(node) && nodepenalty > 0) {
256 579 if (isPenalty(node) && nodepenalty > 0) {
204 52 if (isPenalty(node) && nodepenalty > 0) {
262 631 0 } else if (isPenalty(node) && nodepenalty != -infinity) {
52 579 } else if (isPenalty(node) && nodepenalty != -infinity) {
0 52 } else if (isPenalty(node) && nodepenalty != -infinity) {
268 835 0 if (isPenalty(node) && isPenalty(SvRV(nodeAtPos))) {
256 579 if (isPenalty(node) && isPenalty(SvRV(nodeAtPos))) {
0 256 if (isPenalty(node) && isPenalty(SvRV(nodeAtPos))) {
0 0 if (isPenalty(node) && isPenalty(SvRV(nodeAtPos))) {
270 0 0 ivHash(node, "flagged") *
271 0 0 ivHash(SvRV(nodeAtPos), "flagged"));
274 834 1 if (ratio < -0.5) current_class = 0;
275 724 110 else if (ratio <= 0.5) current_class = 1;
276 685 39 else if (ratio <= 1) current_class = 2;
279 242 593 if (abs(current_class - active->fitness_class) > 1)
284 678 157 if (!candidates[current_class] ||
138 540 if (!candidates[current_class] ||
287 157 138 if (!candidates[current_class])
295 1262 102 if (!active || active->line >= current_line)
1247 15 if (!active || active->line >= current_line)
301 468 117 for (t = 0; t <= 3; t++) {
302 157 311 if (candidates[t]) {
313 15 142 if (active) {
317 3 12 if (!active->prev) { activelist->head = newnode; }
323 3 139 if (!activelist->head) {