MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / PrintJsonTestList

Method PrintJsonTestList

tests/gtest/gtest-all.cc:5754–5778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5752}
5753
5754void JsonUnitTestResultPrinter::PrintJsonTestList(
5755 std::ostream* stream, const std::vector<TestSuite*>& test_suites) {
5756 const std::string kTestsuites = "testsuites";
5757 const std::string kIndent = Indent(2);
5758 *stream << "{\n";
5759 int total_tests = 0;
5760 for (auto test_suite : test_suites) {
5761 total_tests += test_suite->total_test_count();
5762 }
5763 OutputJsonKey(stream, kTestsuites, "tests", total_tests, kIndent);
5764
5765 OutputJsonKey(stream, kTestsuites, "name", "AllTests", kIndent);
5766 *stream << kIndent << "\"" << kTestsuites << "\": [\n";
5767
5768 for (size_t i = 0; i < test_suites.size(); ++i) {
5769 if (i != 0) {
5770 *stream << ",\n";
5771 }
5772 PrintJsonTestSuite(stream, *test_suites[i]);
5773 }
5774
5775 *stream << "\n"
5776 << kIndent << "]\n"
5777 << "}\n";
5778}
5779// Produces a string representing the test properties in a result as
5780// a JSON dictionary.
5781std::string JsonUnitTestResultPrinter::TestPropertiesAsJson(

Callers 1

Calls 3

IndentFunction · 0.85
total_test_countMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected