Renato Botelho do Couto | ead1e53 | 2019-10-31 13:31:07 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Steven | b059849 | 2018-10-24 21:15:45 -0700 | [diff] [blame] | 2 | |
| 3 | import unittest |
| 4 | |
| 5 | from framework import VppTestCase, VppTestRunner |
| 6 | from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath |
| 7 | |
| 8 | |
| 9 | class TestString(VppTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame^] | 10 | """String Test Cases""" |
Steven | b059849 | 2018-10-24 21:15:45 -0700 | [diff] [blame] | 11 | |
| 12 | @classmethod |
| 13 | def setUpClass(cls): |
| 14 | super(TestString, cls).setUpClass() |
| 15 | |
Paul Vinciguerra | 7f9b7f9 | 2019-03-12 19:23:27 -0700 | [diff] [blame] | 16 | @classmethod |
| 17 | def tearDownClass(cls): |
| 18 | super(TestString, cls).tearDownClass() |
| 19 | |
Steven | b059849 | 2018-10-24 21:15:45 -0700 | [diff] [blame] | 20 | def setUp(self): |
| 21 | super(TestString, self).setUp() |
| 22 | |
| 23 | def tearDown(self): |
| 24 | super(TestString, self).tearDown() |
| 25 | |
| 26 | def test_string_unittest(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame^] | 27 | """String unit tests""" |
| 28 | names = [ |
| 29 | "memcpy_s", |
| 30 | "clib_memcmp", |
| 31 | "clib_memcpy", |
| 32 | "clib_memset", |
| 33 | "clib_strcmp", |
| 34 | "clib_strncmp", |
| 35 | "clib_strncpy", |
| 36 | "clib_strnlen", |
| 37 | "clib_strtok", |
| 38 | "memcmp_s", |
| 39 | "memcpy_s", |
| 40 | "memset_s ", |
| 41 | "strcat_s", |
| 42 | "strcmp_s", |
| 43 | "strcpy_s", |
| 44 | "strncat_s", |
| 45 | "strncmp_s", |
| 46 | "strncpy_s", |
| 47 | "strnlen_s", |
| 48 | "strstr_s", |
| 49 | "strtok_s", |
| 50 | ] |
Steven | b059849 | 2018-10-24 21:15:45 -0700 | [diff] [blame] | 51 | |
| 52 | for name in names: |
| 53 | error = self.vapi.cli("test string " + name) |
| 54 | if error.find("failed") != -1: |
| 55 | self.logger.critical("FAILURE in the " + name + " test") |
Paul Vinciguerra | 9a6dafd | 2019-03-06 15:11:28 -0800 | [diff] [blame] | 56 | self.assertNotIn("failed", error) |
Steven | b059849 | 2018-10-24 21:15:45 -0700 | [diff] [blame] | 57 | |
Steven Luong | 51ddd38 | 2021-11-03 15:33:21 -0700 | [diff] [blame] | 58 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame^] | 59 | if __name__ == "__main__": |
Steven | b059849 | 2018-10-24 21:15:45 -0700 | [diff] [blame] | 60 | unittest.main(testRunner=VppTestRunner) |