summaryrefslogtreecommitdiff
path: root/test/libapt/install_progress_test.cc
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-04-16 17:09:37 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2014-04-16 18:36:14 +0200
commitf00832cc273e52a47fb88e49849891b771de4e17 (patch)
treeeedd6b1e1c873c7e3e8f614a0ac8ca5c3b7e37b9 /test/libapt/install_progress_test.cc
parentbb93178b8b5c2f8021977dbc34066f0d0fb8b9b9 (diff)
use Google C++ Testing Framework for libapt tests
My commit 45df0ad2 from 26. Nov 2009 had a little remark: "The commit also includes a very very simple testapp." This was never intended to be permanent, but as usually… The commit adds the needed make magic to compile gtest statically as it is required and links it against a small runner. All previous testcase binaries are reimplemented in gtest and combined in this runner. While most code is a 1:1 translation some had to be rewritten like compareversion_test.cc, but the coverage remains the same.
Diffstat (limited to 'test/libapt/install_progress_test.cc')
-rw-r--r--test/libapt/install_progress_test.cc26
1 files changed, 8 insertions, 18 deletions
diff --git a/test/libapt/install_progress_test.cc b/test/libapt/install_progress_test.cc
index be1a3411e..a70fc9261 100644
--- a/test/libapt/install_progress_test.cc
+++ b/test/libapt/install_progress_test.cc
@@ -4,27 +4,17 @@
#include <string>
-#include "assert.h"
+#include <gtest/gtest.h>
-int main() {
+TEST(InstallProgressTest, FancyGetTextProgressStr)
+{
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, "[#########.]");
+ 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?)
- s= p.GetTextProgressStr(-999, 12);
- equals(s, "");
-
- return 0;
+ EXPECT_EQ("", p.GetTextProgressStr(-999, 12));
}