From 5ff26a686cd2d5b191846e637907fa9800ccedf1 Mon Sep 17 00:00:00 2001 From: bereck-work Date: Fri, 21 Nov 2025 08:48:45 +0000 Subject: [PATCH] (Feat): Added tests, added benchmarking and coverage --- Makefile | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2e0de15..3a54425 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -# zipprine Makefile - Cross-platform build system +# zipprine Makefile # Build for all major architectures .PHONY: all build clean install test help deps build-all release @@ -53,9 +53,30 @@ deps: ## Download dependencies test: ## Run tests @echo "$(BLUE)๐Ÿงช Running tests...$(NC)" - @$(GOTEST) -v ./... + @$(GOTEST) -race -timeout 30s ./... @echo "$(GREEN)โœ… Tests passed$(NC)" +test-verbose: ## Run tests with verbose output + @echo "$(BLUE)๐Ÿงช Running tests (verbose)...$(NC)" + @$(GOTEST) -v -race -timeout 30s ./... + @echo "$(GREEN)โœ… Tests passed$(NC)" + +test-coverage: ## Run tests with coverage report + @echo "$(BLUE)๐Ÿ“Š Running tests with coverage...$(NC)" + @mkdir -p $(BUILD_DIR) + @$(GOTEST) -race -coverprofile=$(BUILD_DIR)/coverage.out -covermode=atomic ./... + @$(GOCMD) tool cover -html=$(BUILD_DIR)/coverage.out -o $(BUILD_DIR)/coverage.html + @echo "$(GREEN)โœ… Coverage report generated: $(BUILD_DIR)/coverage.html$(NC)" + @$(GOCMD) tool cover -func=$(BUILD_DIR)/coverage.out | tail -n 1 + +bench: ## Run benchmarks + @echo "$(BLUE)๐Ÿ“Š Running benchmarks...$(NC)" + @$(GOTEST) -bench=. -benchmem -run=^$$ ./... + @echo "$(GREEN)โœ… Benchmarks complete$(NC)" + +test-all: test-coverage bench ## Run all tests with coverage and benchmarks + @echo "$(GREEN)โœจ All tests and benchmarks complete$(NC)" + clean: ## Clean build artifacts @echo "$(YELLOW)๐Ÿงน Cleaning build artifacts...$(NC)" @$(GOCLEAN)