Skip to content

Commit

Permalink
Merge pull request #59 from pierrekraemer/pierre
Browse files Browse the repository at this point in the history
update unit tests to compile
  • Loading branch information
pierrekraemer committed Dec 21, 2015
2 parents b791c88 + 14e0be6 commit d9ca3ca
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 31 deletions.
4 changes: 3 additions & 1 deletion cgogn/core/basic/cell.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#define CORE_BASIC_CELL_H_

#include <core/basic/dart.h>

#include <utils/assert.h>
#include <utils/definitions.h>

/**
Expand Down Expand Up @@ -60,7 +62,7 @@ inline std::string orbit_name(Orbit orbit)
case Orbit::PHI2_PHI3: return "Orbit::PHI2_PHI3"; break;
case Orbit::PHI21: return "Orbit::PHI21"; break;
case Orbit::PHI21_PHI31: return "Orbit::PHI21_PHI31"; break;
default: cgogn_assert_not_reached("orbit of this name do not exist"); break;
default: cgogn_assert_not_reached("This orbit does not exist"); break;
}
return "UNKNOWN";
}
Expand Down
3 changes: 2 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

project(cgogn_test
LANGUAGES CXX)
LANGUAGES CXX
)

set(CGOGN_TEST_PREFIX "test_")

Expand Down
4 changes: 2 additions & 2 deletions thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
if (CGOGN_PROVIDE_EIGEN)
if(CGOGN_PROVIDE_EIGEN)
add_subdirectory(eigen-3.2.7)
endif(CGOGN_PROVIDE_EIGEN)

if(CGOGN_BUILD_TESTS)
add_subdirectory(gtest)
endif(CGOGN_BUILD_TESTS)
endif(CGOGN_BUILD_TESTS)
5 changes: 1 addition & 4 deletions utest/cgogn/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ set(SOURCE_FILES
# basic/cell_marker_test.cpp

container/chunk_array_container_test.cpp

main.cpp
)

Expand All @@ -18,10 +19,6 @@ add_executable(${PROJECT_NAME} ${SOURCE_FILES})
target_link_libraries(cgogn_core_test gtest cgogn_core)

target_include_directories(cgogn_core_test PRIVATE ${CMAKE_SOURCE_DIR}/thirdparty/gtest/include)
target_include_directories(cgogn_core_test PRIVATE ${CMAKE_SOURCE_DIR}/cgogn)


link_directories(${CMAKE_SOURCE_DIR}/thirdparty/gtest/lib)


add_test(NAME "${PROJECT_NAME}" WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" COMMAND ${PROJECT_NAME})
24 changes: 12 additions & 12 deletions utest/cgogn/core/basic/cell_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,46 +21,46 @@ const Dart dmax(std::numeric_limits<unsigned int>::max());

TEST(CellTest, DefaultConstructor)
{
Cell<VERTEX1> c;
Cell<Orbit::DART> c;
Dart d = c;
EXPECT_EQ(std::numeric_limits<unsigned int>::max(), d.index);
}

TEST(CellTest, Constructor)
{
Cell<VERTEX1> c(dglobal);
Cell<Orbit::DART> c(dglobal);
Dart d = c;
EXPECT_EQ(10u, d.index);
}

TEST(CellTest, OutOfLimitConstructor)
{
Cell<VERTEX1> c1 = dmax;
Cell<Orbit::DART> c1 = dmax;
Dart d1 = c1;
Cell<VERTEX1> c2;
Cell<Orbit::DART> c2;
Dart d2 = c2;
EXPECT_EQ(d1.index, d2.index);
}

TEST(CellTest, CopyConstructor)
{
Cell<VERTEX1> c = dglobal;
Cell<Orbit::DART> c = dglobal;
Dart d = c;
Cell<VERTEX1> ccopy(c);
Cell<Orbit::DART> ccopy(c);
Dart dcopy = ccopy;
EXPECT_EQ(d.index, dcopy.index);
}

TEST(CellTest, IsValid)
{
Cell<VERTEX1> c = dglobal;
Cell<Orbit::DART> c = dglobal;
EXPECT_TRUE(c.is_valid());
}

TEST(CellTest, Assignation)
{
Cell<VERTEX1> c1 = dglobal;
Cell<VERTEX1> c2;
Cell<Orbit::DART> c1 = dglobal;
Cell<Orbit::DART> c2;
c2 = c1;

Dart d2 = c2;
Expand All @@ -70,15 +70,15 @@ TEST(CellTest, Assignation)

TEST(CellTest, PrintingOut)
{
Cell<VERTEX1> c = dglobal;
Cell<Orbit::DART> c = dglobal;
std::ostringstream s;
s << "c=" << c;
EXPECT_EQ(0, strcmp(s.str().c_str(), "c=10"));
}

TEST(CellTest, ReadingIn)
{
Cell<VERTEX1> c;
Cell<Orbit::DART> c;
std::istringstream s("10");
s >> c;

Expand All @@ -87,4 +87,4 @@ TEST(CellTest, ReadingIn)
EXPECT_EQ(10u, d.index);
}

} //namespace cgogn
} // namespace cgogn
2 changes: 1 addition & 1 deletion utest/cgogn/core/basic/dart_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ TEST(DartTest, ReadingIn)
EXPECT_EQ(10u, d.index);
}

} //namespace cgogn
} // namespace cgogn
8 changes: 3 additions & 5 deletions utest/cgogn/core/container/chunk_array_container_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace cgogn

class ChunkArrayContainerTest : public ::testing::Test
{

protected:

ChunkArrayContainerTest()
{}

Expand All @@ -21,10 +21,8 @@ class ChunkArrayContainerTest : public ::testing::Test
void testAddAttribute()
{
std::cout << "test" << std::endl;
//avec un grand nombre de type
//
// avec un grand nombre de type
}

};

// Test
Expand All @@ -33,4 +31,4 @@ TEST_F(ChunkArrayContainerTest, testAddAttribute)
this->testAddAttribute();
}

} //end namespace cgogn
} // namespace cgogn
12 changes: 7 additions & 5 deletions utest/cgogn/core/main.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#include <iostream>

#include "gtest/gtest.h"

int main(int argc, char **argv) {
testing::InitGoogleTest(&argc, argv);
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);

// Set LC_CTYPE according to the environnement variable.
setlocale(LC_CTYPE, "");
// Set LC_CTYPE according to the environnement variable.
setlocale(LC_CTYPE, "");

return RUN_ALL_TESTS();
return RUN_ALL_TESTS();
}

0 comments on commit d9ca3ca

Please sign in to comment.