Commit dc3c9377 authored by Chuanren Wu's avatar Chuanren Wu

add test

parent 730f1b58
......@@ -98,3 +98,66 @@ TEST(BC, SingleSegment3)
EXPECT_EQ(v[0], v[2]);
EXPECT_EQ(v[1], v[3]);
}
TEST(BC, TwoSegments1)
{
std::vector<Constraint> cs;
{
Constraint c;
c.plus(0);
c.minus(2);
cs.push_back(c);
}
{
Constraint c;
c.plus(1);
c.minus(3);
cs.push_back(c);
}
{
Constraint c;
c.plus(4);
c.minus(6);
cs.push_back(c);
}
{
Constraint c;
c.plus(5);
c.minus(7);
cs.push_back(c);
}
{
Constraint c;
c.plus(2);
c.minus(4);
cs.push_back(c);
}
std::vector<double> vl;
vl.push_back(1);
vl.push_back(2);
vl.push_back(3);
vl.push_back(4);
vl.push_back(5);
vl.push_back(6);
vl.push_back(1);
vl.push_back(7);
auto v = discretizeImpl(vl, cs);
EXPECT_NE(0, v.size());
EXPECT_LE(1, v[0]);
EXPECT_LE(2, v[1]);
EXPECT_LE(3, v[2]);
EXPECT_LE(4, v[3]);
EXPECT_LE(5, v[4]);
EXPECT_LE(6, v[5]);
EXPECT_LE(1, v[6]);
EXPECT_LE(7, v[7]);
EXPECT_EQ(v[0], v[2]);
EXPECT_EQ(v[1], v[3]);
EXPECT_EQ(v[4], v[6]);
EXPECT_EQ(v[5], v[7]);
EXPECT_EQ(v[2], v[4]);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment