-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTest.h
45 lines (33 loc) · 873 Bytes
/
Test.h
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
#ifndef _TEST_H__
#include <iostream>
#include <string>
#include <vector>
#include <map>
using std::vector;
using std::map;
using std::string;
using std::cout;
using std::endl;
class Test
{
private:
typedef void( *SORT_FUNC )(vector<int> &v);
public:
Test( );
~Test( );
bool add( const string& name , SORT_FUNC sort_func );
bool test( SORT_FUNC sort_func );
bool test( );
const map<string,long>& calcTime( int size );
private:
vector<int> genTestVector( int size );
int genRndNumber( int a, int b );
bool rndTest( SORT_FUNC sort_func );
void showVector( const vector<int>& v );
bool isRight( const vector<int>& v, vector<int>& r );
bool preTest( SORT_FUNC sort_func );
private:
map< string , SORT_FUNC> sort_funcs_;
map<string, long> elapsed_times_;
};
#endif // !_TEST_H__