Exemple #1
0
    /// Sets the list of test cases of the test program.
    ///
    /// \param test_cases_ The new list of test cases.
    void
    set_test_cases(const model::test_cases_map& test_cases_)
    {
        for (model::test_cases_map::const_iterator iter = test_cases_.begin();
             iter != test_cases_.end(); ++iter) {
            const std::string& name = (*iter).first;
            const model::test_case& test_case = (*iter).second;

            PRE_MSG(name == test_case.name(),
                    F("The test case '%s' has been registered with the "
                      "non-matching name '%s'") % name % test_case.name());

            test_cases.insert(model::test_cases_map::value_type(
                name, test_case.apply_metadata_defaults(&md)));
        }
        INV(test_cases.size() == test_cases_.size());
    }
Exemple #2
0
    /// Constructor.
    ///
    /// \param interface_name_ Name of the test program interface.
    /// \param binary_ The name of the test program binary relative to root_.
    /// \param root_ The root of the test suite containing the test program.
    /// \param test_suite_name_ The name of the test suite this program
    ///     belongs to.
    /// \param md_ Metadata of the test program.
    /// \param test_cases_ The collection of test cases in the test program.
    impl(const std::string& interface_name_, const fs::path& binary_,
         const fs::path& root_, const std::string& test_suite_name_,
         const model::metadata& md_, const model::test_cases_map& test_cases_) :
        interface_name(interface_name_),
        binary(binary_),
        root(root_),
        test_suite_name(test_suite_name_),
        md(md_),
        test_cases(test_cases_)
    {
        PRE_MSG(!binary.is_absolute(),
                F("The program '%s' must be relative to the root of the test "
                  "suite '%s'") % binary % root);

        for (model::test_cases_map::const_iterator iter = test_cases.begin();
             iter != test_cases.end(); ++iter) {
            PRE_MSG((*iter).first == (*iter).second.name(),
                    F("The test case '%s' has been registered with the "
                      "non-matching name '%s'") %
                    (*iter).first % (*iter).second.name());
        }
    }