Skip to content

Commit

Permalink
why are the gtest framework tests failing when my custom old tests work?
Browse files Browse the repository at this point in the history
  • Loading branch information
schwehr committed Mar 31, 2011
1 parent 5e26e80 commit 1a757ea
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 76 deletions.
14 changes: 10 additions & 4 deletions Makefile-custom
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# -*- makefile -*-
VERSION:=${shell cat VERSION}

#CXX:=g++-fsf-4.4 -m32

CXXFLAGS :=
#CXXFLAGS += -O3 -funroll-loops -fexpensive-optimizations -DNDEBUG
#CXXFLAGS += -ffast-math

#CXXFLAGS := -g3 -O0
CXXFLAGS := -g3 -O2 -32
#CXXFLAGS := -g3 -O0 -m32
CXXFLAGS := -g3 -O2
#CXXFLAGS += -D_GLIBCXX_DEBUG # Appears broken
CXXFLAGS += -Wall
CXXFLAGS += -Wimplicit
Expand Down Expand Up @@ -129,5 +131,9 @@ ais19.o: ais.h
ais_py.o: ais.h
test_libais.o: ais.h

ais8_001_22_unittest: ais8_001_22_unittest.cpp ais8_001_22.o ais.o
g++ -32 -g -Wall $^ -o $@ -L/sw/lib -I/sw/include -lgtest -lgtest_main
test2: ais8_001_22_unittest

#
ais8_001_22_unittest: ais8_001_22_unittest.cpp ais8_001_22.o ais.o ais8.o
${CXX} -g -Wall $^ -o $@ -L/sw/lib -I/sw/include -lgtest -lgtest_main
./$@
15 changes: 12 additions & 3 deletions ais8_001_22_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,23 @@ const string nth_field(const string &str, const size_t n, const char c) {
}

TEST(EmptyTest, Empty) {

// FIX: test the empty string case. What should it do?
}

// This is really not working right. What is going on?
TEST(PointTest, Point) {
// AreaNotice: type=0 start=2011-07-06 00:00:00 duration=60 m link_id=10 sub-areas: 1
const string msg_str = "!AIVDM,1,1,,A,81mg=5@0EP:0>H0007P>0<D1<qp400000,0*1D";
const string body(nth_field(msg_str,5,','));
cout << "body: " << body << endl;
Ais8_001_22 msg("81mg=5@0EP:0>H0007P>0<D1<qp400000");

Ais8_001_22 msg(body.c_str());
cout << "msg8_1_22: " << endl;
msg.print();
cout << "mid:" << msg.message_id << endl;
EXPECT_EQ(msg.message_id,8);
EXPECT_EQ(msg.repeat_indicator,0);
EXPECT_EQ(msg.mmsi,123456789);
EXPECT_EQ(msg.spare,0);
EXPECT_EQ(msg.dac,1);
EXPECT_EQ(msg.fi,22);
} // PointTest
Loading

0 comments on commit 1a757ea

Please sign in to comment.