]> git.saurik.com Git - apt.git/blobdiff - test/libapt/parsedepends_test.cc
merged from lp:~donkult/apt/experimental/
[apt.git] / test / libapt / parsedepends_test.cc
index b7befa561ab0f7c3baabbb6f1781af58dfe8ba37..b5d92d9d2b85db315ff24b0984a178bdceffec9a 100644 (file)
@@ -4,8 +4,8 @@
 #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;
        unsigned int Op = 5;
        unsigned int Null = 0;
        bool StripMultiArch = true;
@@ -21,6 +21,12 @@ int main(int argc,char *argv[]) {
                "apt (>= 0.7.25), "
                "not-for-me [ !dsk ], "
                "only-for-me [ dsk ], "
                "apt (>= 0.7.25), "
                "not-for-me [ !dsk ], "
                "only-for-me [ dsk ], "
+               "any-for-me [ any ], "
+               "not-for-darwin [ !darwin-any ], "
+               "cpu-for-me [ any-dsk ], "
+               "os-for-me [ linux-any ], "
+               "cpu-not-for-me [ any-amd64 ], "
+               "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);