| 1 | /* ---------------------------------------------------------------------------- |
| 2 | |
| 3 | * GTSAM Copyright 2010, Georgia Tech Research Corporation, |
| 4 | * Atlanta, Georgia 30332-0415 |
| 5 | * All Rights Reserved |
| 6 | * Authors: Frank Dellaert, et al. (see THANKS for the full author list) |
| 7 | |
| 8 | * See LICENSE for the license information |
| 9 | |
| 10 | * -------------------------------------------------------------------------- */ |
| 11 | |
| 12 | |
| 13 | #include "TestResult.h" |
| 14 | #include "Failure.h" |
| 15 | |
| 16 | #include <stdio.h> |
| 17 | |
| 18 | |
| 19 | TestResult::TestResult () |
| 20 | : failureCount (0) |
| 21 | { |
| 22 | } |
| 23 | |
| 24 | |
| 25 | void TestResult::testsStarted () |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | |
| 30 | void TestResult::addFailure (const Failure& failure) |
| 31 | { |
| 32 | if (failure.lineNumber < 0) // allow for no line number |
| 33 | fprintf (stdout, format: "%s%s%s%s\n" , |
| 34 | "Failure: \"" , |
| 35 | failure.message.c_str (), |
| 36 | "\" in " , |
| 37 | failure.fileName.c_str ()); |
| 38 | else |
| 39 | fprintf (stdout, format: "%s%s%ld%s%s%s\n" , |
| 40 | failure.fileName.c_str(), // Format matches Eclipse error flagging |
| 41 | ":" , |
| 42 | failure.lineNumber, |
| 43 | ": Failure: \"" , |
| 44 | failure.message.c_str(), |
| 45 | "\" " ); |
| 46 | |
| 47 | failureCount++; |
| 48 | } |
| 49 | |
| 50 | |
| 51 | void TestResult::testsEnded () |
| 52 | { |
| 53 | if (failureCount > 0) |
| 54 | fprintf (stdout, format: "There were %d failures\n" , failureCount); |
| 55 | else |
| 56 | fprintf (stdout, format: "There were no test failures\n" ); |
| 57 | } |
| 58 | |