+++ /dev/null
-## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-cmake_minimum_required (VERSION 2.6)
-
-include(FindGTest)
-
-
-#FIND_PACKAGE(GTest REQUIRED)
-#INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
-
-#FIND_PACKAGE(GMock REQUIRED)
-#INCLUDE_DIRECTORIES(${GMOCK_INCLUDE_DIRS})
-
-
-# GCC 4.4.6 does not support some C++11 features used by GMock
-add_definitions(-DGTEST_LANG_CXX11=0)
-
-include_directories(
- $ENV{GTEST_ROOT}/googletest/include
- $ENV{GTEST_ROOT}/googlemock/include
-)
-
-set(GTEST_LIBRARY $ENV{GTEST_ROOT}/googlemock/make/gmock_main.a)
-
\ No newline at end of file
ADD_UNIT_TESTS(
TestPoint.py
)
-
-# ADD_SUBDIRECTORY (Test)
+++ /dev/null
-## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-include(GTest)
-
-set(PROJECT_SOURCES
- TestPoint.cpp
-)
-
-include_directories(
- ${PROJECT_SOURCE_DIR}/src/ConstructionAPI
- ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/Mock
-)
-
-set(PROJECT_LIBRARIES
- ModelAPI
- ModelHighAPI
- ConstructionAPI
-)
-
-set(PACKAGE_NAME "ConstructionAPI")
-set(TARGET_NAME "Test${PACKAGE_NAME}")
-
-add_executable(${TARGET_NAME} ${PROJECT_SOURCES})
-target_link_libraries(${TARGET_NAME} ${PROJECT_LIBRARIES} ${GTEST_LIBRARY})
-
-GTEST_ADD_TESTS(${CMAKE_BINARY_DIR}/bin/${TARGET_NAME} "" ${PROJECT_SOURCES})
+++ /dev/null
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include <Events_Loop.h>
-#include <Events_Error.h>
-
-#include <ModelAPI_Feature.h>
-#include <ModelHighAPI_Double.h>
-#include <ConstructionAPI_Point.h>
-
-#include <MockEvents_Listener.h>
-
-#include <MockModelAPI_AttributeDouble.h>
-#include <MockModelAPI_Data.h>
-#include <MockModelAPI_Document.h>
-#include <MockModelAPI_Feature.h>
-
-using ::testing::_;
-using ::testing::Return;
-using ::testing::ReturnRefOfCopy;
-using ::testing::Test;
-
-// TODO(spo): should be common function
-void null_deleter(void *) {}
-
-class ConstructionAPI_Point_Constructor_Test : public Test {
-public:
- MockEvents_Listener aErrorListener;
- MockModelAPI_AttributeDouble aMockAttributeDouble;
- MockModelAPI_Data aMockData;
- MockModelAPI_Feature aMockFeature;
- MockModelAPI_Document aMockDocument;
-
- ConstructionAPI_Point_Constructor_Test() {
- ON_CALL(aMockDocument, addFeature(_, _))
- .WillByDefault(Return(std::shared_ptr<ModelAPI_Feature>(&aMockFeature, &null_deleter)));
-
- ON_CALL(aMockFeature, getKind())
- .WillByDefault(ReturnRefOfCopy(std::string("Point")));
-
- ON_CALL(aMockFeature, data())
- .WillByDefault(Return(std::shared_ptr<ModelAPI_Data>(&aMockData, &null_deleter)));
-
- ON_CALL(aMockData, real(_))
- .WillByDefault(Return(std::shared_ptr<ModelAPI_AttributeDouble>(&aMockAttributeDouble, &null_deleter)));
-
- Events_Loop::loop()->registerListener(&aErrorListener, Events_Error::errorID());
- }
-
- ~ConstructionAPI_Point_Constructor_Test() {
- Events_Loop::loop()->removeListener(&aErrorListener);
- }
-
- void testInitializeFeature() {
- EXPECT_CALL(aMockFeature, getKind());
-
- EXPECT_CALL(aMockFeature, data())
- .Times(3);
-
- EXPECT_CALL(aMockData, real("x"));
- EXPECT_CALL(aMockData, real("y"));
- EXPECT_CALL(aMockData, real("z"));
- }
-
- void testSetAttributes() {
- EXPECT_CALL(aMockAttributeDouble, setValue(10));
- EXPECT_CALL(aMockAttributeDouble, setText("20"));
- EXPECT_CALL(aMockAttributeDouble, setText("x + 30"));
-
- EXPECT_CALL(aMockFeature, execute());
- }
-};
-
-TEST_F(ConstructionAPI_Point_Constructor_Test, GetEmptyFeature_SendException) {
- FeaturePtr aFeature;
-
- EXPECT_CALL(aErrorListener, processEvent(_));
-
- ConstructionAPI_Point aPoint(aFeature);
-}
-
-TEST_F(ConstructionAPI_Point_Constructor_Test, GetEmptyFeatureAndValues_SendException) {
- FeaturePtr aFeature;
-
- EXPECT_CALL(aErrorListener, processEvent(_));
-
- ConstructionAPI_Point aPoint(aFeature, 10, "20", std::string("x + 30"));
-}
-
-TEST_F(ConstructionAPI_Point_Constructor_Test, GetWrongFeature_SendException) {
- FeaturePtr aFeature(&aMockFeature, &null_deleter);
-
- ON_CALL(aMockFeature, getKind())
- .WillByDefault(ReturnRefOfCopy(std::string("WrongKind")));
-
- EXPECT_CALL(aMockFeature, getKind());
- EXPECT_CALL(aErrorListener, processEvent(_));
-
- ConstructionAPI_Point aPoint(aFeature);
-}
-
-
-TEST_F(ConstructionAPI_Point_Constructor_Test, GetFeature) {
- FeaturePtr aFeature(&aMockFeature, &null_deleter);
-
- testInitializeFeature();
-
- ConstructionAPI_Point aPoint(aFeature);
-}
-
-TEST_F(ConstructionAPI_Point_Constructor_Test, GetFeatureAndValues) {
- FeaturePtr aFeature(&aMockFeature, &null_deleter);
-
- testInitializeFeature();
- testSetAttributes();
-
- ConstructionAPI_Point aPoint(aFeature, 10, "20", std::string("x + 30"));
-}
-
-
-TEST_F(ConstructionAPI_Point_Constructor_Test, addPoint) {
- DocumentPtr aDocument(&aMockDocument, &null_deleter);
-
- EXPECT_CALL(aMockDocument, addFeature("Point", true));
-
- testInitializeFeature();
- testSetAttributes();
-
- PointPtr aPoint = addPoint(aDocument, 10, "20", std::string("x + 30"));
-}
TestInteger.py
TestRefAttr.py
)
-
-# ADD_SUBDIRECTORY (Test)
+++ /dev/null
-## Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-include(GTest)
-
-set(PROJECT_SOURCES
- TestDouble.cpp
- TestSelection.cpp
-)
-
-include_directories(
- ${PROJECT_SOURCE_DIR}/src/ModelHighAPI
- ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/Mock
-)
-
-set(PROJECT_LIBRARIES
- ModelHighAPI
-)
-
-set(PACKAGE_NAME "ModelHighAPI")
-set(TARGET_NAME "Test${PACKAGE_NAME}")
-
-add_executable(${TARGET_NAME} ${PROJECT_SOURCES})
-target_link_libraries(${TARGET_NAME} ${PROJECT_LIBRARIES} ${GTEST_LIBRARY})
-
-GTEST_ADD_TESTS(${CMAKE_BINARY_DIR}/bin/${TARGET_NAME} "" ${PROJECT_SOURCES})
+++ /dev/null
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include <ModelHighAPI_Double.h>
-
-#include <MockModelAPI_AttributeDouble.h>
-
-using ::testing::_;
-using ::testing::Return;
-using ::testing::ReturnRefOfCopy;
-using ::testing::Test;
-
-// TODO(spo): should be common function
-static void null_deleter(void *) {}
-
-class HighModelAPI_Double_Test : public Test {
-public:
- MockModelAPI_AttributeDouble aMockAttributeDouble;
- std::shared_ptr<ModelAPI_AttributeDouble> anAttributeDouble;
-
- HighModelAPI_Double_Test() {
- anAttributeDouble = std::shared_ptr<ModelAPI_AttributeDouble>(&aMockAttributeDouble, &null_deleter);
- }
-
- ~HighModelAPI_Double_Test() {
- }
-};
-
-TEST_F(HighModelAPI_Double_Test, Default) {
- ModelHighAPI_Double aValue;
-
- EXPECT_CALL(aMockAttributeDouble, setValue(0.));
-
- aValue.fillAttribute(anAttributeDouble);
-}
-
-TEST_F(HighModelAPI_Double_Test, Double) {
- ModelHighAPI_Double aValue(100.5);
-
- EXPECT_CALL(aMockAttributeDouble, setValue(100.5));
-
- aValue.fillAttribute(anAttributeDouble);
-}
-
-TEST_F(HighModelAPI_Double_Test, Char) {
- ModelHighAPI_Double aValue("20");
-
- EXPECT_CALL(aMockAttributeDouble, setText("20"));
-
- aValue.fillAttribute(anAttributeDouble);
-}
-
-TEST_F(HighModelAPI_Double_Test, String) {
- ModelHighAPI_Double aValue(std::string("x + 30"));
-
- EXPECT_CALL(aMockAttributeDouble, setText("x + 30"));
-
- aValue.fillAttribute(anAttributeDouble);
-}
+++ /dev/null
-#include <gtest/gtest.h>
-#include <gmock/gmock.h>
-
-#include <ModelHighAPI_Selection.h>
-
-#include <MockModelAPI_AttributeSelection.h>
-
-using ::testing::_;
-using ::testing::Return;
-using ::testing::ReturnRefOfCopy;
-using ::testing::Test;
-
-// TODO(spo): should be common function
-static void null_deleter(void *) {}
-
-class HighModelAPI_Selection_Test : public Test {
-public:
- MockModelAPI_AttributeSelection aMockAttributeSelection;
- std::shared_ptr<ModelAPI_AttributeSelection> anAttributeSelection;
-
- HighModelAPI_Selection_Test() {
- anAttributeSelection = std::shared_ptr<ModelAPI_AttributeSelection>(&aMockAttributeSelection, &null_deleter);
- }
-
- ~HighModelAPI_Selection_Test() {
- }
-};
-
-TEST_F(HighModelAPI_Selection_Test, Default) {
- ModelHighAPI_Selection aValue;
-
- EXPECT_CALL(aMockAttributeSelection, setValue(_, _, false));
-
- aValue.fillAttribute(anAttributeSelection);
-}
-
-TEST_F(HighModelAPI_Selection_Test, ResultAndSubShape) {
- std::shared_ptr<ModelAPI_Result> aResult;
- std::shared_ptr<GeomAPI_Shape> aShape;
- ModelHighAPI_Selection aValue(aResult, aShape);
-
- EXPECT_CALL(aMockAttributeSelection, setValue(_, _, false));
-
- aValue.fillAttribute(anAttributeSelection);
-}
-
-TEST_F(HighModelAPI_Selection_Test, TypeAndSubShapeName) {
- ModelHighAPI_Selection aValue("Type", "SubShapeName");
-
- EXPECT_CALL(aMockAttributeSelection, selectSubShape("Type", "SubShapeName"));
-
- aValue.fillAttribute(anAttributeSelection);
-}