1 | package com.github.dakusui.pcond.validator; | |
2 | ||
3 | import com.github.dakusui.pcond.core.DebuggingUtils; | |
4 | import com.github.dakusui.pcond.core.EvaluationEntry; | |
5 | import com.github.dakusui.pcond.fluent.ValueHolder; | |
6 | import com.github.dakusui.pcond.internals.InternalUtils; | |
7 | ||
8 | import java.util.*; | |
9 | import java.util.concurrent.atomic.AtomicInteger; | |
10 | import java.util.concurrent.atomic.AtomicReference; | |
11 | import java.util.function.Function; | |
12 | import java.util.function.Supplier; | |
13 | ||
14 | import static com.github.dakusui.pcond.internals.InternalUtils.*; | |
15 | import static java.lang.Math.max; | |
16 | import static java.lang.Math.min; | |
17 | import static java.lang.String.format; | |
18 | import static java.util.Collections.emptyList; | |
19 | import static java.util.Collections.unmodifiableList; | |
20 | import static java.util.stream.Collectors.joining; | |
21 | import static java.util.stream.Collectors.toList; | |
22 | ||
23 | public interface ReportComposer { | |
24 | default Explanation explanationFromMessage(String msg) { | |
25 |
1
1. explanationFromMessage : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer::explanationFromMessage → KILLED |
return Explanation.fromMessage(msg); |
26 | } | |
27 | | |
28 | default Explanation composeExplanation(String message, List<EvaluationEntry> evaluationEntries) { | |
29 |
1
1. composeExplanation : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer::composeExplanation → KILLED |
return Utils.composeExplanation(this, message, evaluationEntries); |
30 | } | |
31 | | |
32 | default FormattedEntry createFormattedEntryForExpectation(EvaluationEntry evaluationEntry) { | |
33 |
1
1. createFormattedEntryForExpectation : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer::createFormattedEntryForExpectation → KILLED |
return Utils.createFormattedEntryForExpectation(this, evaluationEntry); |
34 | } | |
35 | | |
36 | default FormattedEntry createFormattedEntryForActualValue(EvaluationEntry evaluationEntry) { | |
37 |
1
1. createFormattedEntryForActualValue : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer::createFormattedEntryForActualValue → KILLED |
return Utils.createFormattedEntryForActualValue(this, evaluationEntry); |
38 | } | |
39 | | |
40 | default boolean requiresExplanation(EvaluationEntry evaluationEntry) { | |
41 |
2
1. requiresExplanation : replaced boolean return with false for com/github/dakusui/pcond/validator/ReportComposer::requiresExplanation → KILLED 2. requiresExplanation : replaced boolean return with true for com/github/dakusui/pcond/validator/ReportComposer::requiresExplanation → KILLED |
return evaluationEntry.requiresExplanation(); |
42 | } | |
43 | | |
44 | /** | |
45 | * A default implementation of `ReportComposer`. | |
46 | */ | |
47 | class Default implements ReportComposer { | |
48 | } | |
49 | | |
50 | interface Report { | |
51 | String summary(); | |
52 | | |
53 | List<String> details(); | |
54 | | |
55 | static Report create(String summary, List<String> details) { | |
56 | List<String> detailsCopy = unmodifiableList(new ArrayList<>(details)); | |
57 |
1
1. create : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Report::create → KILLED |
return new Report() { |
58 | @Override | |
59 | public String summary() { | |
60 |
1
1. summary : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Report$1::summary → KILLED |
return summary; |
61 | } | |
62 | | |
63 | @Override | |
64 | public List<String> details() { | |
65 |
1
1. details : replaced return value with Collections.emptyList for com/github/dakusui/pcond/validator/ReportComposer$Report$1::details → KILLED |
return detailsCopy; |
66 | } | |
67 | }; | |
68 | } | |
69 | } | |
70 | | |
71 | class FormattedEntry { | |
72 | private final String input; | |
73 | private final String formName; | |
74 | private final String indent; | |
75 | private final String output; | |
76 | private final boolean requiresExplanation; | |
77 | | |
78 | public FormattedEntry(String input, String formName, String indent, String output, boolean requiresExplanation) { | |
79 | this.input = input; | |
80 | this.formName = formName; | |
81 | this.indent = indent; | |
82 | this.output = output; | |
83 | this.requiresExplanation = requiresExplanation; | |
84 | } | |
85 | | |
86 | Optional<String> input() { | |
87 |
1
1. input : replaced return value with Optional.empty for com/github/dakusui/pcond/validator/ReportComposer$FormattedEntry::input → KILLED |
return Optional.ofNullable(this.input); |
88 | } | |
89 | | |
90 | String indent() { | |
91 |
1
1. indent : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$FormattedEntry::indent → KILLED |
return this.indent; |
92 | } | |
93 | | |
94 | String formName() { | |
95 |
1
1. formName : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$FormattedEntry::formName → KILLED |
return this.formName; |
96 | } | |
97 | | |
98 | Optional<String> output() { | |
99 |
1
1. output : replaced return value with Optional.empty for com/github/dakusui/pcond/validator/ReportComposer$FormattedEntry::output → KILLED |
return Optional.ofNullable(this.output); |
100 | } | |
101 | | |
102 | public boolean requiresExplanation() { | |
103 |
2
1. requiresExplanation : replaced boolean return with false for com/github/dakusui/pcond/validator/ReportComposer$FormattedEntry::requiresExplanation → KILLED 2. requiresExplanation : replaced boolean return with true for com/github/dakusui/pcond/validator/ReportComposer$FormattedEntry::requiresExplanation → KILLED |
return this.requiresExplanation; |
104 | } | |
105 | } | |
106 | | |
107 | enum Utils { | |
108 | ; | |
109 | | |
110 | /** | |
111 | * Note that an exception thrown during an evaluation is normally caught by the framework. | |
112 | * | |
113 | * @param message A message to be prepended to a summary. | |
114 | * @param evaluationHistory An "evaluation history" object represented as a list of evaluation entries. | |
115 | * @return An explanation object. | |
116 | */ | |
117 | public static Explanation composeExplanation(ReportComposer reportComposer, String message, List<EvaluationEntry> evaluationHistory) { | |
118 | List<Object> detailsForExpectation = new LinkedList<>(); | |
119 | List<ReportComposer.FormattedEntry> summaryDataForExpectations = squashTrivialEntries(reportComposer, evaluationHistory) | |
120 | .stream() | |
121 |
1
1. lambda$composeExplanation$0 : removed call to com/github/dakusui/pcond/validator/ReportComposer$Utils::addToDetailsListIfExplanationIsRequired → KILLED |
.peek((EvaluationEntry each) -> addToDetailsListIfExplanationIsRequired(reportComposer, detailsForExpectation, each, each::detailOutputExpectation)) |
122 | .map(reportComposer::createFormattedEntryForExpectation) | |
123 | .collect(toList()); | |
124 | String textSummaryForExpectations = composeSummaryForExpectations(minimizeIndentation(summaryDataForExpectations)); | |
125 | List<Object> detailsForActual = new LinkedList<>(); | |
126 | List<ReportComposer.FormattedEntry> summaryForActual = squashTrivialEntries(reportComposer, evaluationHistory) | |
127 | .stream() | |
128 |
1
1. lambda$composeExplanation$1 : removed call to com/github/dakusui/pcond/validator/ReportComposer$Utils::addToDetailsListIfExplanationIsRequired → KILLED |
.peek((EvaluationEntry each) -> addToDetailsListIfExplanationIsRequired(reportComposer, detailsForActual, each, each::detailOutputActualValue)) |
129 | .map(reportComposer::createFormattedEntryForActualValue) | |
130 | .collect(toList()); | |
131 | String textSummaryForActualResult = composeSummaryForActualResults(minimizeIndentation(summaryForActual)); | |
132 |
1
1. composeExplanation : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::composeExplanation → KILLED |
return new Explanation(message, |
133 | composeReport(textSummaryForExpectations, detailsForExpectation), | |
134 | composeReport(textSummaryForActualResult, detailsForActual)); | |
135 | } | |
136 | | |
137 | public static ReportComposer.FormattedEntry createFormattedEntryForExpectation(ReportComposer reportComposer, EvaluationEntry entry) { | |
138 |
1
1. createFormattedEntryForExpectation : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::createFormattedEntryForExpectation → KILLED |
return new ReportComposer.FormattedEntry( |
139 | formatObject(entry.inputExpectation()), | |
140 | entry.formName(), | |
141 | indent(entry.level()), | |
142 | formatObject(entry.outputExpectation()), | |
143 | reportComposer.requiresExplanation(entry)); | |
144 | } | |
145 | | |
146 | public static ReportComposer.FormattedEntry createFormattedEntryForActualValue(ReportComposer reportComposer, EvaluationEntry entry) { | |
147 |
1
1. createFormattedEntryForActualValue : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::createFormattedEntryForActualValue → KILLED |
return new ReportComposer.FormattedEntry( |
148 | formatObject(entry.inputActualValue()), | |
149 | entry.formName(), | |
150 | indent(entry.level()), | |
151 | formatObject(entry.outputActualValue()), | |
152 | reportComposer.requiresExplanation(entry)); | |
153 | } | |
154 | | |
155 | private static List<FormattedEntry> minimizeIndentation(List<FormattedEntry> summaryForActual) { | |
156 | String minIndent = summaryForActual.stream() | |
157 |
1
1. lambda$minimizeIndentation$2 : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$minimizeIndentation$2 → SURVIVED |
.map(e -> e.indent) |
158 | .min(Comparator.comparingInt(String::length)) | |
159 | .orElse(""); | |
160 |
1
1. minimizeIndentation : replaced return value with Collections.emptyList for com/github/dakusui/pcond/validator/ReportComposer$Utils::minimizeIndentation → KILLED |
return summaryForActual.stream() |
161 |
1
1. lambda$minimizeIndentation$3 : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$minimizeIndentation$3 → KILLED |
.map(e -> new ReportComposer.FormattedEntry(e.input, e.formName(), e.indent().replaceFirst(minIndent, ""), e.output, e.requiresExplanation())) |
162 | .collect(toList()); | |
163 | } | |
164 | | |
165 | private static List<EvaluationEntry> squashTrivialEntries(ReportComposer reportComposer, List<EvaluationEntry> evaluationHistory) { | |
166 |
2
1. squashTrivialEntries : changed conditional boundary → SURVIVED 2. squashTrivialEntries : negated conditional → KILLED |
if (evaluationHistory.size() > 1) { |
167 | List<EvaluationEntry> ret = new LinkedList<>(); | |
168 | List<EvaluationEntry> entriesToSquash = new LinkedList<>(); | |
169 | AtomicReference<EvaluationEntry> cur = new AtomicReference<>(); | |
170 | evaluationHistory.stream() | |
171 |
3
1. lambda$squashTrivialEntries$4 : negated conditional → KILLED 2. lambda$squashTrivialEntries$4 : negated conditional → KILLED 3. lambda$squashTrivialEntries$4 : replaced boolean return with true for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$squashTrivialEntries$4 → KILLED |
.filter(each -> !each.ignored() || DebuggingUtils.reportIgnoredEntries()) |
172 | .filter(each -> { | |
173 |
1
1. lambda$squashTrivialEntries$5 : negated conditional → KILLED |
if (cur.get() != null) |
174 |
1
1. lambda$squashTrivialEntries$5 : replaced boolean return with false for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$squashTrivialEntries$5 → KILLED |
return true; |
175 | else { | |
176 |
1
1. lambda$squashTrivialEntries$5 : removed call to java/util/concurrent/atomic/AtomicReference::set → KILLED |
cur.set(each); |
177 |
1
1. lambda$squashTrivialEntries$5 : replaced boolean return with true for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$squashTrivialEntries$5 → KILLED |
return false; |
178 | } | |
179 | }) | |
180 |
1
1. squashTrivialEntries : removed call to java/util/stream/Stream::forEach → KILLED |
.forEach(each -> { |
181 |
1
1. lambda$squashTrivialEntries$6 : negated conditional → KILLED |
if (entriesToSquash.isEmpty()) { |
182 |
2
1. lambda$squashTrivialEntries$6 : negated conditional → KILLED 2. lambda$squashTrivialEntries$6 : negated conditional → KILLED |
if (cur.get().isSquashable(each) && !suppressSquashing()) { |
183 | entriesToSquash.add(cur.get()); | |
184 | } else { | |
185 | ret.add(cur.get()); | |
186 | } | |
187 | } else { | |
188 | entriesToSquash.add(cur.get()); | |
189 | ret.add(squashEntries(reportComposer, entriesToSquash)); | |
190 |
1
1. lambda$squashTrivialEntries$6 : removed call to java/util/List::clear → KILLED |
entriesToSquash.clear(); |
191 | } | |
192 |
1
1. lambda$squashTrivialEntries$6 : removed call to java/util/concurrent/atomic/AtomicReference::set → KILLED |
cur.set(each); |
193 | }); | |
194 |
1
1. squashTrivialEntries : removed call to com/github/dakusui/pcond/validator/ReportComposer$Utils::finishLeftOverEntries → KILLED |
finishLeftOverEntries(reportComposer, ret, entriesToSquash, cur); |
195 |
1
1. squashTrivialEntries : replaced return value with Collections.emptyList for com/github/dakusui/pcond/validator/ReportComposer$Utils::squashTrivialEntries → KILLED |
return ret.stream() |
196 |
2
1. lambda$squashTrivialEntries$7 : negated conditional → KILLED 2. lambda$squashTrivialEntries$7 : replaced boolean return with true for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$squashTrivialEntries$7 → KILLED |
.filter(e -> !(e.inputActualValue() instanceof ValueHolder)) |
197 | .collect(toList()); | |
198 | } else { | |
199 |
1
1. squashTrivialEntries : replaced return value with Collections.emptyList for com/github/dakusui/pcond/validator/ReportComposer$Utils::squashTrivialEntries → KILLED |
return new ArrayList<>(evaluationHistory); |
200 | } | |
201 | } | |
202 | | |
203 | private static void finishLeftOverEntries(ReportComposer reportComposer, List<EvaluationEntry> out, List<EvaluationEntry> leftOverEntriesToSquash, AtomicReference<EvaluationEntry> leftOver) { | |
204 |
4
1. finishLeftOverEntries : Replaced integer subtraction with addition → KILLED 2. finishLeftOverEntries : negated conditional → KILLED 3. finishLeftOverEntries : negated conditional → KILLED 4. finishLeftOverEntries : negated conditional → KILLED |
if (!leftOverEntriesToSquash.isEmpty() && leftOverEntriesToSquash.get(leftOverEntriesToSquash.size() - 1).isSquashable(leftOver.get()) && !suppressSquashing()) { |
205 | leftOverEntriesToSquash.add(leftOver.get()); | |
206 | out.add(squashEntries(reportComposer, leftOverEntriesToSquash)); | |
207 | } else { | |
208 |
1
1. finishLeftOverEntries : negated conditional → KILLED |
if (!leftOverEntriesToSquash.isEmpty()) |
209 | out.add(squashEntries(reportComposer, leftOverEntriesToSquash)); | |
210 | out.add(leftOver.get()); | |
211 | } | |
212 | } | |
213 | | |
214 | private static EvaluationEntry squashEntries(ReportComposer reportComposer, List<EvaluationEntry> squashedItems) { | |
215 | EvaluationEntry first = squashedItems.get(0); | |
216 |
1
1. squashEntries : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::squashEntries → KILLED |
return EvaluationEntry.create( |
217 | squashedItems.stream() | |
218 |
1
1. lambda$squashEntries$8 : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$squashEntries$8 → KILLED |
.map(e -> (EvaluationEntry.Impl) e) |
219 | .map(EvaluationEntry::formName) | |
220 | .collect(joining(":")), | |
221 | first.type(), | |
222 | first.level(), | |
223 | first.inputExpectation(), first.detailInputExpectation(), | |
224 | first.outputExpectation(), computeDetailOutputExpectationFromSquashedItems(squashedItems), | |
225 | first.inputActualValue(), null, | |
226 |
1
1. squashEntries : Replaced integer subtraction with addition → KILLED |
first.outputActualValue(), squashedItems.get(squashedItems.size() - 1).detailOutputActualValue(), |
227 | false, | |
228 | squashedItems.stream().anyMatch(reportComposer::requiresExplanation), false); | |
229 | } | |
230 | | |
231 | @SuppressWarnings("BooleanMethodIsAlwaysInverted") | |
232 | private static boolean suppressSquashing() { | |
233 |
2
1. suppressSquashing : replaced boolean return with false for com/github/dakusui/pcond/validator/ReportComposer$Utils::suppressSquashing → SURVIVED 2. suppressSquashing : replaced boolean return with true for com/github/dakusui/pcond/validator/ReportComposer$Utils::suppressSquashing → KILLED |
return DebuggingUtils.suppressSquashing(); |
234 | } | |
235 | | |
236 | private static String computeDetailOutputExpectationFromSquashedItems(List<EvaluationEntry> squashedItems) { | |
237 |
1
1. computeDetailOutputExpectationFromSquashedItems : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Utils::computeDetailOutputExpectationFromSquashedItems → KILLED |
return squashedItems.stream() |
238 |
3
1. lambda$computeDetailOutputExpectationFromSquashedItems$9 : negated conditional → KILLED 2. lambda$computeDetailOutputExpectationFromSquashedItems$9 : negated conditional → KILLED 3. lambda$computeDetailOutputExpectationFromSquashedItems$9 : replaced boolean return with true for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$computeDetailOutputExpectationFromSquashedItems$9 → KILLED |
.filter(e -> e.type() != EvaluationEntry.Type.TRANSFORM && e.type() != EvaluationEntry.Type.CHECK) |
239 | .map(EvaluationEntry::detailOutputExpectation) | |
240 | .map(Objects::toString) | |
241 | .collect(joining(":")); | |
242 | } | |
243 | | |
244 | private static void addToDetailsListIfExplanationIsRequired(ReportComposer reportComposer, List<Object> detailsForExpectation, EvaluationEntry evaluationEntry, Supplier<Object> detailOutput) { | |
245 |
1
1. addToDetailsListIfExplanationIsRequired : negated conditional → KILLED |
if (reportComposer.requiresExplanation(evaluationEntry)) |
246 | detailsForExpectation.add(detailOutput.get()); | |
247 | } | |
248 | | |
249 | static Report composeReport(String summary, List<Object> details) { | |
250 |
1
1. composeReport : negated conditional → KILLED |
List<String> stringFormDetails = details != null ? |
251 | details.stream() | |
252 | .filter(Objects::nonNull) | |
253 | .map(Objects::toString) | |
254 | .collect(toList()) : | |
255 | emptyList(); | |
256 |
1
1. composeReport : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::composeReport → KILLED |
return ReportComposer.Report.create(summary, stringFormDetails); |
257 | } | |
258 | | |
259 | private static String composeSummaryForActualResults(List<ReportComposer.FormattedEntry> formattedEntries) { | |
260 |
1
1. composeSummaryForActualResults : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Utils::composeSummaryForActualResults → KILLED |
return composeSummary(formattedEntries); |
261 | } | |
262 | | |
263 | private static String composeSummaryForExpectations(List<ReportComposer.FormattedEntry> formattedEntries) { | |
264 |
1
1. composeSummaryForExpectations : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Utils::composeSummaryForExpectations → KILLED |
return composeSummaryForActualResults(formattedEntries); |
265 | } | |
266 | | |
267 | private static String composeSummary(List<ReportComposer.FormattedEntry> formattedEntries) { | |
268 | AtomicInteger mismatchExplanationCount = new AtomicInteger(0); | |
269 | boolean mismatchExplanationFound = formattedEntries | |
270 | .stream() | |
271 | .anyMatch(ReportComposer.FormattedEntry::requiresExplanation); | |
272 |
1
1. composeSummary : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Utils::composeSummary → KILLED |
return evaluatorEntriesToString( |
273 | hideInputValuesWhenRepeated(formattedEntries), | |
274 |
1
1. lambda$composeSummary$10 : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$composeSummary$10 → KILLED |
columnLengths -> formattedEntryToString( |
275 | columnLengths[0], | |
276 | columnLengths[1], | |
277 | columnLengths[2], | |
278 | mismatchExplanationCount, | |
279 | mismatchExplanationFound)); | |
280 | } | |
281 | | |
282 | private static Function<ReportComposer.FormattedEntry, String> formattedEntryToString( | |
283 | int inputColumnWidth, | |
284 | int formNameColumnLength, | |
285 | int outputColumnLength, | |
286 | AtomicInteger i, | |
287 | boolean mismatchExplanationFound) { | |
288 |
1
1. formattedEntryToString : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::formattedEntryToString → KILLED |
return (ReportComposer.FormattedEntry formattedEntry) -> |
289 |
2
1. lambda$formattedEntryToString$13 : negated conditional → KILLED 2. lambda$formattedEntryToString$13 : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$formattedEntryToString$13 → KILLED |
(mismatchExplanationFound ? |
290 |
1
1. lambda$formattedEntryToString$13 : negated conditional → KILLED |
format("%-4s", formattedEntry.requiresExplanation ? |
291 | "[" + i.getAndIncrement() + "]" : "") : | |
292 | "") + | |
293 |
1
1. lambda$formattedEntryToString$13 : Replaced integer addition with subtraction → SURVIVED |
format("%-" + max(2, inputColumnWidth) + "s" + |
294 | "%-" + (formNameColumnLength + 2) + "s" + | |
295 | "%-" + max(2, outputColumnLength) + "s", | |
296 | formattedEntry.input().orElse(""), | |
297 | formattedEntry.input() | |
298 |
1
1. lambda$null$11 : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$null$11 → KILLED |
.map(v -> "->") |
299 |
1
1. lambda$formattedEntryToString$13 : Replaced integer subtraction with addition → SURVIVED |
.orElse(" ") + formatObject(InternalUtils.toNonStringObject(formattedEntry.indent() + formattedEntry.formName()), formNameColumnLength - 2), |
300 | formattedEntry | |
301 | .output() | |
302 |
1
1. lambda$null$12 : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$null$12 → KILLED |
.map(v -> "->" + v).orElse("")); |
303 | } | |
304 | | |
305 | private static String evaluatorEntriesToString(List<ReportComposer.FormattedEntry> formattedEntries, Function<int[], Function<ReportComposer.FormattedEntry, String>> formatterFactory) { | |
306 | int maxInputLength = 0, maxIndentAndFormNameLength = 0, maxOutputLength = 0; | |
307 | for (ReportComposer.FormattedEntry eachEntry : formattedEntries) { | |
308 | int inputLength = eachEntry.input().map(String::length).orElse(0); | |
309 |
2
1. evaluatorEntriesToString : changed conditional boundary → SURVIVED 2. evaluatorEntriesToString : negated conditional → SURVIVED |
if (inputLength > maxInputLength) |
310 | maxInputLength = inputLength; | |
311 |
1
1. evaluatorEntriesToString : Replaced integer addition with subtraction → KILLED |
int inputAndFormNameLength = eachEntry.indent().length() + eachEntry.formName().length(); |
312 |
2
1. evaluatorEntriesToString : changed conditional boundary → SURVIVED 2. evaluatorEntriesToString : negated conditional → KILLED |
if (inputAndFormNameLength > maxIndentAndFormNameLength) |
313 | maxIndentAndFormNameLength = inputAndFormNameLength; | |
314 | int outputLength = eachEntry.output().map(String::length).orElse(0); | |
315 |
2
1. evaluatorEntriesToString : changed conditional boundary → SURVIVED 2. evaluatorEntriesToString : negated conditional → SURVIVED |
if (outputLength > maxOutputLength) |
316 | maxOutputLength = outputLength; | |
317 | } | |
318 |
2
1. evaluatorEntriesToString : Replaced integer modulus with multiplication → KILLED 2. evaluatorEntriesToString : Replaced integer addition with subtraction → KILLED |
int formNameColumnLength = (formNameColumnLength = max( |
319 |
1
1. evaluatorEntriesToString : negated conditional → KILLED |
DebuggingUtils.showEvaluableDetail() ? 80 : 12, |
320 | min(summarizedStringLength(), maxIndentAndFormNameLength))) + formNameColumnLength % 2; | |
321 | Function<ReportComposer.FormattedEntry, String> formatter = formatterFactory.apply( | |
322 | new int[] { maxInputLength, formNameColumnLength, maxOutputLength }); | |
323 |
1
1. evaluatorEntriesToString : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Utils::evaluatorEntriesToString → KILLED |
return formattedEntries |
324 | .stream() | |
325 | .map(formatter) | |
326 |
1
1. lambda$evaluatorEntriesToString$14 : replaced return value with "" for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$evaluatorEntriesToString$14 → KILLED |
.map(s -> ("+" + s).trim().substring(1)) |
327 | .collect(joining(format("%n"))); | |
328 | } | |
329 | | |
330 | private static List<ReportComposer.FormattedEntry> hideInputValuesWhenRepeated(List<ReportComposer.FormattedEntry> formattedEntries) { | |
331 | AtomicReference<Object> previousInput = new AtomicReference<>(); | |
332 |
1
1. hideInputValuesWhenRepeated : replaced return value with Collections.emptyList for com/github/dakusui/pcond/validator/ReportComposer$Utils::hideInputValuesWhenRepeated → KILLED |
return formattedEntries.stream() |
333 | .map(each -> { | |
334 |
1
1. lambda$hideInputValuesWhenRepeated$15 : negated conditional → KILLED |
if (!Objects.equals(previousInput.get(), each.input())) { |
335 |
1
1. lambda$hideInputValuesWhenRepeated$15 : removed call to java/util/concurrent/atomic/AtomicReference::set → KILLED |
previousInput.set(each.input()); |
336 |
1
1. lambda$hideInputValuesWhenRepeated$15 : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$hideInputValuesWhenRepeated$15 → KILLED |
return each; |
337 | } else { | |
338 |
1
1. lambda$hideInputValuesWhenRepeated$15 : replaced return value with null for com/github/dakusui/pcond/validator/ReportComposer$Utils::lambda$hideInputValuesWhenRepeated$15 → KILLED |
return new ReportComposer.FormattedEntry("", each.formName(), each.indent(), each.output().orElse(null), each.requiresExplanation()); |
339 | } | |
340 | }) | |
341 | .collect(toList()); | |
342 | } | |
343 | | |
344 | | |
345 | } | |
346 | } | |
Mutations | ||
25 |
1.1 |
|
29 |
1.1 |
|
33 |
1.1 |
|
37 |
1.1 |
|
41 |
1.1 2.2 |
|
57 |
1.1 |
|
60 |
1.1 |
|
65 |
1.1 |
|
87 |
1.1 |
|
91 |
1.1 |
|
95 |
1.1 |
|
99 |
1.1 |
|
103 |
1.1 2.2 |
|
121 |
1.1 |
|
128 |
1.1 |
|
132 |
1.1 |
|
138 |
1.1 |
|
147 |
1.1 |
|
157 |
1.1 |
|
160 |
1.1 |
|
161 |
1.1 |
|
166 |
1.1 2.2 |
|
171 |
1.1 2.2 3.3 |
|
173 |
1.1 |
|
174 |
1.1 |
|
176 |
1.1 |
|
177 |
1.1 |
|
180 |
1.1 |
|
181 |
1.1 |
|
182 |
1.1 2.2 |
|
190 |
1.1 |
|
192 |
1.1 |
|
194 |
1.1 |
|
195 |
1.1 |
|
196 |
1.1 2.2 |
|
199 |
1.1 |
|
204 |
1.1 2.2 3.3 4.4 |
|
208 |
1.1 |
|
216 |
1.1 |
|
218 |
1.1 |
|
226 |
1.1 |
|
233 |
1.1 2.2 |
|
237 |
1.1 |
|
238 |
1.1 2.2 3.3 |
|
245 |
1.1 |
|
250 |
1.1 |
|
256 |
1.1 |
|
260 |
1.1 |
|
264 |
1.1 |
|
272 |
1.1 |
|
274 |
1.1 |
|
288 |
1.1 |
|
289 |
1.1 2.2 |
|
290 |
1.1 |
|
293 |
1.1 |
|
298 |
1.1 |
|
299 |
1.1 |
|
302 |
1.1 |
|
309 |
1.1 2.2 |
|
311 |
1.1 |
|
312 |
1.1 2.2 |
|
315 |
1.1 2.2 |
|
318 |
1.1 2.2 |
|
319 |
1.1 |
|
323 |
1.1 |
|
326 |
1.1 |
|
332 |
1.1 |
|
334 |
1.1 |
|
335 |
1.1 |
|
336 |
1.1 |
|
338 |
1.1 |