1 // -*- C++ -*- 2 3 // Copyright (C) 2005-2020 Free Software Foundation, Inc. 4 // 5 // This file is part of the GNU ISO C++ Library. This library is free 6 // software; you can redistribute it and/or modify it under the terms 7 // of the GNU General Public License as published by the Free Software 8 // Foundation; either version 3, or (at your option) any later 9 // version. 10 11 // This library is distributed in the hope that it will be useful, but 12 // WITHOUT ANY WARRANTY; without even the implied warranty of 13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 // General Public License for more details. 15 16 // You should have received a copy of the GNU General Public License 17 // along with this library; see the file COPYING3. If not see 18 // <http://www.gnu.org/licenses/>. 19 20 21 // Copyright (C) 2004 Ami Tavory and Vladimir Dreizin, IBM-HRL. 22 23 // Permission to use, copy, modify, sell, and distribute this software 24 // is hereby granted without fee, provided that the above copyright 25 // notice appears in all copies, and that both that copyright notice 26 // and this permission notice appear in supporting documentation. None 27 // of the above authors, nor IBM Haifa Research Laboratories, make any 28 // representation about the suitability of this software for any 29 // purpose. It is provided "as is" without express or implied 30 // warranty. 31 32 /** 33 * @file xml_formatter.hpp 34 * Contains an XML formatter for regression tests. 35 */ 36 37 #ifndef PB_DS_COMMON_XML_TEST_REGRESSION_FORMATTER_HPP 38 #define PB_DS_COMMON_XML_TEST_REGRESSION_FORMATTER_HPP 39 40 #include <string> 41 #include <iostream> 42 #include <io/xml_test_formatter.hpp> 43 44 namespace __gnu_pbds 45 { 46 namespace test 47 { 48 // Test formatters. 49 struct xml_test_rand_regression_formatter : public xml_test_formatter 50 { 51 // Associative. xml_test_rand_regression_formatter__gnu_pbds::test::xml_test_rand_regression_formatter52 xml_test_rand_regression_formatter(size_t sd, size_t n, size_t m, 53 double tp, double ip, double ep, 54 double cp, double mp) 55 { 56 std::cout << make_xml_tag("sd", "value", sd); 57 std::cout << make_xml_tag("n", "value", n); 58 std::cout << make_xml_tag("m", "value", m); 59 std::cout << make_xml_tag("tp", "value", tp); 60 std::cout << make_xml_tag("ip", "value", ip); 61 std::cout << make_xml_tag("ep", "value", ep); 62 std::cout << make_xml_tag("cp", "value", cp); 63 std::cout << make_xml_tag("mp", "value", mp); 64 } 65 66 // Priority Queue. xml_test_rand_regression_formatter__gnu_pbds::test::xml_test_rand_regression_formatter67 xml_test_rand_regression_formatter(size_t sd, size_t n, size_t m, 68 double tp, double ip, double dp, 69 double ep, double cp, double mp) 70 { 71 std::cout << make_xml_tag("sd", "value", sd); 72 std::cout << make_xml_tag("n", "value", n); 73 std::cout << make_xml_tag("m", "value", m); 74 std::cout << make_xml_tag("tp", "value", tp); 75 std::cout << make_xml_tag("ip", "value", ip); 76 std::cout << make_xml_tag("dp", "value", dp); 77 std::cout << make_xml_tag("ep", "value", ep); 78 std::cout << make_xml_tag("cp", "value", cp); 79 std::cout << make_xml_tag("mp", "value", mp); 80 } 81 }; 82 83 // Result formatter. 84 struct xml_result_set_regression_formatter : public xml_result_set_formatter 85 { xml_result_set_regression_formatter__gnu_pbds::test::xml_result_set_regression_formatter86 xml_result_set_regression_formatter(const std::string& r_container_name, 87 const std::string& r_container_desc) 88 : xml_result_set_formatter(r_container_name, r_container_desc) 89 { 90 std::cout << detail::make_xml_name_start_tag("progress"); 91 std::cout << detail::make_xml_name_start_tag_end_delimiter(); 92 } 93 ~xml_result_set_regression_formatter__gnu_pbds::test::xml_result_set_regression_formatter94 ~xml_result_set_regression_formatter() 95 { std::cout << detail::make_xml_name_end_tag("progress"); } 96 }; 97 } // namespace test 98 } // namespace __gnu_pbds 99 100 #endif // #ifndef PB_DS_COMMON_XML_TEST_REGRESSION_FORMATTER_HPP 101