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");
46 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));
51 1364 0 if (isPenalty(*av_fetch(nodes, end, 0))) {
394 970 if (isPenalty(*av_fetch(nodes, end, 0))) {
53 373 21 width += nvHash(SvRV(*av_fetch(nodes,end, 0)),"width");
56 1316 48 if (width < linelength) {
57 1310 6 stretch = nvHash(sum, "stretch") - nvHash(totals, "stretch");
1316 0 stretch = nvHash(sum, "stretch") - nvHash(totals, "stretch");
59 1104 212 if (stretch > 0) {
64 25 23 } else if (width > linelength) {
66 25 0 shrink = nvHash(sum, "shrink") - nvHash(totals, "shrink");
25 0 shrink = nvHash(sum, "shrink") - nvHash(totals, "shrink");
67 25 0 if (shrink > 0) {
78 157 0 IV infinity = ivHash(self, "infinity");
79 157 0 NV width = nvHash(sum, "width");
80 157 0 NV stretch = nvHash(sum, "stretch");
81 157 0 NV shrink = nvHash(sum, "shrink");
85 304 7 while (i < len) {
87 122 182 if (sv_derived_from(e, "Text::KnuthPlass::Glue")) {
88 49 73 width += nvHash(SvRV(e), "width");
89 119 3 stretch += nvHash(SvRV(e), "stretch");
90 119 3 shrink += nvHash(SvRV(e), "shrink");
91 32 150 } else if (sv_derived_from(e, "Text::KnuthPlass::Box") ||
32 0 } else if (sv_derived_from(e, "Text::KnuthPlass::Box") ||
92 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
93 0 0 && i > index)) {
120 0 0 while (b) {
122 0 0 if (SvROK(b->totals)) {
128 0 0 if (b && b->totals) sv_free((SV*)b->totals);
0 0 if (b && b->totals) sv_free((SV*)b->totals);
129 0 0 if (b) Safefree(b);
133 139 18 if (!a->prev) { list->head = a->next; } else { a->prev->next = a->next; }
134 3 154 if (!a->next) { list->tail = a->prev; } else { a->next->prev = a->prev; }
164 3 3 for (b = activelist->head; b; b = b->next) {
165 0 3 if (!best || b->demerits < best->demerits) best = b;
0 0 if (!best || b->demerits < best->demerits) best = b;
167 15 3 while (best) {
171 0 15 XPUSHs(sv_2mortal(newRV((SV*)posnode)));
209 102 0 IV tolerance = ivHash(self, "tolerance");
210 102 0 IV infinity = ivHash(self, "infinity");
224 102 0 if (demerits_r && SvRV(demerits_r)) {
102 0 if (demerits_r && SvRV(demerits_r)) {
225 102 0 linedemerits = ivHash(SvRV(demerits_r), "line");
226 102 0 flaggeddemerits = ivHash(SvRV(demerits_r), "flagged");
227 102 0 fitnessdemerits = ivHash(SvRV(demerits_r), "fitness");
232 102 0 if (isPenalty(node)) {
21 81 if (isPenalty(node)) {
233 21 0 nodepenalty = SvIV(*hv_fetch((HV*)SvRV(node), "penalty", 7, TRUE));
236 117 102 while (active) {
241 1364 0 while (active) {
250 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))
253 1352 12 if (-1 <= ratio && ratio <= tolerance) {
835 517 if (-1 <= ratio && ratio <= tolerance) {
257 835 0 if (isPenalty(node) && nodepenalty > 0) {
256 579 if (isPenalty(node) && nodepenalty > 0) {
204 52 if (isPenalty(node) && nodepenalty > 0) {
259 631 0 } else if (isPenalty(node) && nodepenalty != -infinity) {
52 579 } else if (isPenalty(node) && nodepenalty != -infinity) {
0 52 } else if (isPenalty(node) && nodepenalty != -infinity) {
265 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))) {
267 0 0 ivHash(node, "flagged") *
268 0 0 ivHash(SvRV(nodeAtPos), "flagged"));
271 834 1 if (ratio < -0.5) current_class = 0;
272 724 110 else if (ratio <= 0.5) current_class = 1;
273 685 39 else if (ratio <= 1) current_class = 2;
276 242 593 if (abs(current_class - active->fitness_class) > 1)
281 678 157 if (!candidates[current_class] ||
138 540 if (!candidates[current_class] ||
284 157 138 if (!candidates[current_class])
292 1262 102 if (!active || active->line >= current_line)
1247 15 if (!active || active->line >= current_line)
298 468 117 for (t = 0; t <= 3; t++) {
299 157 311 if (candidates[t]) {
310 15 142 if (active) {
314 3 12 if (!active->prev) { activelist->head = newnode; }
320 3 139 if (!activelist->head) {