]> git.saurik.com Git - apt.git/blob - test/libapt/install_progress_test.cc
prevent C++ locale number formatting in text APIs
[apt.git] / test / libapt / install_progress_test.cc
1 #include <config.h>
2
3 #include <apt-pkg/install-progress.h>
4
5 #include <string>
6
7 #include <gtest/gtest.h>
8
9 TEST(InstallProgressTest, FancyGetTextProgressStr)
10 {
11 APT::Progress::PackageManagerFancy p;
12
13 EXPECT_EQ(60, p.GetTextProgressStr(0.5, 60).size());
14 EXPECT_EQ("[#.]", p.GetTextProgressStr(0.5, 4));
15 EXPECT_EQ("[#.........]", p.GetTextProgressStr(0.1, 12));
16 EXPECT_EQ("[#########.]", p.GetTextProgressStr(0.9, 12));
17
18 // deal with incorrect inputs gracefully (or should we die instead?)
19 EXPECT_EQ("", p.GetTextProgressStr(-999, 12));
20 }