You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
584 B

  1. #include <config.h>
  2. #include <apt-pkg/install-progress.h>
  3. #include <string>
  4. #include "assert.h"
  5. int main() {
  6. APT::Progress::PackageManagerFancy p;
  7. std::string s;
  8. s= p.GetTextProgressStr(0.5, 60);
  9. equals(s.size(), 60);
  10. s= p.GetTextProgressStr(0.5, 4);
  11. equals(s, "[#.]");
  12. s= p.GetTextProgressStr(0.1, 12);
  13. equals(s, "[#.........]");
  14. s= p.GetTextProgressStr(0.9, 12);
  15. equals(s, "[#########.]");
  16. // deal with incorrect inputs gracefully (or should we die instead?)
  17. s= p.GetTextProgressStr(-999, 12);
  18. equals(s, "");
  19. return 0;
  20. }