<commit_before># When running test cases on the development computer, don't compile with
# embedded libraries
#
OSTYPE := $(shell uname)

TEST_DIR = tests
TEST_OBJDIR = build/$(TEST_DIR)

TEST_SRC=$(wildcard $(TEST_DIR)/*_tests.cpp)
TESTS=$(patsubst %.cpp,$(TEST_OBJDIR)/%.bin,$(TEST_SRC))
TEST_LIBS = -lcheck
INCLUDE_PATHS += -I. -I./libs/cJSON

TESTABLE_OBJ_FILES = bitfield.o queue.o canutil.o canwrite.o canread.o \
				listener.o libs/cJSON/cJSON.o buffers.o strutil.o usbutil.o \
				serialutil.o ethernetutil.o shared_handlers.o
TESTABLE_LIB_SRCS = usbutil_mock.c serialutil_mock.c \
				canwrite_mock.c log_mock.c ethernetutil_mock.c
TESTABLE_LIB_OBJ_FILES = $(addprefix $(TEST_OBJDIR)/$(TEST_DIR)/, $(TESTABLE_LIB_SRCS:.c=.o))
TESTABLE_OBJS = $(patsubst %,$(TEST_OBJDIR)/%,$(TESTABLE_OBJ_FILES)) \
				$(TESTABLE_LIB_OBJ_FILES)

.PRECIOUS: $(TESTABLE_OBJS) $(TESTS:.bin=.o)

RED="$${txtbld}$$(tput setaf 1)"
GREEN="$${txtbld}$$(tput setaf 2)"
COLOR_RESET=$$(tput sgr0)

test: unit_tests
	@make pic32_compile_test
	@make lpc17xx_compile_test
	@make ford_test
	@make emulator_test
	@make uart_compile_test
	@make debug_compile_test
	@make ethernet_compile_test
	@echo "$(GREEN)All tests passed.$(COLOR_RESET)"

ifeq ($(OSTYPE),Darwin)
# gcc/g++ are the LLVM versions in OS X, which don't have coverage. must
# explicitly use clang/clang++
LLVM_BIN_FOLDER = $(DEPENDENCIES_FOLDER)/clang+llvm-3.2-x86_64-apple-darwin11/bin
TEST_CPP = $(LLVM_BIN_FOLDER)/clang++
TEST_CC = $(LLVM_BIN_FOLDER)/clang
TEST_LD = $(TEST_CPP)
else
TEST_LD = g++
TEST_CC = gcc
TEST_CPP = g++
endif

# In Linux, expect BROWSER to name the preferred browser binary
ifeq ($(OSTYPE),Darwin)
BROWSER = open
endif

# Guard against  line endings only in Cygwin
ifneq ($(OSTYPE),Darwin)
	OSTYPE := $(shell uname -o)
	ifeq ($(OSTYPE),Cygwin)
		TEST_SET_OPTS = igncr
	endif
endif

unit_tests: LD = $(TEST_LD)
unit_tests: CC = $(TEST_CC)
unit_tests: CPP = $(TEST_CPP)
unit_tests: CC_FLAGS = -I. -c -w -Wall -Werror -g -ggdb -coverage
unit_tests: CC_SYMBOLS = -D__TESTS__
unit_tests: LDFLAGS = -lm -coverage
unit_tests: LDLIBS = $(TEST_LIBS)
unit_tests: $(TESTS)
	@set -o $(TEST_SET_OPTS) >/dev/null 2>&1
	@export SHELLOPTS
	@sh tests/runtests.sh $(TEST_OBJDIR)/$(TEST_DIR)<commit_msg>Restore a comment mangled in a sed run.<commit_after># When running test cases on the development computer, don't compile with
# embedded libraries
#
OSTYPE := $(shell uname)

TEST_DIR = tests
TEST_OBJDIR = build/$(TEST_DIR)

TEST_SRC=$(wildcard $(TEST_DIR)/*_tests.cpp)
TESTS=$(patsubst %.cpp,$(TEST_OBJDIR)/%.bin,$(TEST_SRC))
TEST_LIBS = -lcheck
INCLUDE_PATHS += -I. -I./libs/cJSON

TESTABLE_OBJ_FILES = bitfield.o queue.o canutil.o canwrite.o canread.o \
				listener.o libs/cJSON/cJSON.o buffers.o strutil.o usbutil.o \
				serialutil.o ethernetutil.o shared_handlers.o
TESTABLE_LIB_SRCS = usbutil_mock.c serialutil_mock.c \
				canwrite_mock.c log_mock.c ethernetutil_mock.c
TESTABLE_LIB_OBJ_FILES = $(addprefix $(TEST_OBJDIR)/$(TEST_DIR)/, $(TESTABLE_LIB_SRCS:.c=.o))
TESTABLE_OBJS = $(patsubst %,$(TEST_OBJDIR)/%,$(TESTABLE_OBJ_FILES)) \
				$(TESTABLE_LIB_OBJ_FILES)

.PRECIOUS: $(TESTABLE_OBJS) $(TESTS:.bin=.o)

RED="$${txtbld}$$(tput setaf 1)"
GREEN="$${txtbld}$$(tput setaf 2)"
COLOR_RESET=$$(tput sgr0)

test: unit_tests
	@make pic32_compile_test
	@make lpc17xx_compile_test
	@make ford_test
	@make emulator_test
	@make uart_compile_test
	@make debug_compile_test
	@make ethernet_compile_test
	@echo "$(GREEN)All tests passed.$(COLOR_RESET)"

ifeq ($(OSTYPE),Darwin)
# gcc/g++ are the LLVM versions in OS X, which don't have coverage. must
# explicitly use clang/clang++
LLVM_BIN_FOLDER = $(DEPENDENCIES_FOLDER)/clang+llvm-3.2-x86_64-apple-darwin11/bin
TEST_CPP = $(LLVM_BIN_FOLDER)/clang++
TEST_CC = $(LLVM_BIN_FOLDER)/clang
TEST_LD = $(TEST_CPP)
else
TEST_LD = g++
TEST_CC = gcc
TEST_CPP = g++
endif

# In Linux, expect BROWSER to name the preferred browser binary
ifeq ($(OSTYPE),Darwin)
BROWSER = open
endif

# Guard against \r\n line endings only in Cygwin
ifneq ($(OSTYPE),Darwin)
	OSTYPE := $(shell uname -o)
	ifeq ($(OSTYPE),Cygwin)
		TEST_SET_OPTS = igncr
	endif
endif

unit_tests: LD = $(TEST_LD)
unit_tests: CC = $(TEST_CC)
unit_tests: CPP = $(TEST_CPP)
unit_tests: CC_FLAGS = -I. -c -w -Wall -Werror -g -ggdb -coverage
unit_tests: CC_SYMBOLS = -D__TESTS__
unit_tests: LDFLAGS = -lm -coverage
unit_tests: LDLIBS = $(TEST_LIBS)
unit_tests: $(TESTS)
	@set -o $(TEST_SET_OPTS) >/dev/null 2>&1
	@export SHELLOPTS
	@sh tests/runtests.sh $(TEST_OBJDIR)/$(TEST_DIR)
{'fraction_non_alphanumeric': 0.14225849139832378, 'fraction_numerical': 0.007498897220996913, 'mean_word_length': 5.324965132496513, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5787958', 'n_tokens_mistral': 1943, 'n_tokens_neox': 1823, 'n_words': 403}