blob: b0d41b61ac76d9a7b80cd71719eee97e501601db (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*
* libopenraw - testsuite.cpp
*
* Copyright (C) 2008 Hubert Figuiere
*
* This library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef _TEST_TESTSUITE_H_
#define _TEST_TESTSUITE_H_
#include <vector>
#include <string>
#include <map>
#include <boost/shared_ptr.hpp>
namespace OpenRaw {
class RawFile;
class RawData;
}
class Test
{
public:
typedef boost::shared_ptr<Test> Ptr;
Test();
~Test();
std::string & name()
{ return m_name; }
std::string & file()
{ return m_file; }
std::string & source()
{ return m_source; }
std::map<int, std::string> & results()
{ return m_results; }
/** return 0 the test ran perfectly */
int run();
private:
bool testRawType(const std::string & result);
bool testRawTypeId(const std::string & result);
bool testThumbNum(const std::string & result);
bool testThumbSizes(const std::string & result);
bool testThumbFormats(const std::string & result);
bool testThumbDataSizes(const std::string & result);
bool testRawDataType(const std::string & result);
bool testRawDataSize(const std::string & result);
bool testRawDataDimensions(const std::string & result);
bool testRawCfaPattern(const std::string & result);
bool testRawMd5(const std::string & result);
bool testRawDecompressedMd5(const std::string & result);
bool testMetaOrientation(const std::string & result);
std::string m_name;
std::string m_file;
std::string m_source;
std::map<int, std::string> m_results;
OpenRaw::RawFile *m_rawfile;
OpenRaw::RawData * m_rawdata;
int m_total, m_success, m_failure;
};
class TestSuite
{
public:
TestSuite();
int load_tests(const char * testsuite_file);
/** return 0 if all test ran perfectly */
int run_all();
/** add a test. own the test */
void add_test(const Test::Ptr & t);
private:
std::vector<Test::Ptr> m_tests;
};
#endif
|