A lightweight C application for managing system testing data records with full CRUD operations, search functionality, data recovery features, and comprehensive test suites.
- CRUD Operations: Create, Read, Update, Delete test records
- Search & Filter: Search across all record fields with pagination
- Data Recovery: Soft delete with recovery options
- Input Validation: Robust validation for all user inputs
- Cross-platform: Windows, Linux, and macOS support
- Memory Safe: Comprehensive memory management and testing
- Modular Design: Separated unit tests and E2E tests
- Automated Testing: Built-in unit tests and end-to-end tests
testdata-manager/
├── main.h # Main header file with declarations
├── main.c # Core application logic
├── unit_tests.h # Unit test declarations
├── unit_tests.c # Unit test implementations
├── e2e_tests.h # E2E test declarations
├── e2e_tests.c # E2E test implementations
├── Makefile # Build automation
├── HOW_TO_COMPILE.md # Comprehensive compilation guide (Thai)
├── README.md # This file
└── .gitignore # Git ignore rules
- Compiler: GCC (MinGW on Windows) or Clang
- Make: Optional but recommended
- OS: Windows 7+, Linux, or macOS
# Build the program
make
# Build with debugging symbols
make debug
# Build optimized version
make release
# Clean build artifacts
make clean
# Build and run
make run
# Show all available commands
make helpLinux/macOS:
gcc -o testdata-manager main.c unit_tests.c e2e_tests.c -Wall -WextraWindows (MinGW):
gcc -o testdata-manager.exe main.c unit_tests.c e2e_tests.c -Wall -WextraDebug build:
gcc -g -o testdata-manager-debug main.c unit_tests.c e2e_tests.c -Wall -WextraLinux/macOS:
./testdata-managerWindows:
testdata-manager.exeInstall Valgrind (Ubuntu/Debian):
sudo apt-get install valgrindRun with memory checking:
# Basic memory check
valgrind --leak-check=full ./testdata-manager
# Detailed analysis
valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes ./testdata-manager
# Memory error detection
valgrind --tool=memcheck --track-origins=yes ./testdata-manager- Database Selection: Choose an existing CSV file or create a new database
- CSV Format: Files must have the header:
TestID,SystemName,TestType,TestResult,Active
- View all active records with pagination
- Automatic pagination for large datasets
- System Name: 3+ characters, alphanumeric with
()[]-._allowed - Test Type: 3+ characters, alphanumeric only
- Test Result: Pending, Failed, Passed, Success
- Search across TestID, SystemName, TestType, TestResult
- Minimum 3 characters required
- Case-insensitive search
- Modify SystemName, TestType, or TestResult
- Preview changes before saving
- Rollback support
- View soft-deleted records
- Recover or permanently delete records
The project includes test files in test_files/ directory:
valid_basic.csv- Basic valid recordsrealistic_test_data.csv- Production-like datamemory_test_10k.csv- Performance testing data
# Run built-in unit tests
./testdata-manager
# Select option 7 > 1 (Unit tests)# Run E2E tests
./testdata-manager
# Select option 7 > 2 (End-to-end tests)# Test with sample data
valgrind --leak-check=full ./testdata-manager < test_input.txt
# Load large dataset for stress testing
cp test_files/memory_test_10k.csv current_test.csv
valgrind ./testdata-managerTestID,SystemName,TestType,TestResult,Active
1,Web Application,UnitTest,Passed,1
2,API Gateway,IntegrationTest,Failed,1
3,Database Layer,SystemTest,Pending,0Field Specifications:
TestID: Positive integer (auto-generated)SystemName: 3+ chars, alphanumeric with special chars allowedTestType: 3+ chars, alphanumeric onlyTestResult: Failed, Passed, Pending, SuccessActive: 1 (active) or 0 (deleted)
Memory allocation failed:
- Check available system memory
- Reduce dataset size if necessary
Invalid CSV header:
- Ensure exact header format:
TestID,SystemName,TestType,TestResult,Active - No extra spaces or different casing
Compilation errors on Windows:
- Install MinGW-w64
- Use Windows-compatible paths
Compile with debug flags for detailed logging:
gcc -o testdata-manager main.c -g -DDEBUG -fsanitize=address- Fork the repository
- Create a feature branch
- Test with Valgrind (Linux) or similar tools
- Submit a pull request
This project is open source. See LICENSE file for details.