Back to index

salome-kernel  6.5.0
Public Member Functions | Private Member Functions
SALOMEDSImplTest Class Reference

#include <SALOMEDSImplTest.hxx>

List of all members.

Public Member Functions

void setUp ()
 Set up the environment.
void tearDown ()
void testAttributeParameter ()
 Check setting int value.

Private Member Functions

 CPPUNIT_TEST_SUITE (SALOMEDSImplTest)
 CPPUNIT_TEST (testAttributeParameter)
 CPPUNIT_TEST_SUITE_END ()

Detailed Description

Definition at line 28 of file SALOMEDSImplTest.hxx.


Member Function Documentation

Set up the environment.

Definition at line 45 of file SALOMEDSImplTest.cxx.

{
}
  • delete trace classes

Definition at line 56 of file SALOMEDSImplTest.cxx.

{
}

Check setting int value.

Definition at line 65 of file SALOMEDSImplTest.cxx.

{
  SALOMEDSImpl_StudyManager* sm = new SALOMEDSImpl_StudyManager();
  SALOMEDSImpl_Study* study = sm->NewStudy("Test");
  SALOMEDSImpl_AttributeParameter* _ap = study->GetCommonParameters("TestComp", 0);

  CPPUNIT_ASSERT(_ap);

  _ap->SetInt("IntValue", 1);
  CPPUNIT_ASSERT(_ap->IsSet("IntValue", PT_INTEGER));
  CPPUNIT_ASSERT(_ap->GetInt("IntValue") == 1);

  _ap->SetReal("RealValue", 1.2);
  CPPUNIT_ASSERT(_ap->IsSet("RealValue", PT_REAL));
  CPPUNIT_ASSERT(_ap->GetReal("RealValue") == 1.2);

  _ap->SetString("StringValue", "hello");
  CPPUNIT_ASSERT(_ap->IsSet("StringValue", PT_STRING));
  CPPUNIT_ASSERT(_ap->GetString("StringValue") == "hello");

  _ap->SetBool("BoolValue", 0);
  CPPUNIT_ASSERT(_ap->IsSet("BoolValue", PT_BOOLEAN));
  CPPUNIT_ASSERT(!_ap->GetBool("BoolValue"));

  _ap->SetBool("BoolValue", 0);
  CPPUNIT_ASSERT(_ap->IsSet("BoolValue", PT_BOOLEAN));
  CPPUNIT_ASSERT(!_ap->GetBool("BoolValue"));

  std::vector<int> intArray;
  intArray.push_back(0);
  intArray.push_back(1);

  _ap->SetIntArray("IntArray", intArray);
  CPPUNIT_ASSERT(_ap->IsSet("IntArray", PT_INTARRAY));
  CPPUNIT_ASSERT(_ap->GetIntArray("IntArray")[0] == 0);
  CPPUNIT_ASSERT(_ap->GetIntArray("IntArray")[1] == 1); 

  std::vector<double> realArray;
  realArray.push_back(0.0);
  realArray.push_back(1.1);
  
  _ap->SetRealArray("RealArray", realArray);
  CPPUNIT_ASSERT(_ap->IsSet("RealArray", PT_REALARRAY));
  CPPUNIT_ASSERT(_ap->GetRealArray("RealArray")[0] == 0.0);
  CPPUNIT_ASSERT(_ap->GetRealArray("RealArray")[1] == 1.1); 

  std::vector<std::string> strArray;
  strArray.push_back("hello");
  strArray.push_back("world");
  
  _ap->SetStrArray("StrArray", strArray);
  CPPUNIT_ASSERT(_ap->IsSet("StrArray", PT_STRARRAY));
  CPPUNIT_ASSERT(_ap->GetStrArray("StrArray")[0] == "hello");
  CPPUNIT_ASSERT(_ap->GetStrArray("StrArray")[1] == "world"); 

}

The documentation for this class was generated from the following files: