-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.cpp
40 lines (33 loc) · 923 Bytes
/
test.cpp
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
//https://godbolt.org/z/Yva1x9n5h
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string.h>
#include <vector>
#include "dwt53.hpp"
using namespace std;
int main() {
for (int iter=0; iter<10000; ++iter)
{
int size = max( rand() % 64, 5);
vector<int> data(size);
for (auto& v : data) {
v = rand() % 256;
}
vector<int> original = data;
vector<int> L( sizeof_L(data.size()));
vector<int> H( sizeof_H(data.size()));
dwt53(data.data(), data.size(), L.data(), H.data());
idwt53(data.data(), data.size(), L.data(), H.data());
for (int i=0; i<size; ++i) {
if ( data[i] != original[i] ) {
cerr << "test failed!" << endl;
return 1;
}
}
}
cout << "test passed!" << endl;
}