]> git.saurik.com Git - apt.git/blobdiff - test/libapt/parsedepends_test.cc
Merge branch 'debian/sid' of git://git.debian.org/git/apt/apt into debian/sid
[apt.git] / test / libapt / parsedepends_test.cc
index b7befa561ab0f7c3baabbb6f1781af58dfe8ba37..677b1c89263756221358a96fd1169610db0558ed 100644 (file)
@@ -4,13 +4,13 @@
 #include "assert.h"
 
 int main(int argc,char *argv[]) {
 #include "assert.h"
 
 int main(int argc,char *argv[]) {
-       string Package;
-       string Version;
+       std::string Package;
+       std::string Version;
        unsigned int Op = 5;
        unsigned int Null = 0;
        bool StripMultiArch = true;
        bool ParseArchFlags = false;
        unsigned int Op = 5;
        unsigned int Null = 0;
        bool StripMultiArch = true;
        bool ParseArchFlags = false;
-       _config->Set("APT::Architecture","dsk");
+       _config->Set("APT::Architecture","amd64");
 
        const char* Depends =
                "debhelper:any (>= 5.0), "
 
        const char* Depends =
                "debhelper:any (>= 5.0), "
@@ -19,8 +19,14 @@ int main(int argc,char *argv[]) {
                "libcurl4-gnutls-dev:native | libcurl3-gnutls-dev (>> 7.15.5), "
                "debiandoc-sgml, "
                "apt (>= 0.7.25), "
                "libcurl4-gnutls-dev:native | libcurl3-gnutls-dev (>> 7.15.5), "
                "debiandoc-sgml, "
                "apt (>= 0.7.25), "
-               "not-for-me [ !dsk ], "
-               "only-for-me [ dsk ], "
+               "not-for-me [ !amd64 ], "
+               "only-for-me [ amd64 ], "
+               "any-for-me [ any ], "
+               "not-for-darwin [ !darwin-any ], "
+               "cpu-for-me [ any-amd64 ], "
+               "os-for-me [ linux-any ], "
+               "cpu-not-for-me [ any-armel ], "
+               "os-not-for-me [ kfreebsd-any ], "
                "overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), "
        ;
 
                "overlord-dev:any (= 7.15.3~) | overlord-dev:native (>> 7.15.5), "
        ;
 
@@ -100,6 +106,68 @@ test:
                Start++;
        }
 
                Start++;
        }
 
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("any-for-me", Package);
+               equals("", Version);
+               equals(Null | pkgCache::Dep::NoOp, Op);
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("not-for-darwin", Package);
+               equals("", Version);
+               equals(Null | pkgCache::Dep::NoOp, Op);
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("cpu-for-me", Package);
+               equals("", Version);
+               equals(Null | pkgCache::Dep::NoOp, Op);
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("os-for-me", Package);
+               equals("", Version);
+               equals(Null | pkgCache::Dep::NoOp, Op);
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("", Package); // cpu-not-for-me
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
+       if (ParseArchFlags == true) {
+               Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
+               equals("", Package); // os-not-for-me
+       } else {
+               equals(true, 0 == debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch));
+               Start = strstr(Start, ",");
+               Start++;
+       }
+
        Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
        if (StripMultiArch == true)
                equals("overlord-dev", Package);
        Start = debListParser::ParseDepends(Start, End, Package, Version, Op, ParseArchFlags, StripMultiArch);
        if (StripMultiArch == true)
                equals("overlord-dev", Package);