<commit_before>/* 
* Copyright (C) 2007-2013 German Aerospace Center (DLR/SC)
*
* Created: 2013-05-13 <NAME> <<EMAIL>>
* Changed: $Id$ 
*
* Version: $Revision$
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief Tests some fuselage fuctions like circumreference, volumen, etc...
*/

#include "test.h" // Brings in the GTest framework
#include "tigl.h"


/******************************************************************************/

class TiglFuselageHelper : public ::testing::Test {
 protected:
  static void SetUpTestCase() {
        const char* filename = "TestData/CPACS_21_D150.xml";
        ReturnCode tixiRet;
        TiglReturnCode tiglRet;

        tiglHandle = -1;
        tixiHandle = -1;
        
        tixiRet = tixiOpenDocument(filename, &tixiHandle);
        ASSERT_TRUE (tixiRet == SUCCESS);
        tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "D150_VAMP", &tiglHandle);
        ASSERT_TRUE(tiglRet == TIGL_SUCCESS);
  }

  static void TearDownTestCase() {
        ASSERT_TRUE(tiglCloseCPACSConfiguration(tiglHandle) == TIGL_SUCCESS);
        ASSERT_TRUE(tixiCloseDocument(tixiHandle) == SUCCESS);
        tiglHandle = -1;
        tixiHandle = -1;
  }
  
  virtual void SetUp() {}
  virtual void TearDown() {}
  

  static TixiDocumentHandle           tixiHandle;
  static TiglCPACSConfigurationHandle tiglHandle;
};


TixiDocumentHandle TiglFuselageHelper::tixiHandle = 0;
TiglCPACSConfigurationHandle TiglFuselageHelper::tiglHandle = 0;

//#########################################################################################################

/**
* Tests tiglFuselageGetCircumference with success
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetCircumference_success)
{
    double circumferencePtr;
    ASSERT_TRUE(tiglFuselageGetCircumference(tiglHandle, 1, 10, 0.5, &circumferencePtr) == TIGL_SUCCESS);
    ASSERT_NEAR(circumferencePtr, 6.77885, 0.1);
}


/**
* Tests tiglFuselageGetCircumference with null pointer to circumferencePtr
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetProfileName_nullPointer)
{
    double circumferencePtr;
    ASSERT_TRUE(tiglFuselageGetCircumference(tiglHandle, 1, 10, 0.5, NULL) == TIGL_NULL_POINTER);
}



/**
* Tests tiglFuselageGetProfileName with success
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetProfileName_success)
{
    char* profileName; 
    ASSERT_TRUE(tiglFuselageGetProfileName(tiglHandle, 1, 1, 1, &profileName) == TIGL_SUCCESS);
    ASSERT_STREQ(profileName, "Circle");
}


/**
* Tests tiglFuselageGetUID with success
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetUID_success)
{
    char* uid; 
    ASSERT_TRUE(tiglFuselageGetUID(tiglHandle, 1, &uid) == TIGL_SUCCESS);
    ASSERT_STREQ(uid, "D150_VAMP_FL1");
}


<commit_msg>Few more tests.<commit_after>/* 
* Copyright (C) 2007-2013 German Aerospace Center (DLR/SC)
*
* Created: 2013-05-13 <NAME> <<EMAIL>>
* Changed: $Id$ 
*
* Version: $Revision$
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* @file
* @brief Tests some fuselage fuctions like circumreference, volumen, etc...
*/

#include "test.h" // Brings in the GTest framework
#include "tigl.h"


/******************************************************************************/

class TiglFuselageHelper : public ::testing::Test {
 protected:
  static void SetUpTestCase() {
        const char* filename = "TestData/CPACS_21_D150.xml";
        ReturnCode tixiRet;
        TiglReturnCode tiglRet;

        tiglHandle = -1;
        tixiHandle = -1;
        
        tixiRet = tixiOpenDocument(filename, &tixiHandle);
        ASSERT_TRUE (tixiRet == SUCCESS);
        tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "D150_VAMP", &tiglHandle);
        ASSERT_TRUE(tiglRet == TIGL_SUCCESS);
  }

  static void TearDownTestCase() {
        ASSERT_TRUE(tiglCloseCPACSConfiguration(tiglHandle) == TIGL_SUCCESS);
        ASSERT_TRUE(tixiCloseDocument(tixiHandle) == SUCCESS);
        tiglHandle = -1;
        tixiHandle = -1;
  }
  
  virtual void SetUp() {}
  virtual void TearDown() {}
  

  static TixiDocumentHandle           tixiHandle;
  static TiglCPACSConfigurationHandle tiglHandle;
};


TixiDocumentHandle TiglFuselageHelper::tixiHandle = 0;
TiglCPACSConfigurationHandle TiglFuselageHelper::tiglHandle = 0;

//#########################################################################################################

/**
* Tests tiglFuselageGetCircumference with success
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetCircumference_success)
{
    double circumferencePtr;
    ASSERT_TRUE(tiglFuselageGetCircumference(tiglHandle, 1, 10, 0.5, &circumferencePtr) == TIGL_SUCCESS);
    ASSERT_NEAR(circumferencePtr, 6.77885, 0.1);
}


/**
* Tests tiglFuselageGetCircumference with null pointer to circumferencePtr
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetProfileName_nullPointer)
{
    double circumferencePtr;
    ASSERT_TRUE(tiglFuselageGetCircumference(tiglHandle, 1, 10, 0.5, NULL) == TIGL_NULL_POINTER);
}



/**
* Tests tiglFuselageGetProfileName with success
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetProfileName_success)
{
    char* profileName; 
    ASSERT_TRUE(tiglFuselageGetProfileName(tiglHandle, 1, 1, 1, &profileName) == TIGL_SUCCESS);
    ASSERT_STREQ(profileName, "Circle");
}


/**
* Tests tiglFuselageGetUID with success
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetUID_success)
{
    char* uid; 
    ASSERT_TRUE(tiglFuselageGetUID(tiglHandle, 1, &uid) == TIGL_SUCCESS);
    ASSERT_STREQ(uid, "D150_VAMP_FL1");
}


/**
* Tests tiglFuselageGetSegmentUID with success
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetSegmentUID_success)
{
    char* uid; 
    ASSERT_TRUE(tiglFuselageGetSegmentUID(tiglHandle, 1, 1, &uid) == TIGL_SUCCESS);
    ASSERT_STREQ(uid, "D150_VAMP_FL1_Seg1");
}



/**
* Tests tiglFuselageGetSectionUID with success
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetSectionUID_success)
{
    char* uid; 
    ASSERT_TRUE(tiglFuselageGetSectionUID(tiglHandle, 1, 1, &uid) == TIGL_SUCCESS);
    ASSERT_STREQ(uid, "D150_VAMP_FL1_Sec1");
}



/**
* Tests tiglFuselageGetSymmetry with success
*/
TEST_F(TiglFuselageHelper, tiglFuselageGetSymmetry_noSymmetrySuccess)
{
    TiglSymmetryAxis axis;
    ASSERT_TRUE(tiglFuselageGetSymmetry(tiglHandle, 1, &axis) == TIGL_SUCCESS);
    ASSERT_TRUE(TIGL_NO_SYMMETRY == axis) << "Symmetry not correct. Was looking for TIGL_NO_SYMMETRY";
}





{'fraction_non_alphanumeric': 0.14195334124159747, 'fraction_numerical': 0.017793594306049824, 'mean_word_length': 3.911326860841424, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7283614', 'n_tokens_mistral': 2774, 'n_tokens_neox': 2544, 'n_words': 529}