test_architecture.py 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #! /usr/bin/env python3
  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. import unittest
  19. from base_test import DakTestCase
  20. from daklib.architecture import match_architecture
  21. class MatchArchitecture(DakTestCase):
  22. def testEqual(self):
  23. self.assertTrue(match_architecture("amd64", "amd64"))
  24. self.assertTrue(match_architecture("linux-amd64", "linux-amd64"))
  25. self.assertTrue(match_architecture("linux-amd64", "amd64"))
  26. self.assertTrue(match_architecture("amd64", "linux-amd64"))
  27. self.assertTrue(not match_architecture("amd64", "i386"))
  28. self.assertTrue(match_architecture("kfreebsd-amd64", "kfreebsd-amd64"))
  29. self.assertTrue(not match_architecture("kfreebsd-amd64", "amd64"))
  30. def testAny(self):
  31. self.assertTrue(match_architecture("amd64", "any"))
  32. self.assertTrue(match_architecture("amd64", "any-amd64"))
  33. self.assertTrue(match_architecture("x32", "any-amd64"))
  34. self.assertTrue(match_architecture("kfreebsd-amd64", "any-amd64"))
  35. self.assertTrue(not match_architecture("amd64", "any-i386"))
  36. self.assertTrue(match_architecture("kfreebsd-amd64", "kfreebsd-any"))
  37. self.assertTrue(not match_architecture("amd64", "kfreebsd-any"))
  38. def testAll(self):
  39. self.assertTrue(match_architecture("all", "all"))
  40. self.assertTrue(not match_architecture("amd64", "all"))
  41. self.assertTrue(not match_architecture("all", "amd64"))
  42. self.assertTrue(not match_architecture("all", "any"))
  43. if __name__ == "__main__":
  44. unittest.main()