-
Notifications
You must be signed in to change notification settings - Fork 1
/
moves_test.cc
75 lines (73 loc) · 1.65 KB
/
moves_test.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "moves.h"
#include <gtest/gtest.h>
#include <sstream>
#include <tuple>
TEST(MovesTest, ForceJoinTest) {
Node* a = new Node;
Node* ar = new Node;
a->id_ = 1;
a->str_ = "AAAAA";
ar->str_ = "TTTTT";
a->rc_ = ar;
ar->rc_ = a;
Node* b = new Node;
Node* br = new Node;
b->id_ = 2;
b->str_ = "CCCCC";
br->str_ = "GGGGG";
b->rc_ = br;
br->rc_ = b;
a->AddNext(b);
br->AddNext(ar);
Path p1({a});
Path p2({b});
vector<Path> paths({p1, p2});
vector<Path> out_paths;
MoveConfig config;
config.big_node_threshold = 5;
bool accept_higher = false;
MakeMove(paths, out_paths, config, accept_higher);
EXPECT_EQ(1, out_paths.size());
EXPECT_TRUE(
(a == out_paths[0][0] && b == out_paths[0][1]) ||
(br == out_paths[0][0] && ar == out_paths[0][1]));
}
TEST(MovesTest, ForceBreakTest) {
Node* a = new Node;
Node* ar = new Node;
a->id_ = 1;
a->str_ = "AAAAA";
ar->str_ = "TTTTT";
a->rc_ = ar;
ar->rc_ = a;
Node* b = new Node;
Node* br = new Node;
b->id_ = 2;
b->str_ = "C";
br->str_ = "G";
b->rc_ = br;
br->rc_ = b;
a->AddNext(b);
br->AddNext(ar);
Node* c = new Node;
Node* cr = new Node;
c->id_ = 3;
c->str_ = "TCCCC";
cr->str_ = "GGGGA";
c->rc_ = cr;
cr->rc_ = c;
b->AddNext(c);
cr->AddNext(br);
Path p({a, b, c});
vector<Path> paths({p});
vector<Path> out_paths;
MoveConfig config;
config.big_node_threshold = 5;
bool accept_higher = false;
MakeMove(paths, out_paths, config, accept_higher);
EXPECT_EQ(2, out_paths.size());
EXPECT_EQ(1, out_paths[0].size());
EXPECT_EQ(1, out_paths[1].size());
EXPECT_EQ(a, out_paths[0][0]);
EXPECT_EQ(c, out_paths[1][0]);
}