trick/trick_source/trick_utils/trick_adt/test/Makefile
jmpenn 1d0e324c6f
Fix a variety of bugs found in dllist.c while addressing Issue #1559. (#1577)
* Fix a variety of bugs found in dllist.c while addressing Issue #1559.

* Added More descriptive error messages.
* Wrote google-test based unit tests for the DLL List library.
* Deleted old, incomplete test program.
* Added new function DLL_ListContainsPos which determines whether the given list contains the node at the given pos.
* DLLFind bug: Added check to determine whether a compare function has been specified, and emit an error message if it hasn’t.
* DLL_FindIndex bug: Corrected bounds checking.
* DLL_GetAt bug: Added check to ensure that the specified pos is actually in the given list.
* DLL_SetAt bug: Added check to ensure that the specified pos is actually in the given list.
* DLL_RemoveAt: corrected logic mistake in NULL ptr check. Added check to ensure that the specified pos is actually in the given list.
* DLL_InsertBefore bug: element count not correctly updated.
* DLL_InsertAfter: next and prev ptrs not correctly updated, which corrupted the list.
* DLL_GetNext bug: logic error in NULL ptr checks. Added check to ensure that the specified pos is actually in the given list.
* DLL_GetPrev bug: logic error in NULL ptr checks. Added check to ensure that the specified pos is actually in the given list.
* DLL_AddHead: Fixed NULL check logic error.
* DLL_AddTail: Fixed NULL check logic error.

* Address review comments, remove extraneous make target.

* Change false to 0 in dllist.c
2023-10-05 13:33:38 -05:00

61 lines
2.2 KiB
Makefile

#SYNOPSIS:
#
# make [all] - makes everything.
# make TARGET - makes the given target.
# make clean - removes all files generated by make.
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
# Flags passed to the preprocessor.
TRICK_CXXFLAGS += -I$(GTEST_HOME)/include -I$(TRICK_HOME)/include -g -Wall -Wextra ${TRICK_SYSTEM_CXXFLAGS} ${TRICK_TEST_FLAGS}
TRICK_LIBS = ${TRICK_LIB_DIR}/libtrick.a
TRICK_EXEC_LINK_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main -lpthread
# Added for Ubuntu... not required for other systems.
TRICK_EXEC_LINK_LIBS += -lpthread
# ==================================================================================
# All tests produced by this Makefile. Add new tests you create to this list.
# ==================================================================================
TESTS = dllist_unittest
# List of XML files produced by the tests.
unittest_results = $(patsubst %,%.xml,$(TESTS))
# List if Test-specific object files.
unittest_objects = $(patsubst %,%.o,$(TESTS))
# House-keeping build targets.
# ==================================================================================
# TARGETS
# ==================================================================================
all : test
test: unit_tests $(unittest_results)
unit_tests: $(TESTS)
clean :
rm -f $(TESTS)
rm -f *.o
# ==================================================================================
# Generate JUNIT (XML) Test Results
# ==================================================================================
$(unittest_results): %.xml: %
./$< --gtest_output=xml:${TRICK_HOME}/trick_test/$@
# ==================================================================================
# Build Unit test Objects
# ==================================================================================
$(unittest_objects): %.o: %.cpp
$(TRICK_CXX) $(TRICK_CXXFLAGS) -c $<
# ==================================================================================
# Build Unit test programs
# ==================================================================================
$(TESTS) : %: %.o
$(TRICK_CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(TRICK_LIBS) $(TRICK_EXEC_LINK_LIBS)