@@ -106,49 +106,6 @@ FOSSIL_TEST_CASE(c_test_stream_seek_and_tell) {
106106 fossil_fstream_close (& c_stream );
107107}
108108
109- FOSSIL_TEST_CASE (c_test_stream_read_buffered ) {
110- const char * filename = "testfile_buffered.txt" ;
111- const char * content = "Buffered read test content." ;
112- char buffer [1024 ];
113-
114- // Write data to the file
115- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_open (& c_stream , filename , "w" ));
116- fossil_fstream_write (& c_stream , content , strlen (content ), 1 );
117- fossil_fstream_close (& c_stream );
118-
119- // Read data from the file with buffering
120- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_read_buffered (filename , buffer , strlen (content )));
121- ASSUME_ITS_EQUAL_CSTR (content , buffer );
122- }
123-
124- FOSSIL_TEST_CASE (c_test_stream_write_buffered ) {
125- const char * filename = "testfile_buffered_write.txt" ;
126- const char * content = "Buffered write test content." ;
127-
128- // Write data to the file with buffering
129- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_write_buffered (filename , content , strlen (content )));
130-
131- // Read data from the file to verify
132- char buffer [1024 ];
133- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_open (& c_stream , filename , "r" ));
134- fossil_fstream_read (& c_stream , buffer , sizeof (buffer ), 1 );
135- fossil_fstream_close (& c_stream );
136-
137- ASSUME_ITS_EQUAL_CSTR (content , buffer );
138- }
139-
140- FOSSIL_TEST_CASE (c_test_stream_lock_and_unlock ) {
141- const char * filename = "testfile_lock.txt" ;
142-
143- // Create and lock the file
144- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_open (& c_stream , filename , "w" ));
145- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_lock (filename ));
146- fossil_fstream_close (& c_stream );
147-
148- // Unlock the file
149- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_unlock (filename ));
150- }
151-
152109FOSSIL_TEST_CASE (c_test_stream_get_type ) {
153110 const char * filename = "testfile_type.txt" ;
154111
@@ -160,71 +117,6 @@ FOSSIL_TEST_CASE(c_test_stream_get_type) {
160117 ASSUME_ITS_EQUAL_I32 (2 , fossil_fstream_get_type (filename )); // Regular file
161118}
162119
163- FOSSIL_TEST_CASE (c_test_stream_check_permission ) {
164- const char * filename = "testfile_permission.txt" ;
165-
166- // Create the file
167- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_open (& c_stream , filename , "w" ));
168- fossil_fstream_close (& c_stream );
169-
170- // Check read and write permissions
171- ASSUME_ITS_EQUAL_I32 (1 , fossil_fstream_check_permission (filename , "r" ));
172- ASSUME_ITS_EQUAL_I32 (1 , fossil_fstream_check_permission (filename , "w" ));
173- }
174-
175- FOSSIL_TEST_CASE (c_test_stream_set_and_get_permissions ) {
176- const char * filename = "testfile_set_permissions.txt" ;
177-
178- // Create the file
179- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_open (& c_stream , filename , "w" ));
180- fossil_fstream_close (& c_stream );
181-
182- // Set and get permissions
183- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_set_permissions (filename , 0644 ));
184- ASSUME_ITS_EQUAL_I32 (0644 , fossil_fstream_get_permissions (filename ));
185- }
186-
187- FOSSIL_TEST_CASE (c_test_stream_restrict_permissions ) {
188- const char * filename = "testfile_restrict.txt" ;
189-
190- // Create the file
191- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_open (& c_stream , filename , "w" ));
192- fossil_fstream_close (& c_stream );
193-
194- // Restrict permissions
195- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_restrict (filename ));
196- ASSUME_ITS_EQUAL_I32 (0600 , fossil_fstream_get_permissions (filename ));
197- }
198-
199- FOSSIL_TEST_CASE (c_test_stream_check_ownership ) {
200- const char * filename = "testfile_ownership.txt" ;
201-
202- // Create the file
203- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_open (& c_stream , filename , "w" ));
204- fossil_fstream_close (& c_stream );
205-
206- // Check ownership
207- ASSUME_ITS_EQUAL_I32 (1 , fossil_fstream_check_ownership (filename ));
208- }
209-
210- FOSSIL_TEST_CASE (c_test_stream_compare_permissions ) {
211- const char * filename1 = "testfile_compare1.txt" ;
212- const char * filename2 = "testfile_compare2.txt" ;
213-
214- // Create the files
215- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_open (& c_stream , filename1 , "w" ));
216- fossil_fstream_close (& c_stream );
217- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_open (& c_stream , filename2 , "w" ));
218- fossil_fstream_close (& c_stream );
219-
220- // Set permissions
221- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_set_permissions (filename1 , 0644 ));
222- ASSUME_ITS_EQUAL_I32 (0 , fossil_fstream_set_permissions (filename2 , 0644 ));
223-
224- // Compare permissions
225- ASSUME_ITS_EQUAL_I32 (1 , fossil_fstream_compare_permissions (filename1 , filename2 ));
226- }
227-
228120// * * * * * * * * * * * * * * * * * * * * * * * *
229121// * Fossil Logic Test Pool
230122// * * * * * * * * * * * * * * * * * * * * * * * *
@@ -234,15 +126,7 @@ FOSSIL_TEST_GROUP(c_file_tests) {
234126 FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_let_open_and_close_file );
235127 FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_multiple_files );
236128 FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_seek_and_tell );
237- FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_read_buffered );
238- FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_write_buffered );
239- FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_lock_and_unlock );
240129 FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_get_type );
241- FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_check_permission );
242- FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_set_and_get_permissions );
243- FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_restrict_permissions );
244- FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_check_ownership );
245- FOSSIL_TEST_ADD (c_stream_suite , c_test_stream_compare_permissions );
246130
247131 FOSSIL_TEST_REGISTER (c_stream_suite );
248132}
0 commit comments