@@ -208,95 +208,6 @@ FOSSIL_TEST_CASE(c_test_io_validate_is_length_invalid) {
208
208
ASSUME_ITS_FALSE (result );
209
209
}
210
210
211
- FOSSIL_TEST_CASE (c_test_io_validate_read_secure_line_valid ) {
212
- char input_data [] = "SecureInput" ;
213
- char buffer [256 ];
214
- size_t buffer_size = sizeof (buffer );
215
-
216
- // Mocking user input
217
- FILE * input_stream = tmpfile ();
218
- fwrite (input_data , 1 , strlen (input_data ), input_stream );
219
- rewind (input_stream );
220
-
221
- int result = fossil_io_validate_read_secure_line (buffer , buffer_size );
222
-
223
- ASSUME_ITS_TRUE (result );
224
- ASSUME_ITS_EQUAL_CSTR (input_data , buffer );
225
- fclose (input_stream );
226
- }
227
-
228
- FOSSIL_TEST_CASE (c_test_io_validate_read_secure_line_invalid ) {
229
- char buffer [10 ]; // Small buffer to test overflow handling
230
- size_t buffer_size = sizeof (buffer );
231
-
232
- int result = fossil_io_validate_read_secure_line (buffer , buffer_size );
233
-
234
- ASSUME_ITS_FALSE (result ); // The function should fail due to insufficient buffer size
235
- }
236
-
237
- FOSSIL_TEST_CASE (c_test_io_display_menu ) {
238
- const char * choices [] = {"Choice 1" , "Choice 2" , "Choice 3" };
239
- int num_choices = 3 ;
240
- const char * prompt = "Please select an option:" ;
241
-
242
- // Here, we will mock user input. Let's assume user selects choice 1 (index 0)
243
- int selected_choice = fossil_io_display_menu (prompt , choices , num_choices );
244
-
245
- ASSUME_ITS_EQUAL_I32 (0 , selected_choice ); // User should select the first choice
246
- }
247
-
248
- FOSSIL_TEST_CASE (c_test_io_read_password_valid ) {
249
- char buffer [256 ];
250
- size_t size = sizeof (buffer );
251
-
252
- // Mock password input
253
- const char * password = "Password123" ;
254
- FILE * input_stream = tmpfile ();
255
- fwrite (password , 1 , strlen (password ), input_stream );
256
- rewind (input_stream );
257
-
258
- int result = fossil_io_read_password (buffer , size );
259
-
260
- ASSUME_ITS_TRUE (result );
261
- ASSUME_ITS_EQUAL_CSTR (password , buffer );
262
- fclose (input_stream );
263
- }
264
-
265
- FOSSIL_TEST_CASE (c_test_io_read_password_invalid ) {
266
- char buffer [10 ]; // Small buffer to test overflow handling
267
- size_t size = sizeof (buffer );
268
-
269
- int result = fossil_io_read_password (buffer , size );
270
-
271
- ASSUME_ITS_FALSE (result ); // Password input should fail due to small buffer size
272
- }
273
-
274
- FOSSIL_TEST_CASE (c_test_io_read_multiline_input_valid ) {
275
- char input_data [] = "This is line 1.\nThis is line 2." ;
276
- char buffer [256 ];
277
- size_t size = sizeof (buffer );
278
-
279
- // Mock multiline input
280
- FILE * input_stream = tmpfile ();
281
- fwrite (input_data , 1 , strlen (input_data ), input_stream );
282
- rewind (input_stream );
283
-
284
- int result = fossil_io_read_multiline_input (buffer , size );
285
-
286
- ASSUME_ITS_TRUE (result );
287
- ASSUME_ITS_EQUAL_CSTR (input_data , buffer );
288
- fclose (input_stream );
289
- }
290
-
291
- FOSSIL_TEST_CASE (c_test_io_read_multiline_input_invalid ) {
292
- char buffer [10 ]; // Small buffer to test overflow handling
293
- size_t size = sizeof (buffer );
294
-
295
- int result = fossil_io_read_multiline_input (buffer , size );
296
-
297
- ASSUME_ITS_FALSE (result ); // Multiline input should fail due to small buffer size
298
- }
299
-
300
211
FOSSIL_TEST_CASE (c_test_io_show_progress ) {
301
212
// This test assumes the progress bar function doesn't return anything.
302
213
// We'll just check that the progress is shown correctly.
@@ -329,14 +240,6 @@ FOSSIL_TEST_GROUP(c_input_tests) {
329
240
FOSSIL_TEST_ADD (c_input_suite , c_test_io_validate_is_email_invalid );
330
241
FOSSIL_TEST_ADD (c_input_suite , c_test_io_validate_is_length_valid );
331
242
FOSSIL_TEST_ADD (c_input_suite , c_test_io_validate_is_length_invalid );
332
-
333
- FOSSIL_TEST_ADD (c_input_suite , c_test_io_validate_read_secure_line_valid );
334
- FOSSIL_TEST_ADD (c_input_suite , c_test_io_validate_read_secure_line_invalid );
335
- FOSSIL_TEST_ADD (c_input_suite , c_test_io_display_menu );
336
- FOSSIL_TEST_ADD (c_input_suite , c_test_io_read_password_valid );
337
- FOSSIL_TEST_ADD (c_input_suite , c_test_io_read_password_invalid );
338
- FOSSIL_TEST_ADD (c_input_suite , c_test_io_read_multiline_input_valid );
339
- FOSSIL_TEST_ADD (c_input_suite , c_test_io_read_multiline_input_invalid );
340
243
FOSSIL_TEST_ADD (c_input_suite , c_test_io_show_progress );
341
244
342
245
FOSSIL_TEST_REGISTER (c_input_suite );
0 commit comments