Skip to content

Commit

Permalink
Moved tests around. Set CPP standard for Tests to 17.
Browse files Browse the repository at this point in the history
  • Loading branch information
deltaphi committed Apr 28, 2019
1 parent a9051d7 commit f3e92ce
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
cmake_minimum_required (VERSION 3.6)
project (RR32CanControllerTest)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Download and unpack googletest at configure time
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
Expand Down Expand Up @@ -36,9 +40,9 @@ endif()
# Now simply link against gtest or gtest_main as needed. Eg
include_directories("src")
add_executable(RR32CanTest
test/BufferManagerTest.cpp
test/TextParserTest.cpp
test/CrcTest.cpp
test/RR32Can/BufferManagerTest.cpp
test/RR32Can/TextParserTest.cpp
test/RR32Can/CrcTest.cpp

src/RR32Can/util/BufferManager.h
src/RR32Can/util/BufferManager.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "RR32Can/util/BufferManager.h"

namespace RR32Can {

class BufferManagerFixture : public ::testing::Test {
protected:
void SetUp() {
Expand Down Expand Up @@ -425,4 +427,6 @@ TEST_F(BufferManagerFixtureWithData, subBuffer_offset_5_len_negative) {
EXPECT_EQ(subMgr.data(), mgr->data() + 5);
EXPECT_EQ(subMgr.length(), 0);
EXPECT_EQ(subMgr.capacity(), 11);
}
}

} /* namespace RR32Can */
6 changes: 5 additions & 1 deletion test/CrcTest.cpp → test/RR32Can/CrcTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "RR32Can/util/Crc.h"

namespace RR32Can {

TEST(Crc, empty) {
RR32Can::Crc crc;
crc.reset();
Expand Down Expand Up @@ -63,4 +65,6 @@ TEST(Crc, data1) {
}

EXPECT_TRUE(crc.isCrcValid());
}
}

} /* namespace RR32Can */
6 changes: 5 additions & 1 deletion test/TextParserTest.cpp → test/RR32Can/TextParserTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "RR32Can/util/TextParser.h"

namespace RR32Can {

constexpr uint8_t testData1NumChunks = 9;
char testData1[testData1NumChunks][8 + 1] = {
"[lokname", "n]\n .we", "rt=BR 96", " 1234\n ", ".wert=ET",
Expand Down Expand Up @@ -182,4 +184,6 @@ TEST_F(TextParserFixture, testData1) {
// Parser is reset to initial state
EXPECT_EQ(RR32Can::TextParser::State::LOOKING_FOR_KEY_OR_SECTION_START,
parser.getState());
}
}

} /* namespace RR32Can */

0 comments on commit f3e92ce

Please sign in to comment.