blob: 866a65971070cfe65160ee5e95aaaa2c7eb16648 [file] [log] [blame]
Renato Botelho do Coutoead1e532019-10-31 13:31:07 -05001#!/usr/bin/env python3
Stevenb0598492018-10-24 21:15:45 -07002
3import unittest
4
5from framework import VppTestCase, VppTestRunner
6from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
7
8
9class TestString(VppTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020010 """String Test Cases"""
Stevenb0598492018-10-24 21:15:45 -070011
12 @classmethod
13 def setUpClass(cls):
14 super(TestString, cls).setUpClass()
15
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -070016 @classmethod
17 def tearDownClass(cls):
18 super(TestString, cls).tearDownClass()
19
Stevenb0598492018-10-24 21:15:45 -070020 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 Sekerad9b0c6f2022-04-26 19:02:15 +020027 """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 ]
Stevenb0598492018-10-24 21:15:45 -070051
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 Vinciguerra9a6dafd2019-03-06 15:11:28 -080056 self.assertNotIn("failed", error)
Stevenb0598492018-10-24 21:15:45 -070057
Steven Luong51ddd382021-11-03 15:33:21 -070058
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020059if __name__ == "__main__":
Stevenb0598492018-10-24 21:15:45 -070060 unittest.main(testRunner=VppTestRunner)