move to cmake

This commit is contained in:
2024-06-03 09:59:35 -05:00
parent d1c056e734
commit 087f132a32
41 changed files with 558 additions and 367 deletions

View File

@@ -1,10 +1,4 @@
#include <cassert>
#include <dtl/dtl.hpp>
#include <iostream>
#include <vector>
using namespace std;
#include "common.hpp"
using dtl::Diff3;
@@ -15,24 +9,24 @@ int main(int, char **) {
int c[10] = {1, 2, 3, 9, 5, 6, 7, 8, 9, 10};
int answer[10] = {1, 2, 3, 9, 5, 6, 7, 3, 9, 10};
cout << "a:";
std::cout << "a:";
for (int i = 0; i < 10; ++i) {
cout << a[i] << " ";
std::cout << a[i] << " ";
}
cout << endl;
cout << "b:";
std::cout << std::endl;
std::cout << "b:";
for (int i = 0; i < 10; ++i) {
cout << b[i] << " ";
std::cout << b[i] << " ";
}
cout << endl;
cout << "c:";
std::cout << std::endl;
std::cout << "c:";
for (int i = 0; i < 10; ++i) {
cout << c[i] << " ";
std::cout << c[i] << " ";
}
cout << endl;
std::cout << std::endl;
typedef int elem;
typedef vector<int> sequence;
typedef std::vector<int> sequence;
sequence A(&a[0], &a[10]);
sequence B(&b[0], &b[10]);
sequence C(&c[0], &c[10]);
@@ -40,18 +34,18 @@ int main(int, char **) {
Diff3<elem> diff3(A, B, C);
diff3.compose();
if (!diff3.merge()) {
cerr << "conflict." << endl;
std::cerr << "conflict." << std::endl;
return -1;
}
sequence s = diff3.getMergedSequence();
cout << "s:";
std::cout << "s:";
for (sequence::iterator it = s.begin(); it != s.end(); ++it) {
cout << *it << " ";
std::cout << *it << " ";
}
cout << endl;
std::cout << std::endl;
assert(s == Answer);
cout << "intdiff3 OK" << endl;
std::cout << "intdiff3 OK" << std::endl;
return 0;
}