diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2010-05-28 23:11:36 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2010-05-28 23:11:36 +0200 |
commit | 3152f4aa4a97ad06ef1073aabe137f999f787ee1 (patch) | |
tree | a58dfe4029ba6f551b3d4f06632d43b9ef9c3570 /test | |
parent | 392a882ad8a299d55889e9c0fa581a266d6dd2c9 (diff) |
* apt-pkg/aptconfiguration.cc:
- remove duplicate architectures in getArchitectures()
Diffstat (limited to 'test')
-rw-r--r-- | test/libapt/getarchitectures_test.cc | 61 | ||||
-rw-r--r-- | test/libapt/makefile | 5 |
2 files changed, 66 insertions, 0 deletions
diff --git a/test/libapt/getarchitectures_test.cc b/test/libapt/getarchitectures_test.cc new file mode 100644 index 000000000..1500caeed --- /dev/null +++ b/test/libapt/getarchitectures_test.cc @@ -0,0 +1,61 @@ +#include <apt-pkg/aptconfiguration.h> +#include <apt-pkg/configuration.h> + +#include "assert.h" +#include <string> +#include <vector> + +#include <iostream> + +// simple helper to quickly output a vector of strings +void dumpVector(std::vector<std::string> vec) { + for (std::vector<std::string>::const_iterator v = vec.begin(); + v != vec.end(); v++) + std::cout << *v << std::endl; +} + +int main(int argc,char *argv[]) +{ + std::vector<std::string> vec; + + _config->Set("APT::Architectures::1", "i386"); + _config->Set("APT::Architectures::2", "amd64"); + vec = APT::Configuration::getArchitectures(false); + equals(vec.size(), 2); + equals(vec[0], "i386"); + equals(vec[1], "amd64"); + + _config->Set("APT::Architecture", "i386"); + vec = APT::Configuration::getArchitectures(false); + equals(vec.size(), 2); + equals(vec[0], "i386"); + equals(vec[1], "amd64"); + + _config->Set("APT::Architectures::2", ""); + vec = APT::Configuration::getArchitectures(false); + equals(vec.size(), 1); + equals(vec[0], "i386"); + + _config->Set("APT::Architecture", "armel"); + vec = APT::Configuration::getArchitectures(false); + equals(vec.size(), 2); + equals(vec[0], "i386"); + equals(vec[1], "armel"); + + _config->Set("APT::Architectures::2", "amd64"); + _config->Set("APT::Architectures::3", "i386"); + _config->Set("APT::Architectures::4", "armel"); + _config->Set("APT::Architectures::5", "i386"); + _config->Set("APT::Architectures::6", "amd64"); + _config->Set("APT::Architectures::7", "armel"); + _config->Set("APT::Architectures::8", "armel"); + _config->Set("APT::Architectures::9", "amd64"); + _config->Set("APT::Architectures::10", "amd64"); + vec = APT::Configuration::getArchitectures(false); + equals(vec.size(), 3); + equals(vec[0], "i386"); + equals(vec[1], "amd64"); + equals(vec[2], "armel"); + + return 0; +} diff --git a/test/libapt/makefile b/test/libapt/makefile index 98bdb3348..ee3401b35 100644 --- a/test/libapt/makefile +++ b/test/libapt/makefile @@ -12,6 +12,11 @@ SLIBS = -lapt-pkg SOURCE = getlanguages_test.cc include $(PROGRAM_H) +PROGRAM = getArchitectures${BASENAME} +SLIBS = -lapt-pkg +SOURCE = getarchitectures_test.cc +include $(PROGRAM_H) + # Program for testing ParseDepends PROGRAM = ParseDepends${BASENAME} SLIBS = -lapt-pkg |