summaryrefslogtreecommitdiff
path: root/test/libapt/install_progress_test.cc
blob: be1a3411e5b4d8f32a573e13f1852476404e5063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <config.h>

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

#include <string>

#include "assert.h"

int main() {
   APT::Progress::PackageManagerFancy p;
   std::string s;   

   s= p.GetTextProgressStr(0.5, 60);
   equals(s.size(), 60);
   
   s= p.GetTextProgressStr(0.5, 4);
   equals(s, "[#.]");

   s= p.GetTextProgressStr(0.1, 12);
   equals(s, "[#.........]");
   
   s= p.GetTextProgressStr(0.9, 12);
   equals(s, "[#########.]");

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

   return 0;
}