-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_diversions.cc
43 lines (35 loc) · 1.02 KB
/
test_diversions.cc
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
#include <iostream>
#include <fstream>
#include "dpkg.h"
int read_diversions_old(vector<Diversion>& diversions)
{
ifstream txt("/var/lib/dpkg/diversions");
while(!txt.eof())
{
string oldfile,newfile,package;
getline(txt,oldfile);
getline(txt,newfile);
getline(txt,package);
diversions.push_back(Diversion(oldfile,newfile,package));
}
txt.close();
return 0;
}
int main()
{
vector<Diversion> diversions1;
read_diversions_old(diversions1);
for (unsigned int i=0;i<diversions1.size();i++) {
cout << diversions1[i].oldfile << endl;
cout << diversions1[i].newfile << endl;
cout << diversions1[i].package << endl;
}
cout << "----------------------" << endl;
vector<Diversion> diversions2;
read_diversions(diversions2);
for (unsigned int i=0;i<diversions2.size();i++) {
cout << diversions2[i].oldfile << endl;
cout << diversions2[i].newfile << endl;
cout << diversions2[i].package << endl;
}
}