Commit 01907f1f authored by Martin Marinov's avatar Martin Marinov

Some cosmetic changes to the test compare tool.

[git-p4: depot-paths = "//ReForm/ReForm/main/Base/": change = 13836]
parent 1247a3cd
......@@ -31,8 +31,7 @@ std::ostream& operator<<(std::ostream& _out_str, const std::vector<ValueT>& _val
}
template <typename ValueT> std::vector<ValueT>
get_values(const std::string& _key, const char* const _flnm,
const boost::filesystem::path& _dir)
values(const std::string& _key, const char* const _flnm, const Path& _dir)
{
std::ifstream istr((_dir / _flnm).string());
std::string line;
......@@ -56,8 +55,7 @@ get_values(const std::string& _key, const char* const _flnm,
// Class LogValueT
template <typename ValueT, class CompareT>
LogValueT<ValueT, CompareT>::LogValueT
(
LogValueT<ValueT, CompareT>::LogValueT(
unsigned _order, const char* _name,
const char* _key,
const CompareT& _comp,
......@@ -67,13 +65,11 @@ LogValueT<ValueT, CompareT>::LogValueT
{}
template <typename ValueT, class CompareT>
Severity LogValueT<ValueT, CompareT>::compare(
const boost::filesystem::path& _dir0,
const boost::filesystem::path& _dir1,
std::stringstream& _os) const
Severity LogValueT<ValueT, CompareT>::compare(const Path& _dir0,
const Path& _dir1, std::stringstream& _os) const
{
auto list0 = get_values<ValueT>(key_, flnm_, _dir0);
auto list1 = get_values<ValueT>(key_, flnm_, _dir1);
auto list0 = values<ValueT>(key_, flnm_, _dir0);
auto list1 = values<ValueT>(key_, flnm_, _dir1);
if (list0.size() != list1.size())
{
_os << '#' << list0.size() << " #" << list1.size();
......@@ -94,11 +90,10 @@ Severity LogValueT<ValueT, CompareT>::compare(
}
template <typename ValueT, class CompareT>
Severity LogValueT<ValueT, CompareT>::report(
const boost::filesystem::path& _dir,
Severity LogValueT<ValueT, CompareT>::report(const Path& _dir,
std::stringstream& _os) const
{
auto list = get_values<ValueT>(name(), flnm_, _dir);
auto list = values<ValueT>(name(), flnm_, _dir);
if (list.empty())
return 0;
_os << list;
......
......@@ -70,12 +70,10 @@ public:
//*!<[in] File to parse to get the information.
);
virtual Severity compare(
const boost::filesystem::path& _dir0, const boost::filesystem::path& _dir1,
std::stringstream& _os) const;
virtual Severity report(const Path& _dir, std::stringstream& _os) const;
virtual Severity report(
const boost::filesystem::path& _dir, std::stringstream& _os) const;
virtual Severity compare(const Path& _dir0, const Path& _dir1,
std::stringstream& _os) const;
private:
CompareT comp_; // Compare class.
......
......@@ -32,38 +32,40 @@ must be instantiated as global variable in such a way that they are always avail
*/
class IChecksum
{
protected:
/*!Performs an automatic registration of the new checksum in a
global list, and verifies that the name is unique.
*/
IChecksum(unsigned _order, const char* _name);
public:
/*!Checksum name.
*/
//! Checksum name.
const char* name() const { return name_; }
/*!Override compare to perform a comparison of the results stored in
directories _dir0 and _dir1.
Returns an estimation of the difference between the two test run.
*/
virtual Severity compare(
const Test::Path& _dir0, //!< [in] Directory with the reference result
const Test::Path& _dir1, //!< [in] Directory with the new result
std::stringstream& _os //!< [out] Description of the difference.
) const = 0;
/*!Override report to log any "interesting value" that the check has in
/*!
Override report to log any "interesting value" that the check has in
directory _dir. For example a number of face defects greater that 0.
Return an estimation of the severity.
*/
virtual Severity report(
const Test::Path& _dir, //!< [in] Directory with the date to report.
std::stringstream& _os //!< [out] Description of the retrieved information.
const Path& _dir, //!< [in] Directory with the date to report.
std::stringstream& _os //!< [out] Description of the retrieved information.
) const = 0;
/*!
Override compare to perform a comparison of the results stored in
directories _dir0 and _dir1.
Returns an estimation of the difference between the two test run.
*/
virtual Severity compare(
const Path& _dir0, //!< [in] Directory with the reference result
const Path& _dir1, //!< [in] Directory with the new result
std::stringstream& _os //!< [out] Description of the difference.
) const = 0;
protected:
/*!
Performs an automatic registration of the new checksum in a
global list, and verifies that the name is unique.
*/
IChecksum(unsigned _order, const char* _name);
private:
const char * name_;
const char* name_;
};
/*!
......@@ -86,4 +88,3 @@ const Registry& registry();
#endif//TEST_ON
#endif//BASE_ICHECKSUM_HH_INCLUDE
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment