1 1.1 jmmv // Copyright 2010 Google Inc. 2 1.1 jmmv // All rights reserved. 3 1.1 jmmv // 4 1.1 jmmv // Redistribution and use in source and binary forms, with or without 5 1.1 jmmv // modification, are permitted provided that the following conditions are 6 1.1 jmmv // met: 7 1.1 jmmv // 8 1.1 jmmv // * Redistributions of source code must retain the above copyright 9 1.1 jmmv // notice, this list of conditions and the following disclaimer. 10 1.1 jmmv // * Redistributions in binary form must reproduce the above copyright 11 1.1 jmmv // notice, this list of conditions and the following disclaimer in the 12 1.1 jmmv // documentation and/or other materials provided with the distribution. 13 1.1 jmmv // * Neither the name of Google Inc. nor the names of its contributors 14 1.1 jmmv // may be used to endorse or promote products derived from this software 15 1.1 jmmv // without specific prior written permission. 16 1.1 jmmv // 17 1.1 jmmv // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 1.1 jmmv // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 1.1 jmmv // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 1.1 jmmv // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 1.1 jmmv // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 1.1 jmmv // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 1.1 jmmv // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 1.1 jmmv // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 1.1 jmmv // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 1.1 jmmv // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 1.1 jmmv // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 1.1 jmmv 29 1.1 jmmv /// \file engine/test_program.hpp 30 1.1 jmmv /// Interface to interact with test programs. 31 1.1 jmmv /// 32 1.1 jmmv /// A test program is purely a collection of test cases. The test program has 33 1.1 jmmv /// no identity by itself: it only exists to provide a consistent entry point 34 1.1 jmmv /// for all the test cases it contains and to group such test cases 35 1.1 jmmv /// semantically. Therefore, this module provides no data type to represent the 36 1.1 jmmv /// test program. 37 1.1 jmmv 38 1.1 jmmv #if !defined(ENGINE_TEST_PROGRAM_HPP) 39 1.1 jmmv #define ENGINE_TEST_PROGRAM_HPP 40 1.1 jmmv 41 1.1 jmmv #include <ostream> 42 1.1 jmmv #include <string> 43 1.1 jmmv #include <vector> 44 1.1 jmmv 45 1.1 jmmv #include "engine/test_case.hpp" 46 1.1 jmmv #include "utils/fs/path.hpp" 47 1.1.1.2 jmmv #include "utils/shared_ptr.hpp" 48 1.1 jmmv 49 1.1 jmmv namespace engine { 50 1.1 jmmv 51 1.1 jmmv 52 1.1 jmmv /// Collection of test cases. 53 1.1 jmmv typedef std::vector< test_case_ptr > test_cases_vector; 54 1.1 jmmv 55 1.1 jmmv 56 1.1 jmmv std::ostream& operator<<(std::ostream&, const test_cases_vector&); 57 1.1 jmmv 58 1.1 jmmv 59 1.1 jmmv /// Representation of a test program. 60 1.1 jmmv class test_program { 61 1.1 jmmv struct impl; 62 1.1 jmmv 63 1.1 jmmv /// Pointer to the shared internal implementation. 64 1.1.1.2 jmmv std::shared_ptr< impl > _pimpl; 65 1.1 jmmv 66 1.1 jmmv public: 67 1.1 jmmv test_program(const std::string&, const utils::fs::path&, 68 1.1 jmmv const utils::fs::path&, const std::string&, 69 1.1 jmmv const metadata&); 70 1.1 jmmv ~test_program(void); 71 1.1 jmmv 72 1.1 jmmv const std::string& interface_name(void) const; 73 1.1 jmmv const utils::fs::path& root(void) const; 74 1.1 jmmv const utils::fs::path& relative_path(void) const; 75 1.1 jmmv const utils::fs::path absolute_path(void) const; 76 1.1 jmmv const std::string& test_suite_name(void) const; 77 1.1 jmmv const metadata& get_metadata(void) const; 78 1.1 jmmv 79 1.1 jmmv const test_case_ptr& find(const std::string&) const; 80 1.1 jmmv const test_cases_vector& test_cases(void) const; 81 1.1 jmmv void set_test_cases(const test_cases_vector&); 82 1.1 jmmv 83 1.1 jmmv bool operator==(const test_program&) const; 84 1.1 jmmv bool operator!=(const test_program&) const; 85 1.1 jmmv }; 86 1.1 jmmv 87 1.1 jmmv 88 1.1 jmmv std::ostream& operator<<(std::ostream&, const test_program&); 89 1.1 jmmv 90 1.1 jmmv 91 1.1 jmmv /// Pointer to a test program. 92 1.1.1.2 jmmv typedef std::shared_ptr< test_program > test_program_ptr; 93 1.1 jmmv 94 1.1 jmmv 95 1.1 jmmv /// Collection of test programs. 96 1.1 jmmv typedef std::vector< test_program_ptr > test_programs_vector; 97 1.1 jmmv 98 1.1 jmmv 99 1.1 jmmv } // namespace engine 100 1.1 jmmv 101 1.1 jmmv #endif // !defined(ENGINE_TEST_PROGRAM_HPP) 102