test_architecture.py 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #! /usr/bin/python
  2. #
  3. # Copyright (C) 2014, Ansgar Burchardt <ansgar@debian.org>
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License along
  16. # with this program; if not, write to the Free Software Foundation, Inc.,
  17. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  18. from base_test import DakTestCase
  19. import unittest
  20. from daklib.architecture import match_architecture
  21. class MatchArchitecture(DakTestCase):
  22. def testEqual(self):
  23. self.assert_(match_architecture('amd64', 'amd64'))
  24. self.assert_(match_architecture('linux-amd64', 'linux-amd64'))
  25. self.assert_(match_architecture('linux-amd64', 'amd64'))
  26. self.assert_(match_architecture('amd64', 'linux-amd64'))
  27. self.assert_(not match_architecture('amd64', 'i386'))
  28. self.assert_(match_architecture('kfreebsd-amd64', 'kfreebsd-amd64'))
  29. self.assert_(not match_architecture('kfreebsd-amd64', 'amd64'))
  30. def testAny(self):
  31. self.assert_(match_architecture('amd64', 'any'))
  32. self.assert_(match_architecture('amd64', 'any-amd64'))
  33. self.assert_(match_architecture('x32', 'any-amd64'))
  34. self.assert_(match_architecture('kfreebsd-amd64', 'any-amd64'))
  35. self.assert_(not match_architecture('amd64', 'any-i386'))
  36. self.assert_(match_architecture('kfreebsd-amd64', 'kfreebsd-any'))
  37. self.assert_(not match_architecture('amd64', 'kfreebsd-any'))
  38. def testAll(self):
  39. self.assert_(match_architecture('all', 'all'))
  40. self.assert_(not match_architecture('amd64', 'all'))
  41. self.assert_(not match_architecture('all', 'amd64'))
  42. self.assert_(not match_architecture('all', 'any'))
  43. if __name__ == '__main__':
  44. unittest.main()