@@ -57,3 +57,49 @@ TEST_F(test, utils_parse_var) {
5757 EXPECT_TRUE (utils_parse_var (" test1;test2;test3,abc;test4" , " test3" , &arg));
5858 EXPECT_TRUE (utils_parse_var (" test1;test2;test3;test4,abc" , " test4" , &arg));
5959}
60+
61+ TEST_F (test, utils_translate_mem_visibility_flag) {
62+ umf_memory_visibility_t in_flag = static_cast <umf_memory_visibility_t >(0 );
63+ unsigned out_flag;
64+ auto ret = utils_translate_mem_visibility_flag (in_flag, &out_flag);
65+ EXPECT_EQ (ret, UMF_RESULT_ERROR_INVALID_ARGUMENT);
66+ }
67+
68+ TEST_F (test, utils_shm_open) {
69+ auto ret = utils_shm_open (NULL );
70+ ASSERT_EQ (ret, -1 );
71+
72+ ret = utils_shm_open (" invalid_path" );
73+ ASSERT_EQ (ret, -1 );
74+ }
75+
76+ TEST_F (test, utils_get_file_size) {
77+ size_t size;
78+ auto ret = utils_get_file_size (-1 , &size);
79+ ASSERT_EQ (ret, -1 );
80+
81+ int fd = utils_create_anonymous_fd ();
82+ ret = utils_get_file_size (fd, &size);
83+ ASSERT_EQ (ret, 0 );
84+ ASSERT_EQ (size, 0 );
85+ }
86+
87+ TEST_F (test, utils_set_file_size) {
88+ auto ret = utils_set_file_size (-1 , 256 );
89+ ASSERT_EQ (ret, -1 );
90+ }
91+
92+ TEST_F (test, utils_shm_create) {
93+ auto ret = utils_shm_create (NULL , 0 );
94+ ASSERT_EQ (ret, -1 );
95+
96+ ret = utils_shm_create (" " , 256 );
97+ ASSERT_EQ (ret, -1 );
98+
99+ ret = utils_shm_create (" /abc" , 256 );
100+ ASSERT_GE (ret, 0 );
101+
102+ ret = utils_shm_create (" /abc" , -1 );
103+ ASSERT_EQ (ret, -1 );
104+ }
105+
0 commit comments