A comprehensive library management system built using C, Shell scripting, and Socket programming. This system provides robust functionality for both admin and clients, ensuring efficient management of library resources and user operations.
-
Admin Features:
- Login and Signup functionalities.
- Add, update, delete books (CRUD operations).
- View current borrow/return logs.
-
Client Features:
- Borrow and return books seamlessly.
- View available books and transaction history.
- Process Management: Efficient handling of multiple users using multi-threading.
- File Handling & Locking: Secure access to resources via file system operations and locks.
- Inter-process Communication (IPC): Facilitates smooth interactions between clients and server using socket programming.
- Multi-threading: Enables simultaneous operations for better performance.
- Clone the repository:
git clone https://github.com/sassy2711/OnlineLibraryManagementSystem.git
- Open two terminals.
- Run the server on one terminal:-
gcc library_server.c -lpthread ./a.out
- Run the client on the other terminal:-
gcc library_client.c -lpthread ./a.out
- You will see a menu in the client side.
- Follow the instructions and enjoy.
The provided code performs unit testing for a library management system using the CUnit testing framework. It ensures the functionality of various modules, including admin operations, book management, member management, and borrowing/returning books.
Below given is the description for each test suite:
-
test_admin_check_valid_credentials()
Tests whether valid admin credentials are correctly recognized by theadmin_check
function. -
test_admin_check_invalid_credentials()
Tests whether invalid admin credentials are correctly rejected by theadmin_check
function.
-
test_add_new_book()
Tests the functionality of adding a new book to the system by checking if the book details are correctly written tobooks.txt
. -
test_remove_book_found()
Tests the removal of a book that exists in the system, expecting success. -
test_remove_book_not_found()
Tests the removal of a book that does not exist in the system, expecting failure. -
test_search_book_found()
Tests searching for a book that exists, expecting success. -
test_search_book_not_found()
Tests searching for a book that does not exist, expecting failure. -
test_modify_book_count_success()
Tests modifying the count of a book that exists in the system, expecting success. -
test_modify_book_count_failure()
Tests modifying the count of a book that does not exist, expecting failure. -
test_display_books_non_empty()
Tests displaying the list of books when there are entries in the database, expecting success. -
test_display_books_empty()
Tests displaying the list of books when the database is empty, expecting failure.
-
test_add_member_success()
Tests adding a new member with valid credentials, expecting success. -
test_add_member_failure()
Tests adding a new member with invalid or empty input, expecting failure. -
test_login_member_success()
Tests logging in with valid member credentials, expecting success. -
test_login_member_failure()
Tests logging in with invalid credentials, expecting failure. -
test_remove_member_success()
Tests removing a member who exists in the system, expecting success. -
test_remove_member_failure()
Tests removing a member who does not exist, expecting failure. -
test_display_members_non_empty()
Tests displaying the list of members when there are entries, expecting success. -
test_display_members_empty()
Tests displaying the list of members when the database is empty, expecting failure.
-
test_borrow_book()
Tests borrowing a book by decrementing its count inbooks.txt
and adding an entry toborrowed_books.txt
. -
test_return_book()
Tests returning a borrowed book by incrementing its count inbooks.txt
and removing the corresponding entry fromborrowed_books.txt
.