--- /dev/null
+/*
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file statistic.h
+ * @author Lukasz Wrzosek (l.wrzosek@samsung.com)
+ * @author Marcin Niesluchowski (m.niesluchow@samsung.com)
+ * @version 1.0
+ * @brief Header file with implementation of Statistic class
+ */
+
+#ifndef DPL_TEST_STATISTIC_H
+#define DPL_TEST_STATISTIC_H
+
+#include <cstddef>
+
+#include <dpl/assert.h>
+#include <dpl/test/test_results_collector.h>
+
+namespace DPL {
+namespace Test {
+
+class Statistic
+{
+ public:
+ Statistic() :
+ m_failed(0),
+ m_ignored(0),
+ m_passed(0),
+ m_count(0)
+ {}
+
+ void AddTest(TestResultsCollectorBase::FailStatus::Type type)
+ {
+ ++m_count;
+ switch (type) {
+ case TestResultsCollectorBase::FailStatus::INTERNAL:
+ case TestResultsCollectorBase::FailStatus::FAILED: ++m_failed;
+ break;
+ case TestResultsCollectorBase::FailStatus::IGNORED: ++m_ignored;
+ break;
+ case TestResultsCollectorBase::FailStatus::NONE: ++m_passed;
+ break;
+ default:
+ Assert(false && "Bad FailStatus");
+ }
+ }
+
+ std::size_t GetTotal() const
+ {
+ return m_count;
+ }
+ std::size_t GetPassed() const
+ {
+ return m_passed;
+ }
+ std::size_t GetSuccesed() const
+ {
+ return m_passed;
+ }
+ std::size_t GetFailed() const
+ {
+ return m_failed;
+ }
+ std::size_t GetIgnored() const
+ {
+ return m_ignored;
+ }
+ float GetPassedOrIgnoredPercend() const
+ {
+ float passIgnoredPercent =
+ 100.0f * (static_cast<float>(m_passed)
+ + static_cast<float>(m_ignored))
+ / static_cast<float>(m_count);
+ return passIgnoredPercent;
+ }
+
+ private:
+ std::size_t m_failed;
+ std::size_t m_ignored;
+ std::size_t m_passed;
+ std::size_t m_count;
+};
+
+} // namespace Test
+} // namespace DPL
+
+#endif // DPL_TEST_STATISTIC_H
* @version 1.0
* @brief Implementation file some concrete TestResulstsCollector
*/
+#include <dpl/test/statistic.h>
#include <dpl/test/test_results_collector.h>
#include <dpl/colors.h>
#include <dpl/assert.h>
return false;
}
-class Statistic
-{
- public:
- Statistic() :
- m_failed(0),
- m_ignored(0),
- m_passed(0),
- m_count(0)
- {}
-
- void AddTest(TestResultsCollectorBase::FailStatus::Type type)
- {
- ++m_count;
- switch (type) {
- case TestResultsCollectorBase::FailStatus::INTERNAL:
- case TestResultsCollectorBase::FailStatus::FAILED: ++m_failed;
- break;
- case TestResultsCollectorBase::FailStatus::IGNORED: ++m_ignored;
- break;
- case TestResultsCollectorBase::FailStatus::NONE: ++m_passed;
- break;
- default:
- Assert(false && "Bad FailStatus");
- }
- }
-
- std::size_t GetTotal() const
- {
- return m_count;
- }
- std::size_t GetPassed() const
- {
- return m_passed;
- }
- std::size_t GetSuccesed() const
- {
- return m_passed;
- }
- std::size_t GetFailed() const
- {
- return m_failed;
- }
- std::size_t GetIgnored() const
- {
- return m_ignored;
- }
- float GetPassedOrIgnoredPercend() const
- {
- float passIgnoredPercent =
- 100.0f * (static_cast<float>(m_passed)
- + static_cast<float>(m_ignored))
- / static_cast<float>(m_count);
- return passIgnoredPercent;
- }
-
- private:
- std::size_t m_failed;
- std::size_t m_ignored;
- std::size_t m_passed;
- std::size_t m_count;
-};
-
class ConsoleCollector :
public TestResultsCollectorBase
{