summaryrefslogtreecommitdiff
path: root/test/libapt/fileutl_test.cc
blob: b6b8ac579be0df7e7da909f6ca6e41f9ea06e139 (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
#include <apt-pkg/error.h>
#include <apt-pkg/fileutl.h>

#include "assert.h"
#include <string>
#include <vector>

#include <stdio.h>
#include <iostream>
#include <stdlib.h>


int main(int argc,char *argv[])
{
   std::vector<std::string> files;

   // normal match
   files = Glob("*.lst");
   if (files.size() != 1)
   {
      _error->DumpErrors();
      return 1;
   }

   // not there
   files = Glob("xxxyyyzzz");
   if (files.size() != 0 || _error->PendingError())
   {
      _error->DumpErrors();
      return 1;
   }

   // many matches (number is a bit random)
   files = Glob("*.cc");
   if (files.size() < 10)
   {
      _error->DumpErrors();
      return 1;
   }

   return 0;
}