]>
Commit | Line | Data |
---|---|---|
fa211e2d MV |
1 | #include <config.h> |
2 | ||
3 | #include <apt-pkg/install-progress.h> | |
4 | ||
5 | #include <string> | |
6 | ||
f00832cc | 7 | #include <gtest/gtest.h> |
fa211e2d | 8 | |
f00832cc DK |
9 | TEST(InstallProgressTest, FancyGetTextProgressStr) |
10 | { | |
fa211e2d | 11 | APT::Progress::PackageManagerFancy p; |
fa211e2d | 12 | |
f00832cc DK |
13 | EXPECT_EQ(60, p.GetTextProgressStr(0.5, 60).size()); |
14 | EXPECT_EQ("[#.]", p.GetTextProgressStr(0.5, 4)); | |
1cb04707 | 15 | EXPECT_EQ("[..........]", p.GetTextProgressStr(0.0, 12)); |
f00832cc | 16 | EXPECT_EQ("[#.........]", p.GetTextProgressStr(0.1, 12)); |
1cb04707 DK |
17 | EXPECT_EQ("[####......]", p.GetTextProgressStr(0.4999, 12)); |
18 | EXPECT_EQ("[#####.....]", p.GetTextProgressStr(0.5001, 12)); | |
f00832cc | 19 | EXPECT_EQ("[#########.]", p.GetTextProgressStr(0.9, 12)); |
1cb04707 | 20 | EXPECT_EQ("[##########]", p.GetTextProgressStr(1.0, 12)); |
fa211e2d MV |
21 | |
22 | // deal with incorrect inputs gracefully (or should we die instead?) | |
1cb04707 DK |
23 | EXPECT_EQ("[..........]", p.GetTextProgressStr(-1.0, 12)); |
24 | EXPECT_EQ("[##########]", p.GetTextProgressStr(2.0, 12)); | |
fa211e2d | 25 | } |