mirror of
https://github.com/tkmxqrdxddd/davinci-video-converter
synced 2026-03-29 23:35:32 +02:00
test: add unit tests for parser, validator, and converter modules
- Add test_parser.cpp with argument parsing tests - Add test_validator.cpp with configuration validation tests - Add test_converter.cpp with FFmpeg command building tests - Update Makefile with test targets for unit tests - Update CI workflow to run make test - Add test binaries and media files to .gitignore
This commit is contained in:
27
Makefile
27
Makefile
@@ -28,11 +28,32 @@ install: $(TARGET)
|
||||
uninstall:
|
||||
rm -f /usr/local/bin/$(TARGET)
|
||||
|
||||
test: $(TARGET)
|
||||
@echo "Running tests..."
|
||||
test: $(TARGET) build_tests
|
||||
@echo "Running integration tests..."
|
||||
@./$(TARGET) --help
|
||||
@echo "Test: Help command passed"
|
||||
@./$(TARGET) 2>&1 | grep -q "Usage:" && echo "Test: No args passed" || (echo "Test failed" && exit 1)
|
||||
@echo "Running unit tests..."
|
||||
@./tests/test_parser
|
||||
@./tests/test_validator
|
||||
@./tests/test_converter
|
||||
@echo "All tests passed!"
|
||||
|
||||
.PHONY: all clean install uninstall test
|
||||
build_tests: test_parser_bin test_validator_bin test_converter_bin
|
||||
|
||||
test_parser_bin: tests/test_parser.cpp src/parser.cpp src/include/config.hpp
|
||||
@mkdir -p tests
|
||||
$(CXX) $(CXXFLAGS) $(INCLUDES) -o tests/test_parser tests/test_parser.cpp src/parser.cpp
|
||||
|
||||
test_validator_bin: tests/test_validator.cpp src/validator.cpp src/include/config.hpp
|
||||
@mkdir -p tests
|
||||
$(CXX) $(CXXFLAGS) $(INCLUDES) -o tests/test_validator tests/test_validator.cpp src/validator.cpp
|
||||
|
||||
test_converter_bin: tests/test_converter.cpp src/converter.cpp src/include/config.hpp
|
||||
@mkdir -p tests
|
||||
$(CXX) $(CXXFLAGS) $(INCLUDES) -o tests/test_converter tests/test_converter.cpp src/converter.cpp
|
||||
|
||||
clean-tests:
|
||||
rm -f tests/test_parser tests/test_validator tests/test_converter
|
||||
|
||||
.PHONY: all clean install uninstall test build_tests clean-tests
|
||||
|
||||
Reference in New Issue
Block a user