Skip to content

Commit d8059f7

Browse files
committed
Fixed CTestResultParserTest (PR #98).
1 parent 80a705f commit d8059f7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tmc-plugin/test/unit/src/fi/helsinki/cs/tmc/data/serialization/cresultparser/CTestResultParserTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void testParsingWithValgrindOutput() {
129129
CTestResultParser cpar = null;
130130
try {
131131
File ttmp = constructTestOutput(oneOfEachTest);
132-
File vtmp = constructNotMemoryFailingValgrindOutput(oneOfEachTest);
132+
File vtmp = constructMemoryFailingValgrindOutput();
133133

134134
cpar = new CTestResultParser(ttmp, vtmp, null);
135135
cpar.parseTestOutput();
@@ -140,11 +140,12 @@ public void testParsingWithValgrindOutput() {
140140
}
141141
List<TestCaseResult> results = cpar.getTestCaseResults();
142142
assertEquals("There should be two test results", 2, results.size());
143-
int i = 2;
144-
for (TestCaseResult r : results) {
145-
assertEquals("==" + i * 2 + "== " + (i - 1), r.getDetailedMessage().split("\n")[1]);
146-
i++;
147-
}
143+
assertNotNull("Valgrind errors should go in detailed message",
144+
results.get(0).getDetailedMessage());
145+
assertTrue("Valgrind errors should go in detailed message",
146+
results.get(0).getDetailedMessage().contains("==1== 1"));
147+
assertNull("Valgrind output should go into detailed message if there were not errors",
148+
results.get(1).getDetailedMessage());
148149
}
149150

150151
@Test
@@ -163,10 +164,9 @@ public void testTestsPassWhenNoMemoryErrors() {
163164
}
164165
List<TestCaseResult> results = cpar.getTestCaseResults();
165166
assertEquals("There should be two test results", 2, results.size());
166-
int i = 2;
167167
for (TestCaseResult r : results) {
168-
assertEquals("==" + i * 2 + "== " + (i - 1), r.getDetailedMessage().split("\n")[1]);
169-
i++;
168+
assertNull("Valgrind output should be empty when there was no error",
169+
r.getDetailedMessage());
170170
}
171171
}
172172

0 commit comments

Comments
 (0)