X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=tests%2Ftest_architecture.py;fp=tests%2Ftest_architecture.py;h=8fd2d3a5396565d48c24ff16ce30f0a466758724;hb=9e28920e7356504ca30dfc4e2717d1e61b324500;hp=0000000000000000000000000000000000000000;hpb=a5bb7d760de143a8ed64fbe1a7bf8d5887a9e44c;p=dak.git diff --git a/tests/test_architecture.py b/tests/test_architecture.py new file mode 100755 index 00000000..8fd2d3a5 --- /dev/null +++ b/tests/test_architecture.py @@ -0,0 +1,49 @@ +#! /usr/bin/python +# +# Copyright (C) 2014, Ansgar Burchardt +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +from base_test import DakTestCase + +import unittest + +from daklib.architecture import match_architecture + +class MatchArchitecture(DakTestCase): + def testEqual(self): + self.assert_(match_architecture('amd64', 'amd64')) + self.assert_(not match_architecture('amd64', 'i386')) + self.assert_(match_architecture('kfreebsd-amd64', 'kfreebsd-amd64')) + self.assert_(not match_architecture('kfreebsd-amd64', 'amd64')) + def testAny(self): + self.assert_(match_architecture('amd64', 'any')) + self.assert_(match_architecture('amd64', 'any-amd64')) + self.assert_(match_architecture('x32', 'any-amd64')) + self.assert_(match_architecture('kfreebsd-amd64', 'any-amd64')) + self.assert_(not match_architecture('amd64', 'any-i386')) + + self.assert_(match_architecture('kfreebsd-amd64', 'kfreebsd-any')) + self.assert_(not match_architecture('amd64', 'kfreebsd-any')) + def testAll(self): + self.assert_(match_architecture('all', 'all')) + + self.assert_(not match_architecture('amd64', 'all')) + self.assert_(not match_architecture('all', 'amd64')) + + self.assert_(not match_architecture('all', 'any')) + +if __name__ == '__main__': + unittest.main()