]>
git.saurik.com Git - apt.git/blob - test/libapt/install_progress_test.cc
3 #include <apt-pkg/install-progress.h>
7 #include <gtest/gtest.h>
9 TEST(InstallProgressTest
, FancyGetTextProgressStr
)
11 APT::Progress::PackageManagerFancy p
;
13 EXPECT_EQ(60, p
.GetTextProgressStr(0.5, 60).size());
14 EXPECT_EQ("[#.]", p
.GetTextProgressStr(0.5, 4));
15 EXPECT_EQ("[..........]", p
.GetTextProgressStr(0.0, 12));
16 EXPECT_EQ("[#.........]", p
.GetTextProgressStr(0.1, 12));
17 EXPECT_EQ("[####......]", p
.GetTextProgressStr(0.4999, 12));
18 EXPECT_EQ("[#####.....]", p
.GetTextProgressStr(0.5001, 12));
19 EXPECT_EQ("[#########.]", p
.GetTextProgressStr(0.9, 12));
20 EXPECT_EQ("[##########]", p
.GetTextProgressStr(1.0, 12));
22 // deal with incorrect inputs gracefully (or should we die instead?)
23 EXPECT_EQ("[..........]", p
.GetTextProgressStr(-1.0, 12));
24 EXPECT_EQ("[##########]", p
.GetTextProgressStr(2.0, 12));