blob: 2eeecd7dfd87725507ac1eb0487236544c197427 [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
Dave Wallace8800f732023-08-31 00:47:44 -04005from asfframework import VppAsfTestCase, VppTestRunner
Stevenb0598492018-10-24 21:15:45 -07006
7
Dave Wallace8800f732023-08-31 00:47:44 -04008class TestString(VppAsfTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02009 """String Test Cases"""
Stevenb0598492018-10-24 21:15:45 -070010
11 @classmethod
12 def setUpClass(cls):
13 super(TestString, cls).setUpClass()
14
Paul Vinciguerra7f9b7f92019-03-12 19:23:27 -070015 @classmethod
16 def tearDownClass(cls):
17 super(TestString, cls).tearDownClass()
18
Stevenb0598492018-10-24 21:15:45 -070019 def setUp(self):
20 super(TestString, self).setUp()
21
22 def tearDown(self):
23 super(TestString, self).tearDown()
24
25 def test_string_unittest(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020026 """String unit tests"""
27 names = [
28 "memcpy_s",
29 "clib_memcmp",
30 "clib_memcpy",
31 "clib_memset",
32 "clib_strcmp",
33 "clib_strncmp",
34 "clib_strncpy",
35 "clib_strnlen",
36 "clib_strtok",
37 "memcmp_s",
38 "memcpy_s",
39 "memset_s ",
40 "strcat_s",
41 "strcmp_s",
42 "strcpy_s",
43 "strncat_s",
44 "strncmp_s",
45 "strncpy_s",
46 "strnlen_s",
47 "strstr_s",
48 "strtok_s",
49 ]
Stevenb0598492018-10-24 21:15:45 -070050
51 for name in names:
52 error = self.vapi.cli("test string " + name)
53 if error.find("failed") != -1:
54 self.logger.critical("FAILURE in the " + name + " test")
Paul Vinciguerra9a6dafd2019-03-06 15:11:28 -080055 self.assertNotIn("failed", error)
Stevenb0598492018-10-24 21:15:45 -070056
Steven Luong51ddd382021-11-03 15:33:21 -070057
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020058if __name__ == "__main__":
Stevenb0598492018-10-24 21:15:45 -070059 unittest.main(testRunner=VppTestRunner)