summaryrefslogtreecommitdiffstats
path: root/tests/test_details.cpp
blob: 13b797d092addbf7d9553e6b7a003bc140eed9a8 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

#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;
}