aboutsummaryrefslogtreecommitdiffstats
path: root/src/lc-compliance/results.cpp
diff options
context:
space:
mode:
authorNícolas F. R. A. Prado <nfraprado@collabora.com>2021-07-02 09:21:13 -0300
committerJacopo Mondi <jacopo@jmondi.org>2021-07-06 12:40:58 +0200
commitbc871637797ef0fa193a3c64b82389fff4ce3f44 (patch)
treeda350c19961108329d327e794abb437d7eae9527 /src/lc-compliance/results.cpp
parente5c51e1fcf8cf5de6d5bce1da7a2b3d95019f06e (diff)
lc-compliance: Refactor using Googletest
Refactor lc-compliance using Googletest as the test framework. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/lc-compliance/results.cpp')
-rw-r--r--src/lc-compliance/results.cpp75
1 files changed, 0 insertions, 75 deletions
diff --git a/src/lc-compliance/results.cpp b/src/lc-compliance/results.cpp
deleted file mode 100644
index f149f785..00000000
--- a/src/lc-compliance/results.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (C) 2020, Google Inc.
- *
- * results.cpp - Test result aggregator
- */
-
-#include "results.h"
-
-#include <iostream>
-
-void Results::add(const Result &result)
-{
- if (result.first == Pass)
- passed_++;
- else if (result.first == Fail)
- failed_++;
- else if (result.first == Skip)
- skipped_++;
-
- printResult(result);
-}
-
-void Results::add(Status status, const std::string &message)
-{
- add({ status, message });
-}
-
-void Results::fail(const std::string &message)
-{
- add(Fail, message);
-}
-
-void Results::pass(const std::string &message)
-{
- add(Pass, message);
-}
-
-void Results::skip(const std::string &message)
-{
- add(Skip, message);
-}
-
-int Results::summary() const
-{
- if (failed_ + passed_ + skipped_ != planned_) {
- std::cout << "Planned and executed number of tests differ "
- << failed_ + passed_ + skipped_ << " executed "
- << planned_ << " planned" << std::endl;
-
- return -EINVAL;
- }
-
- std::cout << planned_ << " tests executed, "
- << passed_ << " tests passed, "
- << skipped_ << " tests skipped and "
- << failed_ << " tests failed " << std::endl;
-
- return 0;
-}
-
-void Results::printResult(const Result &result)
-{
- std::string prefix;
-
- /* \todo Make parsable as TAP. */
- if (result.first == Pass)
- prefix = "PASS";
- else if (result.first == Fail)
- prefix = "FAIL";
- else if (result.first == Skip)
- prefix = "SKIP";
-
- std::cout << "- " << prefix << ": " << result.second << std::endl;
-}

Privacy Policy