summaryrefslogtreecommitdiff
path: root/src/cppunit/TestComposite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/cppunit/TestComposite.cpp')
-rw-r--r--src/cppunit/TestComposite.cpp53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/cppunit/TestComposite.cpp b/src/cppunit/TestComposite.cpp
new file mode 100644
index 0000000..e5f38c3
--- /dev/null
+++ b/src/cppunit/TestComposite.cpp
@@ -0,0 +1,53 @@
+#include <cppunit/TestComposite.h>
+#include <cppunit/TestResult.h>
+
+
+namespace CppUnit {
+
+TestComposite::TestComposite( const std::string &name )
+ : m_name( name )
+{
+}
+
+
+TestComposite::~TestComposite()
+{
+}
+
+
+void
+TestComposite::run( TestResult *result )
+{
+ int childCount = getChildTestCount();
+ for ( int index =0; index < childCount; ++index )
+ {
+ if ( result->shouldStop() )
+ break;
+
+ getChildTestAt( index )->run( result );
+ }
+}
+
+
+int
+TestComposite::countTestCases() const
+{
+ int count = 0;
+
+ int childCount = getChildTestCount();
+ for ( int index =0; index < childCount; ++index )
+ count += getChildTestAt( index )->countTestCases();
+
+ return count;
+}
+
+
+std::string
+TestComposite::getName() const
+{
+ return m_name;
+}
+
+
+} // namespace CppUnit
+