# SPDX-FileCopyrightText: 2024 Olivier Charvin
#
# SPDX-License-Identifier: CC0-1.0

test:
	@$(MAKE) -s test-go-cover
	@$(MAKE) -s test-license

test-go-cover:
	go test -race -cover -coverpkg=./... -coverprofile $(COVERFOLDER)cover.all.out ./...
	@echo "Check if total coverage > 80%"
	@go tool cover -func $(COVERFOLDER)cover.all.out | tail -n1 | tee $(COVERFOLDER)cover.summary.out
	@grep -qE '([89][0-9](\.[0-9])?%)|100\.0%' $(COVERFOLDER)cover.summary.out
	@rm $(COVERFOLDER)cover.*.out

test-license:
	reuse lint