crypto crypto-openssl: support hashing operations
[vpp.git] / test / test_util.py
1 #!/usr/bin/env python3
2 """Test framework utility functions tests"""
3
4 import unittest
5 from framework import VppTestRunner, CPUInterface
6 from vpp_papi import mac_pton, mac_ntop
7
8
9 class TestUtil (CPUInterface, unittest.TestCase):
10     """ Test framework utility tests """
11
12     @classmethod
13     def is_tagged_run_solo(cls):
14         """ if the test case class is timing-sensitive - return true """
15         return False
16
17     @classmethod
18     def has_tag(cls, tag):
19         """ if the test case has a given tag - return true """
20         try:
21             return tag in cls.test_tags
22         except AttributeError:
23             pass
24         return False
25
26     @classmethod
27     def get_cpus_required(cls):
28         return 0
29
30     def test_mac_to_binary(self):
31         """ MAC to binary and back """
32         mac = 'aa:bb:cc:dd:ee:ff'
33         b = mac_pton(mac)
34         mac2 = mac_ntop(b)
35         self.assertEqual(type(mac), type(mac2))
36         self.assertEqual(mac2, mac)
37
38
39 if __name__ == '__main__':
40     unittest.main(testRunner=VppTestRunner)