diff options
author | Michele Calgaro <[email protected]> | 2021-11-20 17:25:17 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2021-11-20 17:25:17 +0900 |
commit | 652c2aea23bd9dea082f5de2c0babe1728ac608f (patch) | |
tree | 3e649e665e3b073d2017f727fa0515f27474abd2 /tests/test_details.cpp | |
parent | 1200d940add87b767246e45080e25ed207eee014 (diff) | |
download | polkit-tqt-652c2aea23bd9dea082f5de2c0babe1728ac608f.tar.gz polkit-tqt-652c2aea23bd9dea082f5de2c0babe1728ac608f.zip |
Added test framework.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'tests/test_details.cpp')
-rw-r--r-- | tests/test_details.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/test_details.cpp b/tests/test_details.cpp new file mode 100644 index 000000000..e74a9adfe --- /dev/null +++ b/tests/test_details.cpp @@ -0,0 +1,57 @@ + +#include <stdio.h> +#include <tqstring.h> +#include <tqstringlist.h> +#include "core/polkit-tqt-details.h" + +#define TEST_PASSED 0 +#define TEST_FAILED 1 + +using namespace PolkitTQt; + +int main(void) +{ + Details details; + details.insert("1", "aaa"); + details.insert("2", "bbb"); + details.insert("3", "ccc"); + details.insert("4", "ddd"); + + if (details.lookup("1") != TQString("aaa")) + { + return TEST_FAILED; + } + if (details.lookup("2") != TQString("bbb")) + { + return TEST_FAILED; + } + if (details.lookup("3") != TQString("ccc")) + { + return TEST_FAILED; + } + if (details.lookup("4") != TQString("ddd")) + { + return TEST_FAILED; + } + + TQStringList list = details.keys(); + if (!list.contains("1")) + { + return TEST_FAILED; + } + if (!list.contains("2")) + { + return TEST_FAILED; + } + if (!list.contains("3")) + { + return TEST_FAILED; + } + if (!list.contains("4")) + { + return TEST_FAILED; + } + + return TEST_PASSED; +} + |