-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
67 lines (57 loc) · 2.18 KB
/
Copy pathmain.cpp
File metadata and controls
67 lines (57 loc) · 2.18 KB
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
#include <QApplication>
#include "include/mainwindow.h"
#include "GeetFS.h"
#include "Command.h"
#include "Serializer.h"
constexpr int N = 2e5 + 5;
int whole_time = 0;
int main(int argc, char *argv[]) {
// QApplication a(argc, argv);
//
// MainWindow w;
// w.show();
//
// return QApplication::exec();
GeetFS& geetFS = GeetFS::getInstance();
Serializer serializer = *new Serializer(std::string(R"(D:\Games\GeetFS\data\)"));
WriteCommand("file1", 3, 2, "ab").execute(geetFS);
CommitCommand("cmt1").execute(geetFS);
WriteCommand("file2", 2, 4, "cdef").execute(geetFS);
ReadCommand("file1", 0, 10).execute(geetFS);
lsCommand().execute(geetFS);
unlinkCommand("file1").execute(geetFS);
CommitCommand("cmt2").execute(geetFS);
lsCommand().execute(geetFS);
checkoutCommand("cmt1").execute(geetFS);
ReadCommand("file1", 0, 10).execute(geetFS);
WriteCommand("file1", 6, 2, "gh").execute(geetFS);
WriteCommand("file3", 2, 3, "ijk").execute(geetFS);
CommitCommand("cmt3").execute(geetFS);
lsCommand().execute(geetFS);
checkoutCommand("cmt2").execute(geetFS);
lsCommand().execute(geetFS);
mergeCommand("cmt3", "cmt4").execute(geetFS);
lsCommand().execute(geetFS);
ReadCommand("file3", 0, 10).execute(geetFS);
checkoutCommand("cmt3").execute(geetFS);
WriteCommand("file3", 5, 3, "lmn").execute(geetFS);
ReadCommand("file3", 0, 10).execute(geetFS);
// geetFS.loadFromTxt(std::string(R"(D:\Games\GeetFS\resources\data.txt)"));
// geetFS.saveToTxt(std::string(R"(D:\Games\GeetFS\resources\data.txt)"));
// serializer.loadGeetFS(geetFS.head, geetFS.uncommited, geetFS.id);
serializer.saveGeetFS(geetFS.head, geetFS.uncommited, geetFS.id);
for (const auto& [x, y] : geetFS.id) {
std::cout <<"idname:" << x << std::endl;
for (const auto& z : y.facmt)
std::cout << z.cmtName << ' ';
std::cout << std::endl;
}
std::cout << "---------------\n";
for (const auto& [x, y] : geetFS.id) {
std::cout <<"idname:" << x << std::endl;
for (const auto& z : y.files)
std::cout << z.name << ' ';
std::cout << std::endl;
}
geetFS.solve();
}