mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Fix 32 bit pipeline (#1430)
This commit is contained in:
parent
77fa8d78b0
commit
807161b19c
@ -8,7 +8,7 @@ clean: clean_test_client
|
|||||||
TEST_CLIENT_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main -lpthread -L${TRICK_LIB_DIR} -ltrick_var_binary_parser
|
TEST_CLIENT_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main -lpthread -L${TRICK_LIB_DIR} -ltrick_var_binary_parser
|
||||||
|
|
||||||
test_client: models/test_client/test_client.cpp
|
test_client: models/test_client/test_client.cpp
|
||||||
cd models/test_client; $(TRICK_CXX) test_client.cpp -o test_client $(TRICK_CXXFLAGS) -I$(TRICK_HOME)/include $(TEST_CLIENT_LIBS) -std=c++11
|
cd models/test_client; $(TRICK_CXX) test_client.cpp -o test_client $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -I$(TRICK_HOME)/include $(TEST_CLIENT_LIBS) -std=c++11
|
||||||
|
|
||||||
clean_test_client:
|
clean_test_client:
|
||||||
rm -f models/test_client/test_client
|
rm -f models/test_client/test_client
|
@ -6,7 +6,7 @@ include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
|||||||
|
|
||||||
#include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib
|
#include ${TRICK_HOME}/share/trick/makefiles/Makefile.tricklib
|
||||||
|
|
||||||
CFLAGS = -g -Wall -Wextra -std=c++11 $(TRICK_CXXFLAGS)
|
CPP_FLAGS = -g -Wall -Wextra -std=c++11 $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS)
|
||||||
INCLUDE_DIRS = -I${TRICK_HOME}/include
|
INCLUDE_DIRS = -I${TRICK_HOME}/include
|
||||||
OBJDIR = obj
|
OBJDIR = obj
|
||||||
LIBDIR = lib
|
LIBDIR = lib
|
||||||
@ -27,7 +27,8 @@ test: ${LIBDIR}/${LIBNAME}
|
|||||||
${MAKE} -C test
|
${MAKE} -C test
|
||||||
|
|
||||||
$(LIBOBJS): $(OBJDIR)/%.o : src/%.cc | $(OBJDIR)
|
$(LIBOBJS): $(OBJDIR)/%.o : src/%.cc | $(OBJDIR)
|
||||||
$(CPP) $(CFLAGS) ${INCLUDE_DIRS} -c $< -o $@
|
echo $(CPP_FLAGS)
|
||||||
|
$(CPP) $(CPP_FLAGS) ${INCLUDE_DIRS} -c $< -o $@
|
||||||
|
|
||||||
${LIBDIR}/${LIBNAME}: ${LIBOBJS} | ${LIBDIR}
|
${LIBDIR}/${LIBNAME}: ${LIBOBJS} | ${LIBDIR}
|
||||||
ar crs $@ ${LIBOBJS}
|
ar crs $@ ${LIBOBJS}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# # make clean - removes all files generated by make.
|
# # make clean - removes all files generated by make.
|
||||||
|
|
||||||
# Flags passed to the preprocessor.
|
# Flags passed to the preprocessor.
|
||||||
CPPFLAGS += -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS} -I../include -I${TRICK_HOME}/include
|
CPPFLAGS += -g -Wall -Wextra -std=c++11 ${TRICK_SYSTEM_CXXFLAGS} -I../include -I${TRICK_HOME}/include ${CXXFLAGS}
|
||||||
|
|
||||||
# TRICK_LIBS = ${TRICK_LIB_DIR}/libtrick_units.a
|
# TRICK_LIBS = ${TRICK_LIB_DIR}/libtrick_units.a
|
||||||
EXEC_LINK_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main
|
EXEC_LINK_LIBS += -L${GTEST_HOME}/lib64 -L${GTEST_HOME}/lib -lgtest -lgtest_main
|
||||||
@ -34,4 +34,4 @@ TEST_var_binary_parser.o : TEST_var_binary_parser.cc $(OTHER_OBJECTS)
|
|||||||
|
|
||||||
TEST_var_binary_parser : TEST_var_binary_parser.o $(OTHER_OBJECTS)
|
TEST_var_binary_parser : TEST_var_binary_parser.o $(OTHER_OBJECTS)
|
||||||
@echo 'Building TEST_var_binary_parser'
|
@echo 'Building TEST_var_binary_parser'
|
||||||
$(CXX) $(TRICK_SYSTEM_LDFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(LIBS) $(EXEC_LINK_LIBS)
|
$(CXX) $(TRICK_SYSTEM_LDFLAGS) $(CPPFLAGS) -o $@ $^ -L${TRICK_HOME}/lib_${TRICK_HOST_CPU} $(LIBS) $(EXEC_LINK_LIBS)
|
@ -795,12 +795,28 @@ TEST (BinaryParserTest, ParseUnsignedIntWrongType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST (BinaryParserTest, ParseLong) {
|
TEST (BinaryParserTest, ParseLong) {
|
||||||
|
// Var variable;
|
||||||
|
|
||||||
|
// // This is hard bc
|
||||||
|
// std::vector<unsigned char> bytes = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80};
|
||||||
|
// variable.setValue(bytes, 8, TRICK_LONG, false);
|
||||||
|
|
||||||
|
// EXPECT_EQ(variable.getValue<long>(), -9151314442816847873);
|
||||||
|
|
||||||
Var variable;
|
Var variable;
|
||||||
|
|
||||||
std::vector<unsigned char> bytes = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80};
|
// apparently this can be different by platform so we need to be careful here
|
||||||
variable.setValue(bytes, 8, TRICK_LONG, false);
|
size_t long_size = sizeof(long);
|
||||||
|
std::vector<unsigned char> bytes;
|
||||||
|
for (int i = 0; i < long_size-1; i++) {
|
||||||
|
bytes.push_back(0x00);
|
||||||
|
}
|
||||||
|
bytes.push_back(0x80);
|
||||||
|
|
||||||
|
variable.setValue(bytes, long_size, TRICK_LONG, false);
|
||||||
|
|
||||||
|
EXPECT_EQ(variable.getValue<long>(), LONG_MIN);
|
||||||
|
|
||||||
EXPECT_EQ(variable.getValue<long>(), -9151314442816847873);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST (BinaryParserTest, ParseLongWrongType) {
|
TEST (BinaryParserTest, ParseLongWrongType) {
|
||||||
@ -823,10 +839,17 @@ TEST (BinaryParserTest, ParseLongWrongType) {
|
|||||||
TEST (BinaryParserTest, ParseUnsignedLong) {
|
TEST (BinaryParserTest, ParseUnsignedLong) {
|
||||||
Var variable;
|
Var variable;
|
||||||
|
|
||||||
std::vector<unsigned char> bytes = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80};
|
// apparently this can be different by platform so we need to be careful here
|
||||||
variable.setValue(bytes, 8, TRICK_UNSIGNED_LONG, false);
|
size_t long_size = sizeof(unsigned long);
|
||||||
|
std::vector<unsigned char> bytes;
|
||||||
|
for (int i = 0; i < long_size-1; i++) {
|
||||||
|
bytes.push_back(0xFF);
|
||||||
|
}
|
||||||
|
bytes.push_back(0x7F);
|
||||||
|
|
||||||
EXPECT_EQ(variable.getValue<unsigned long>(), 9295429630892703743);
|
variable.setValue(bytes, long_size, TRICK_UNSIGNED_LONG, false);
|
||||||
|
|
||||||
|
EXPECT_EQ(variable.getValue<unsigned long>(), LONG_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST (BinaryParserTest, ParseUnsignedLongWrongType) {
|
TEST (BinaryParserTest, ParseUnsignedLongWrongType) {
|
||||||
|
Loading…
Reference in New Issue
Block a user