File: install_progress_test.cc

package info (click to toggle)
apt 1.0.9.8
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 16,100 kB
  • sloc: cpp: 50,948; sh: 11,941; xml: 4,130; makefile: 854; perl: 209; python: 28
file content (20 lines) | stat: -rw-r--r-- 555 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <config.h>

#include <apt-pkg/install-progress.h>

#include <string>

#include <gtest/gtest.h>

TEST(InstallProgressTest, FancyGetTextProgressStr)
{
   APT::Progress::PackageManagerFancy p;

   EXPECT_EQ(60, p.GetTextProgressStr(0.5, 60).size());
   EXPECT_EQ("[#.]", p.GetTextProgressStr(0.5, 4));
   EXPECT_EQ("[#.........]", p.GetTextProgressStr(0.1, 12));
   EXPECT_EQ("[#########.]", p.GetTextProgressStr(0.9, 12));

   // deal with incorrect inputs gracefully (or should we die instead?)
   EXPECT_EQ("", p.GetTextProgressStr(-999, 12));
}