summaryrefslogtreecommitdiff
path: root/test/libapt
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-08-12 09:07:59 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2016-08-12 11:12:04 +0200
commit1cb047079aa2c26a8159d100348b7e69a49bc117 (patch)
tree9591f7e0900f87a04683de723090161d0d324d9a /test/libapt
parentecaae01f31878a70771f75046b3e00173ff397b5 (diff)
don't perform int<float in progress bar drawing
Comparing floating numbers is always fun and in this instance a 9 < 9.0 is "somehow" true on hurd-i386 letting the tests fail by reporting that too much progress achieved. A bit mysterious, but with some rework we can use code which avoids dealing with the floats in this way entirely and make our testcases happy.
Diffstat (limited to 'test/libapt')
-rw-r--r--test/libapt/install_progress_test.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/libapt/install_progress_test.cc b/test/libapt/install_progress_test.cc
index a70fc9261..b63b4716f 100644
--- a/test/libapt/install_progress_test.cc
+++ b/test/libapt/install_progress_test.cc
@@ -12,9 +12,14 @@ TEST(InstallProgressTest, FancyGetTextProgressStr)
EXPECT_EQ(60, p.GetTextProgressStr(0.5, 60).size());
EXPECT_EQ("[#.]", p.GetTextProgressStr(0.5, 4));
+ EXPECT_EQ("[..........]", p.GetTextProgressStr(0.0, 12));
EXPECT_EQ("[#.........]", p.GetTextProgressStr(0.1, 12));
+ EXPECT_EQ("[####......]", p.GetTextProgressStr(0.4999, 12));
+ EXPECT_EQ("[#####.....]", p.GetTextProgressStr(0.5001, 12));
EXPECT_EQ("[#########.]", p.GetTextProgressStr(0.9, 12));
+ EXPECT_EQ("[##########]", p.GetTextProgressStr(1.0, 12));
// deal with incorrect inputs gracefully (or should we die instead?)
- EXPECT_EQ("", p.GetTextProgressStr(-999, 12));
+ EXPECT_EQ("[..........]", p.GetTextProgressStr(-1.0, 12));
+ EXPECT_EQ("[##########]", p.GetTextProgressStr(2.0, 12));
}